Classes | Namespaces | Macros | Functions
strmsize.h File Reference

This file contains stream_size_of functions for basic types and *STREAMABLE macros. stream_size_of functions return the size of the object's data that is written or read from a stream. More...

Classes

struct  ustl::object_stream_size< T >
 For partial specialization of stream_size_of for objects. More...
 
struct  ustl::integral_object_stream_size< T >
 

Namespaces

 ustl
 The ustl namespace contains all ustl classes and algorithms.
 

Macros

#define ALIGNOF(type, grain)
 
#define INTEGRAL_STREAMABLE(T)
 Declares that T is to be written as is into binary streams. More...
 
#define STD_STREAMABLE(T)
 Declares that T contains read, write, and stream_size methods. This is no longer needed and is deprecated.
 
#define TEXT_STREAMABLE(T)
 Declares T to be writable to text streams. This is no longer needed and is deprecated.
 
#define CAST_STREAMABLE(T, TSUB)
 Declares that T is to be cast into TSUB for streaming. More...
 
#define DECLARE_STD_STREAMABLE
 Placed into a class it declares the methods required by STD_STREAMABLE. Syntactic sugar. More...
 
#define LOOKUP_TEXT_STREAMABLE(T, Names, nNames)
 Specifies that T is printed by using it as an index into Names string array. More...
 

Functions

template<typename T >
streamsize ustl::stream_size_of (const T &v)
 Returns the size of the given object. Overloads for standard types are available.
 
template<typename T >
size_t ustl::stream_align_of (const T &)
 Returns the recommended stream alignment for type T. Override with ALIGNOF. Because this is occasionally called with a null value, do not access the argument!
 

Detailed Description

This file contains stream_size_of functions for basic types and *STREAMABLE macros. stream_size_of functions return the size of the object's data that is written or read from a stream.

Macro Definition Documentation

#define ALIGNOF (   type,
  grain 
)
Value:
namespace ustl { \
template <> inline size_t stream_align_of (const type&) { return grain; } }
size_t stream_align_of(const T &)
Returns the recommended stream alignment for type T. Override with ALIGNOF. Because this is occasiona...
Definition: strmsize.h:33
The ustl namespace contains all ustl classes and algorithms.
Definition: bktrace.cc:16
#define CAST_STREAMABLE (   T,
  TSUB 
)
Value:
namespace ustl { \
inline istream& operator>> (istream& is, T& v) { TSUB sv; is >> sv; v = (T)(sv); return is; } \
inline ostream& operator<< (ostream& os, const T& v) { os << TSUB(v); return os; } \
template<> inline streamsize stream_size_of(const T& v) { return stream_size_of (TSUB(v)); } \
}
The ustl namespace contains all ustl classes and algorithms.
Definition: bktrace.cc:16
streamsize stream_size_of(const T &v)
Returns the size of the given object. Overloads for standard types are available. ...
Definition: strmsize.h:24

Declares that T is to be cast into TSUB for streaming.

#define DECLARE_STD_STREAMABLE
Value:
public: \
void read (istream& is); \
void write (ostream& os) const; \
streamsize stream_size (void) const

Placed into a class it declares the methods required by STD_STREAMABLE. Syntactic sugar.

#define INTEGRAL_STREAMABLE (   T)
Value:
namespace ustl { \
inline istream& operator>> (istream& is, T& v) { is.iread(v); return is; } \
inline ostream& operator<< (ostream& os, const T& v) { os.iwrite(v); return os; } \
inline ostream& operator<< (ostream& os, T& v) { os.iwrite(v); return os; } \
template<> inline streamsize stream_size_of(const T& v) { return sizeof(v); } \
}
The ustl namespace contains all ustl classes and algorithms.
Definition: bktrace.cc:16
streamsize stream_size_of(const T &v)
Returns the size of the given object. Overloads for standard types are available. ...
Definition: strmsize.h:24

Declares that T is to be written as is into binary streams.

#define LOOKUP_TEXT_STREAMABLE (   T,
  Names,
  nNames 
)
Value:
namespace ustl { \
inline ostringstream& operator<< (ostringstream& os, const T& v) { \
os << Names[min(uoff_t(v),uoff_t(nNames-1))]; \
return os; \
} \
}
constexpr T1 min(const T1 &a, const T2 &b)
Returns the minimum of a and b.
Definition: uutility.h:71
The ustl namespace contains all ustl classes and algorithms.
Definition: bktrace.cc:16

Specifies that T is printed by using it as an index into Names string array.


Generated on Mon Sep 28 2015 17:58:50 for uSTL by Doxygen 1.8.10