#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 128 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) |
Perform the serialization or deserialization action on the object. | |
virtual void | begin_action () |
Control the initialization done before executing an action. | |
virtual void | end_action () |
Control the cleanup after executing an action. | |
void | reset_error () |
Reset error flag to false. | |
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_int64_t *i)=0 |
Process function for an 8 byte integer. | |
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, u_int32_t len)=0 |
Process function for a constant length char buffer. | |
virtual void | process (const char *name, u_char **bp, u_int32_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, int64_t *i) |
Adaptor functions for signed/unsigned compatibility. | |
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, u_int32_t len) |
Adaptor functions for signed/unsigned compatibility. | |
virtual void | process (const char *name, char **bp, u_int32_t *lenp, int flags) |
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 23 of file Serialize.cc.
oasys::SerializeAction::~SerializeAction | ( | ) | [virtual] |
oasys::SerializeAction::SerializeAction | ( | ) | [private] |
int oasys::SerializeAction::action | ( | SerializableObject * | object | ) | [virtual] |
Perform the serialization or deserialization action on the object.
Definition at line 41 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] |
Control the initialization done before executing an action.
Reimplemented in oasys::Unmarshal, oasys::MarshalSize, oasys::SQLInsert, oasys::SQLUpdate, and oasys::SQLTableFormat.
Definition at line 58 of file Serialize.cc.
Referenced by action().
void oasys::SerializeAction::end_action | ( | ) | [virtual] |
Control the cleanup after executing an action.
Reimplemented in oasys::KeyMarshal, oasys::Marshal, oasys::SQLInsert, oasys::SQLUpdate, oasys::SQLTableFormat, oasys::StringSerialize, and oasys::XMLMarshal.
Definition at line 64 of file Serialize.cc.
Referenced by action().
void oasys::SerializeAction::reset_error | ( | ) | [inline] |
Reset error flag to false.
Enables serializer reuse.
Definition at line 160 of file Serialize.h.
References error_.
action_t oasys::SerializeAction::action_code | ( | ) | [inline] |
Accessor for the action type.
Definition at line 165 of file Serialize.h.
References action_.
Referenced by oasys::ByteBufShim::serialize(), dtn::Registration::serialize(), dtn::Link::serialize(), dtn::EndpointID::serialize(), dtn::LinkStateChangeRequest::serialize(), dtn::Bundle::serialize(), and dtn::BlockInfo::serialize().
context_t oasys::SerializeAction::context | ( | ) | [inline] |
bool oasys::SerializeAction::error | ( | ) | [inline] |
Accessor for error.
Definition at line 175 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(), oasys::KeyMarshal::process_int64(), 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, oasys::TextUnmarshal, and oasys::XMLMarshal.
Definition at line 191 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::TCPConvergenceLayer::Connection::serialize(), dtn::RouteEntry::serialize(), dtn::Registration::serialize(), oasys::MD5Hash_t::serialize(), dtn::Link::serialize(), dtn::Globals::serialize(), dtn::ForwardingInfo::serialize(), dtn::EndpointID::serialize(), dtn::Contact::serialize(), dtn::BundlePayload::serialize(), dtn::CustodyTimeoutEvent::serialize(), dtn::CustodySignalEvent::serialize(), dtn::RouteDelEvent::serialize(), dtn::RouteAddEvent::serialize(), dtn::RegistrationExpiredEvent::serialize(), dtn::RegistrationRemovedEvent::serialize(), dtn::RegistrationAddedEvent::serialize(), dtn::LinkStateChangeRequest::serialize(), dtn::LinkReportEvent::serialize(), dtn::LinkUnavailableEvent::serialize(), dtn::LinkAvailableEvent::serialize(), dtn::LinkDeletedEvent::serialize(), dtn::LinkCreatedEvent::serialize(), dtn::ContactReportEvent::serialize(), dtn::ContactDownEvent::serialize(), dtn::ContactUpEvent::serialize(), dtn::BundleReportEvent::serialize(), dtn::BundleAcceptRequest::serialize(), dtn::BundleInjectRequest::serialize(), dtn::BundleCancelRequest::serialize(), dtn::BundleSendRequest::serialize(), dtn::BundleExpiredEvent::serialize(), dtn::BundleDeliveryEvent::serialize(), dtn::BundleTransmitFailedEvent::serialize(), dtn::BundleTransmittedEvent::serialize(), dtn::BundleReceivedEvent::serialize(), dtn::Bundle::serialize(), dtn::BluetoothConvergenceLayer::BluetoothLinkParams::serialize(), dtn::BlockInfo::serialize(), and oasys::serialize_basic_vector().
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
u_int64_t * | i | |||
) | [pure virtual] |
Process function for an 8 byte integer.
Implemented in oasys::KeyMarshal, oasys::KeyUnmarshal, oasys::Marshal, oasys::Unmarshal, oasys::MarshalSize, oasys::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, oasys::TextUnmarshal, and oasys::XMLMarshal.
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, oasys::TextUnmarshal, and oasys::XMLMarshal.
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, oasys::TextUnmarshal, and oasys::XMLMarshal.
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, oasys::TextUnmarshal, and oasys::XMLMarshal.
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, oasys::TextUnmarshal, and oasys::XMLMarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
u_char * | bp, | |||
u_int32_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::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, oasys::TextUnmarshal, and oasys::XMLMarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
u_char ** | bp, | |||
u_int32_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::StringSerialize, oasys::TclListSerialize, oasys::TextMarshal, oasys::TextUnmarshal, and oasys::XMLMarshal.
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, oasys::TextUnmarshal, and oasys::XMLMarshal.
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
int64_t * | i | |||
) | [inline, virtual] |
Adaptor functions for signed/unsigned compatibility.
Definition at line 255 of file Serialize.h.
References process().
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 260 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 265 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 270 of file Serialize.h.
References process().
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
char * | bp, | |||
u_int32_t | len | |||
) | [inline, virtual] |
Adaptor functions for signed/unsigned compatibility.
Definition at line 275 of file Serialize.h.
References process().
virtual void oasys::SerializeAction::process | ( | const char * | name, | |
char ** | bp, | |||
u_int32_t * | lenp, | |||
int | flags | |||
) | [inline, virtual] |
Adaptor functions for signed/unsigned compatibility.
Definition at line 280 of file Serialize.h.
References process().
void oasys::SerializeAction::logpath | ( | const char * | log | ) | [inline] |
Set a log target for verbose serialization.
Definition at line 290 of file Serialize.h.
References log_.
void oasys::SerializeAction::signal_error | ( | ) | [inline, protected] |
Signal that an error has occurred.
Definition at line 307 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::XMLMarshal::process(), oasys::TextUnmarshal::process(), oasys::SQLExtract::process(), oasys::Unmarshal::process(), oasys::KeyUnmarshal::process(), oasys::KeyMarshal::process(), oasys::KeyUnmarshal::process_int(), and oasys::KeyUnmarshal::process_int64().
action_t oasys::SerializeAction::action_ [protected] |
context_t oasys::SerializeAction::context_ [protected] |
int oasys::SerializeAction::options_ [protected] |
Serialization options.
Definition at line 301 of file Serialize.h.
Referenced by oasys::StringSerialize::add_preamble(), 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 302 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 310 of file Serialize.h.
Referenced by action(), error(), reset_error(), and signal_error().