#include <Serialize.h>
Inheritance diagram for oasys::SerializeAction:
The action object is then passed to the serialize() function which will re-dispatch to the basic type functions for each of the SerializableObject's member fields.
INVARIANT: A single SerializeAction must be able to be called on several different visitee objects in succession. (Basically this ability is used to be able to string several Marshallable objects together, either for writing or reading).
Definition at line 155 of file Serialize.h.
Public Member Functions | |
SerializeAction (action_t action, context_t context, int options=0) | |
Create a SerializeAction with the specified type code and context. | |
virtual int | action (SerializableObject *object) |
Call the virtual serialize() callback which will, in turn, call the various process() callbacks on ourself. | |
virtual void | begin_action () |
By default, do nothing. | |
virtual void | end_action () |
By default, do nothing. | |
action_t | action_code () |
Accessor for the action type. | |
context_t | context () |
Accessor for the context. | |
bool | error () |
Accessor for error. | |
virtual void | process (const char *name, SerializableObject *object) |
Process function for a contained SerializableObject. | |
virtual void | process (const char *name, u_int32_t *i)=0 |
Process function for a 4 byte integer. | |
virtual void | process (const char *name, u_int16_t *i)=0 |
Process function for a 2 byte integer. | |
virtual void | process (const char *name, u_int8_t *i)=0 |
Process function for a byte. | |
virtual void | process (const char *name, bool *b)=0 |
Process function for a boolean. | |
virtual void | process (const char *name, u_char *bp, size_t len)=0 |
Process function for a constant length char buffer. | |
virtual void | process (const char *name, u_char **bp, size_t *lenp, int flags)=0 |
Process function for a variable length char buffer. | |
virtual void | process (const char *name, std::string *s)=0 |
Process function for a c++ string. | |
void | logpath (const char *log) |
Set a log target for verbose serialization. | |
virtual | ~SerializeAction () |
Destructor. | |
virtual void | process (const char *name, int32_t *i) |
Adaptor functions for signed/unsigned compatibility. | |
virtual void | process (const char *name, int16_t *i) |
Adaptor functions for signed/unsigned compatibility. | |
virtual void | process (const char *name, int8_t *i) |
Adaptor functions for signed/unsigned compatibility. | |
virtual void | process (const char *name, char *bp, size_t len) |
Adaptor functions for signed/unsigned compatibility. | |
Protected Member Functions | |
void | signal_error () |
Signal that an error has occurred. | |
Protected Attributes | |
action_t | action_ |
Serialization action code. | |
context_t | context_ |
Serialization context. | |
int | options_ |
Serialization options. | |
const char * | log_ |
Optional log for verbose marshalling. | |
Private Member Functions | |
SerializeAction () | |
Private Attributes | |
bool | error_ |
Indication of whether an error occurred. |
Create a SerializeAction with the specified type code and context.
action | serialization action type code | |
context | serialization context | |
options | serialization options |
Definition at line 50 of file Serialize.cc.
oasys::SerializeAction::~SerializeAction | ( | ) | [virtual] |
oasys::SerializeAction::SerializeAction | ( | ) | [private] |
int oasys::SerializeAction::action | ( | SerializableObject * | object | ) | [virtual] |
Call the virtual serialize() callback which will, in turn, call the various process() callbacks on ourself.
Definition at line 73 of file Serialize.cc.
References begin_action(), end_action(), error_, and oasys::SerializableObject::serialize().
Referenced by oasys::TclListSerialize::action(), oasys::StringSerialize::action(), oasys::SQLTableFormat::action(), oasys::SQLUpdate::action(), oasys::SQLInsert::action(), oasys::MarshalCRC::action(), oasys::MarshalSize::action(), oasys::Marshal::action(), oasys::KeyMarshal::action(), oasys::BerkeleyDBTable::get(), oasys::FileSystemIterator::get_key(), oasys::BerkeleyDBIterator::get_key(), and oasys::KeyUnmarshal::process().
void oasys::SerializeAction::begin_action | ( | ) | [virtual] |
By default, do nothing.
Reimplemented in oasys::Unmarshal, oasys::MarshalSize, oasys::SQLInsert, oasys::SQLUpdate, and oasys::SQLTableFormat.
Definition at line 92 of file Serialize.cc.
Referenced by action().
void oasys::SerializeAction::end_action | ( | ) | [virtual] |
By default, do nothing.
Reimplemented in oasys::KeyMarshal, oasys::Marshal, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, and oasys::StringSerialize.
Definition at line 100 of file Serialize.cc.
Referenced by action().
action_t oasys::SerializeAction::action_code | ( | ) | [inline] |
Accessor for the action type.
Definition at line 187 of file Serialize.h.
References action_.
Referenced by oasys::ByteBufShim::serialize(), dtn::Registration::serialize(), dtn::Link::serialize(), dtn::EndpointID::serialize(), and dtn::Bundle::serialize().
context_t oasys::SerializeAction::context | ( | ) | [inline] |
bool oasys::SerializeAction::error | ( | ) | [inline] |
Accessor for error.
Definition at line 197 of file Serialize.h.
References error_.
Referenced by oasys::KeyMarshal::border(), oasys::BufferedSerializeAction::next_slice(), oasys::TextUnmarshal::process(), oasys::KeyUnmarshal::process(), oasys::KeyMarshal::process(), oasys::KeyMarshal::process_int(), and oasys::serialize_basic_vector().
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
SerializableObject * | object | |||
) | [inline, virtual] |
Process function for a contained SerializableObject.
The default implementation just calls serialize() on the contained object, ignoring the name value. However, a derived class can of course override it to make use of the name (as is done by SQLTableFormat, for example).
Reimplemented in oasys::BufferedSerializeAction, oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::MarshalSize, oasys::MarshalCRC, oasys::SQLTableFormat, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, and oasys::TextUnmarshal.
Definition at line 213 of file Serialize.h.
References oasys::SerializableObject::serialize().
Referenced by oasys::StringSerialize::process(), process(), oasys::MarshalCRC::process(), oasys::MarshalSize::process(), oasys::Marshal::process(), oasys::PrefixAdapter< _SerializablePrefix, _SerializableObject >::serialize(), oasys::ByteBufShim::serialize(), oasys::NullStringShim::serialize(), oasys::StringShim::serialize(), oasys::UIntShim::serialize(), oasys::IntShim::serialize(), dtn::Registration::serialize(), oasys::MD5Hash_t::serialize(), dtn::Link::serialize(), dtn::Globals::serialize(), dtn::EndpointID::serialize(), dtn::BundlePayload::serialize(), dtn::Bundle::serialize(), and oasys::serialize_basic_vector().
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
u_int32_t * | i | |||
) | [pure virtual] |
Process function for a 4 byte integer.
Implemented in oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::Unmarshal, oasys::MarshalSize, oasys::MarshalCRC, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, oasys::SQLExtract, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, and oasys::TextUnmarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
u_int16_t * | i | |||
) | [pure virtual] |
Process function for a 2 byte integer.
Implemented in oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::Unmarshal, oasys::MarshalSize, oasys::MarshalCRC, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, oasys::SQLExtract, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, and oasys::TextUnmarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
u_int8_t * | i | |||
) | [pure virtual] |
Process function for a byte.
Implemented in oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::Unmarshal, oasys::MarshalSize, oasys::MarshalCRC, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, oasys::SQLExtract, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, and oasys::TextUnmarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
bool * | b | |||
) | [pure virtual] |
Process function for a boolean.
Implemented in oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::Unmarshal, oasys::MarshalSize, oasys::MarshalCRC, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, oasys::SQLExtract, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, and oasys::TextUnmarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
u_char * | bp, | |||
size_t | len | |||
) | [pure virtual] |
Process function for a constant length char buffer.
name | field name | |
bp | buffer | |
len | buffer length |
Implemented in oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::Unmarshal, oasys::MarshalSize, oasys::MarshalCRC, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, oasys::SQLExtract, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, and oasys::TextUnmarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
u_char ** | bp, | |||
size_t * | lenp, | |||
int | flags | |||
) | [pure virtual] |
Process function for a variable length char buffer.
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. |
Implemented in oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::Unmarshal, oasys::MarshalSize, oasys::MarshalCRC, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, oasys::SQLExtract, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, and oasys::TextUnmarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
std::string * | s | |||
) | [pure virtual] |
Process function for a c++ string.
Implemented in oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::Unmarshal, oasys::MarshalSize, oasys::MarshalCRC, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, oasys::SQLExtract, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, and oasys::TextUnmarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
int32_t * | i | |||
) | [inline, virtual] |
Adaptor functions for signed/unsigned compatibility.
Reimplemented in oasys::SQLInsert, and oasys::SQLUpdate.
Definition at line 272 of file Serialize.h.
References process().
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
int16_t * | i | |||
) | [inline, virtual] |
Adaptor functions for signed/unsigned compatibility.
Reimplemented in oasys::SQLInsert, and oasys::SQLUpdate.
Definition at line 277 of file Serialize.h.
References process().
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
int8_t * | i | |||
) | [inline, virtual] |
Adaptor functions for signed/unsigned compatibility.
Reimplemented in oasys::SQLInsert, and oasys::SQLUpdate.
Definition at line 282 of file Serialize.h.
References process().
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
char * | bp, | |||
size_t | len | |||
) | [inline, virtual] |
Adaptor functions for signed/unsigned compatibility.
Definition at line 287 of file Serialize.h.
References process().
void oasys::SerializeAction::logpath | ( | const char * | log | ) | [inline] |
Set a log target for verbose serialization.
Definition at line 295 of file Serialize.h.
References log_.
void oasys::SerializeAction::signal_error | ( | ) | [inline, protected] |
Signal that an error has occurred.
Definition at line 312 of file Serialize.h.
References error_.
Referenced by oasys::Unmarshal::begin_action(), oasys::TextUnmarshal::get_num(), oasys::TextUnmarshal::get_textcode(), oasys::TextUnmarshal::match_fieldname(), oasys::BufferedSerializeAction::next_slice(), oasys::TextUnmarshal::process(), oasys::SQLExtract::process(), oasys::Unmarshal::process(), oasys::KeyUnmarshal::process(), oasys::KeyMarshal::process(), and oasys::KeyUnmarshal::process_int().
action_t oasys::SerializeAction::action_ [protected] |
context_t oasys::SerializeAction::context_ [protected] |
int oasys::SerializeAction::options_ [protected] |
Serialization options.
Definition at line 306 of file Serialize.h.
Referenced by oasys::MarshalSize::begin_action(), oasys::Unmarshal::begin_action(), oasys::Marshal::end_action(), oasys::TclListSerialize::process(), oasys::StringSerialize::process(), and oasys::StringSerialize::StringSerialize().
const char* oasys::SerializeAction::log_ [protected] |
Optional log for verbose marshalling.
Definition at line 307 of file Serialize.h.
Referenced by oasys::Unmarshal::begin_action(), oasys::Marshal::end_action(), logpath(), oasys::SQLExtract::process(), oasys::Unmarshal::process(), and oasys::Marshal::process().
bool oasys::SerializeAction::error_ [private] |
Indication of whether an error occurred.
Definition at line 315 of file Serialize.h.
Referenced by action(), error(), and signal_error().