Packer serializes objects into ssrc::spread::detail::ByteBuffer instances (usually a ssrc::spread::Message instance). More...
#include <serialization.h>
Public Types |
|
typedef detail::char_array_sink | sink_type |
typedef detail::char_array_sink_buffer | sink_buffer |
typedef Archive | output_archive |
Public Member Functions |
|
template<typename T > | |
unsigned int | pack (const T &obj, ByteBuffer &buffer, const unsigned int archive_flags=boost::archive::no_header|boost::archive::no_codecvt|boost::archive::no_tracking) SSRC_DECL_THROW(boost |
Serializes an object into a buffer. More... |
|
Protected Attributes |
|
sink_type | _sink |
sink_buffer | _out_buf |
Detailed Description
template<typename Archive>
class Packer< Archive >
Packer serializes objects into ssrc::spread::detail::ByteBuffer instances (usually a ssrc::spread::Message instance).
Each object type must have a Boost serialize function or method defined (or load and save).
- Parameters
-
Archive The archive type to use for serialization.
Definition at line 150 of file serialization.h.
Member Typedef Documentation
typedef Archive Packer< Archive >::output_archive |
Definition at line 154 of file serialization.h.
typedef detail::char_array_sink_buffer Packer< Archive >::sink_buffer |
Definition at line 153 of file serialization.h.
typedef detail::char_array_sink Packer< Archive >::sink_type |
Definition at line 152 of file serialization.h.
Member Function Documentation
|
inline |
Serializes an object into a buffer.
The type of the object is automatically inferred by the compiler. The object write starts at the current buffer offset. After the object is serialized, the buffer size is adjusted and its write offset advanced to the end of the buffer. The buffer must have enough room to hold the data written or an exception will be thrown (std::ios_base::failure).
- Parameters
-
obj The object to serialize. buffer The buffer that will store the object. archive_flags Boost archive constructor flags.
- Returns
- The number of bytes written.
- Exceptions
-
boost::archive::archive_exception If there is an archive writing error. std::ios_base::failure If the stream buffer fails, most likely because the buffer doesn't have enough room to hold the data.
Definition at line 181 of file serialization.h.
References detail::array_device_adapter< Ch, mode_type >::init(), and detail::char_array_streambuf< DeviceAdapter >::open().
Member Data Documentation
|
protected |
Definition at line 158 of file serialization.h.
Definition at line 157 of file serialization.h.
The documentation for this class was generated from the following file: