Savarese Software Research Corporation
Unpacker< Archive > Class Template Reference

Unpacker deserializes objects from ssrc::spread::detail::ByteBuffer instances (usually a ssrc::spread::Message instance). More...

#include <serialization.h>

List of all members.

Public Types

typedef detail::char_array_source  source_type
typedef
detail::char_array_sink_buffer 
source_buffer
typedef Archive  input_archive

Public Member Functions

template<typename T >
unsigned int  unpack (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
  Deserializes an object from a buffer.
template<typename T >
unsigned int  unpack (T &obj, const void *buffer, unsigned int size, const unsigned int archive_flags=boost::archive::no_header|boost::archive::no_codecvt|boost::archive::no_tracking) SSRC_DECL_THROW(boost
  Deserializes an object from a void * buffer.

Protected Attributes

source_type  _source
source_buffer  _in_buf

Detailed Description

template<typename Archive>
class Unpacker< Archive >

Unpacker deserializes objects from 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 215 of file serialization.h.


Member Typedef Documentation

template<typename Archive >
typedef Archive Unpacker< Archive >::input_archive

Definition at line 219 of file serialization.h.

template<typename Archive >
typedef detail::char_array_sink_buffer Unpacker< Archive >::source_buffer

Definition at line 218 of file serialization.h.

template<typename Archive >
typedef detail::char_array_source Unpacker< Archive >::source_type

Definition at line 217 of file serialization.h.


Member Function Documentation

template<typename Archive >
template<typename T >
unsigned int Unpacker< Archive >::unpack ( T &  obj,
ByteBuffer &  buffer,
const unsigned int  archive_flags = boost::archive::no_header | boost::archive::no_codecvt | boost::archive::no_tracking 
) [inline]

Deserializes an object from a buffer.

The type of the object is automatically inferred by the compiler. The object read starts at the current buffer offset. After the object is deserialized, the buffer offset is adjusted and its read offset advanced to the end of the data read.

Parameters:
obj The deserialization target.
buffer The buffer storing the serialized object.
archive_flags Boost archive constructor flags.
Returns:
The number of bytes read.
Exceptions:
boost::archive::archive_exception If there is an archive read error.
std::ios_base::failure If the stream buffer fails.

Definition at line 243 of file serialization.h.

References Unpacker< Archive >::_in_buf, Unpacker< Archive >::_source, detail::array_device_adapter< Ch, mode_type >::init(), and detail::char_array_streambuf< DeviceAdapter >::open().

template<typename Archive >
template<typename T >
unsigned int Unpacker< Archive >::unpack ( T &  obj,
const void *  buffer,
unsigned int  size,
const unsigned int  archive_flags = boost::archive::no_header | boost::archive::no_codecvt | boost::archive::no_tracking 
) [inline]

Deserializes an object from a void * buffer.

The type of the object is automatically inferred by the compiler. We use this method primarily to unpack serialized objects from blobs without copying the buffer first.

Parameters:
obj The deserialization target.
buffer The buffer storing the serialized object.
size The number of bytes in the buffer.
archive_flags Boost archive constructor flags.
Returns:
The number of bytes read.
Exceptions:
boost::archive::archive_exception If there is an archive read error.
std::ios_base::failure If the stream buffer fails.

Definition at line 285 of file serialization.h.

References Unpacker< Archive >::_in_buf, Unpacker< Archive >::_source, detail::array_device_adapter< Ch, mode_type >::init(), and detail::char_array_streambuf< DeviceAdapter >::open().


Member Data Documentation

template<typename Archive >
source_buffer Unpacker< Archive >::_in_buf [protected]

Definition at line 223 of file serialization.h.

Referenced by Unpacker< Archive >::unpack().

template<typename Archive >
source_type Unpacker< Archive >::_source [protected]

Definition at line 222 of file serialization.h.

Referenced by Unpacker< Archive >::unpack().


The documentation for this class was generated from the following file:

Savarese Software Research Corporation
Copyright © 2006-2010 Savarese Software Research Corporation. All rights reserved.