oasys::Unmarshal Class Reference

#include <MarshalSerialize.h>

Inheritance diagram for oasys::Unmarshal:

oasys::BufferedSerializeAction oasys::SerializeAction oasys::Serialize

List of all members.


Detailed Description

Unmarshal is a SerializeAction that constructs an object's internals from a flat byte stream.

INVARIANT: The length of the buffer must be the length of the serialized buffer.

Definition at line 86 of file MarshalSerialize.h.


Public Member Functions

 Unmarshal (context_t context, const u_char *buf, size_t length, int options=0)
 Constructor.
void begin_action ()
 Control the initialization done before executing an action.
void process (const char *name, u_int64_t *i)
 Process function for an 8 byte integer.
void process (const char *name, u_int32_t *i)
 Process function for a 4 byte integer.
void process (const char *name, u_int16_t *i)
 Process function for a 2 byte integer.
void process (const char *name, u_int8_t *i)
 Process function for a byte.
void process (const char *name, bool *b)
 Process function for a boolean.
void process (const char *name, u_char *bp, u_int32_t len)
 Process function for a constant length char buffer.
void process (const char *name, u_char **bp, u_int32_t *lenp, int flags)
 Process function for a variable length char buffer.
void process (const char *name, std::string *s)
 Process function for a c++ string.

Private Attributes

bool has_crc_

Constructor & Destructor Documentation

oasys::Unmarshal::Unmarshal ( context_t  context,
const u_char *  buf,
size_t  length,
int  options = 0 
)

Constructor.

Definition at line 198 of file MarshalSerialize.cc.


Member Function Documentation

void oasys::Unmarshal::begin_action (  )  [virtual]

Control the initialization done before executing an action.

Reimplemented from oasys::SerializeAction.

Definition at line 206 of file MarshalSerialize.cc.

References oasys::BufferedSerializeAction::buf(), oasys::CRC32::from_bytes(), oasys::BufferedSerializeAction::length(), oasys::SerializeAction::log_, oasys::LOG_INFO, oasys::LOG_WARN, oasys::logf(), oasys::SerializeAction::options_, oasys::SerializeAction::signal_error(), oasys::CRC32::update(), oasys::Serialize::USE_CRC, and oasys::CRC32::value().

void oasys::Unmarshal::process ( const char *  name,
u_int64_t *  i 
) [virtual]

Process function for an 8 byte integer.

Implements oasys::SerializeAction.

Definition at line 234 of file MarshalSerialize.cc.

References oasys::BufferedSerializeAction::buf(), oasys::SerializeAction::log_, oasys::LOG_DEBUG, oasys::logf(), and oasys::BufferedSerializeAction::next_slice().

Referenced by process().

void oasys::Unmarshal::process ( const char *  name,
u_int32_t *  i 
) [virtual]

Process function for a 4 byte integer.

Implements oasys::SerializeAction.

Definition at line 247 of file MarshalSerialize.cc.

References oasys::BufferedSerializeAction::buf(), oasys::SerializeAction::log_, oasys::LOG_DEBUG, oasys::logf(), and oasys::BufferedSerializeAction::next_slice().

void oasys::Unmarshal::process ( const char *  name,
u_int16_t *  i 
) [virtual]

Process function for a 2 byte integer.

Implements oasys::SerializeAction.

Definition at line 257 of file MarshalSerialize.cc.

References oasys::BufferedSerializeAction::buf(), oasys::SerializeAction::log_, oasys::LOG_DEBUG, oasys::logf(), and oasys::BufferedSerializeAction::next_slice().

void oasys::Unmarshal::process ( const char *  name,
u_int8_t *  i 
) [virtual]

Process function for a byte.

Implements oasys::SerializeAction.

Definition at line 267 of file MarshalSerialize.cc.

References oasys::BufferedSerializeAction::buf(), oasys::SerializeAction::log_, oasys::LOG_DEBUG, oasys::logf(), and oasys::BufferedSerializeAction::next_slice().

void oasys::Unmarshal::process ( const char *  name,
bool b 
) [virtual]

Process function for a boolean.

Implements oasys::SerializeAction.

Definition at line 277 of file MarshalSerialize.cc.

References oasys::BufferedSerializeAction::buf(), oasys::SerializeAction::log_, oasys::LOG_DEBUG, oasys::logf(), and oasys::BufferedSerializeAction::next_slice().

void oasys::Unmarshal::process ( const char *  name,
u_char *  bp,
u_int32_t  len 
) [virtual]

Process function for a constant length char buffer.

Parameters:
name field name
bp buffer
len buffer length

Implements oasys::SerializeAction.

Definition at line 287 of file MarshalSerialize.cc.

References oasys::BufferedSerializeAction::buf(), oasys::hex2str(), oasys::SerializeAction::log_, oasys::LOG_DEBUG, oasys::logf(), and oasys::BufferedSerializeAction::next_slice().

void oasys::Unmarshal::process ( const char *  name,
u_char **  bp,
u_int32_t *  lenp,
int  flags 
) [virtual]

Process function for a variable length char buffer.

Parameters:
name field name
bp buffer, allocated by SerializeAction if ALLOC_MEM flag is set.
lenp IN: If ALLOC_MEM flags is set, then len is the length of the buffer allocated. OUT: contains the length of the buffer
flags ALLOC_MEM as above, NULL_TERMINATED specifies that the data stored will be a null-terminated C-string.

Implements oasys::SerializeAction.

Definition at line 303 of file MarshalSerialize.cc.

References oasys::Serialize::ALLOC_MEM, oasys::BufferedSerializeAction::buf(), oasys::hex2str(), oasys::BufferedSerializeAction::length(), oasys::SerializeAction::log_, oasys::LOG_DEBUG, oasys::logf(), oasys::BufferedSerializeAction::next_slice(), oasys::Serialize::NULL_TERMINATED, oasys::BufferedSerializeAction::offset(), process(), and oasys::SerializeAction::signal_error().

void oasys::Unmarshal::process ( const char *  name,
std::string *  s 
) [virtual]

Process function for a c++ string.

Implements oasys::SerializeAction.

Definition at line 351 of file MarshalSerialize.cc.

References ASSERT, oasys::BufferedSerializeAction::buf(), oasys::SerializeAction::log_, oasys::LOG_DEBUG, oasys::logf(), oasys::BufferedSerializeAction::next_slice(), and process().


Member Data Documentation

bool oasys::Unmarshal::has_crc_ [private]

Definition at line 107 of file MarshalSerialize.h.


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 08:43:52 2007 for DTN Reference Implementation by  doxygen 1.5.3