Declaration of cmnSerializer and functions cmnSerializeRaw.
More...
Go to the source code of this file.
|
template<class _elementType > |
void | cmnSerializeRaw (std::ostream &outputStream, const _elementType &data) throw (std::runtime_error) |
|
void | cmnSerializeSizeRaw (std::ostream &outputStream, const size_t &data) throw (std::runtime_error) |
|
void | cmnSerializeRaw (std::ostream &outputStream, const std::string &data) throw (std::runtime_error) |
|
template<class _elementType > |
void | cmnSerializeRaw (std::ostream &outputStream, const std::vector< _elementType > &data) throw (std::runtime_error) |
|
Declaration of cmnSerializer and functions cmnSerializeRaw.
template<class _elementType >
void cmnSerializeRaw |
( |
std::ostream & |
outputStream, |
|
|
const _elementType & |
data |
|
) |
| |
throw | ( | std::runtime_error |
| ) | | |
|
inline |
Serialization helper function for a basic type. If the type is derived from cmnGenericObject, it just calls the SerializeRaw member function. Otherwise, it performs a cast to char pointer (char *
) using reinterpret_cast
and then writes the result to the output stream. If the write operation fails, an exception is thrown (std::runtime_error
).
void cmnSerializeRaw |
( |
std::ostream & |
outputStream, |
|
|
const std::string & |
data |
|
) |
| |
throw | ( | std::runtime_error |
| ) | | |
|
inline |
Serialization helper function for an STL string. This function first serializes the string size and then writes all the string characters (char
) to the output stream. If the write operation fails, an exception is thrown (std::runtime_error
).
template<class _elementType >
void cmnSerializeRaw |
( |
std::ostream & |
outputStream, |
|
|
const std::vector< _elementType > & |
data |
|
) |
| |
throw | ( | std::runtime_error |
| ) | | |
|
inline |
Serialization helper function for an STL vector. This function first serializes the vector size and then calls cmnSerializeRaw for each element of the vector (thus, it will only work if cmnSerializeRaw is defined for the element type. If the write operation fails, an exception is thrown (std::runtime_error
).
void cmnSerializeSizeRaw |
( |
std::ostream & |
outputStream, |
|
|
const size_t & |
data |
|
) |
| |
throw | ( | std::runtime_error |
| ) | | |
|
inline |
Serialization helper function for size object. This function converts a size_t object to an unsigned long long int before using cmnSerializeRaw. This operation is required for all size_t as the writer/reader can be both 32 bits or 64 bits programs.
This function should be use to implement the SerializeRaw method of classes derived from cmnGenericObject.