#include <CkptDAO.h>
Public Member Functions | |
DAOInterface (CommonDAO *daoImpl) | |
virtual | ~DAOInterface () |
virtual DAOMode | getMode () |
template<class RawObj> | |
DAOInterface & | byteCopy (RawObj *obj, unsigned int dataSize) |
Performs a raw byte copy. | |
DAOInterface & | operator & (DAOSerializable &t) |
Primary method used for object serialization. | |
byte_array * | getOutputData () |
template<class ExtClass> | |
void | invokeExternalSerializer (ExtClass &extObj, void(*eS)(DAOInterface &, ExtClass &)) |
Invokes the serialization code for a class that doesn't implement DAOSerializable. | |
template<class Serializable> | |
DAOInterface & | operator & (Serializable *&t) |
Process a pointer reference. | |
Private Attributes | |
CommonDAO * | impl |
The delegator of the DAO layer. Responsible for invoking serialize methods for objects in the serialization path until basic primitives or byte copies are reached. Invokes the processPrim routines in the DAO that it represents to perform the actual I/O.
Created via a DAOInterfaceFactory
Definition at line 97 of file CkptDAO.h.
DAOInterface::DAOInterface | ( | CommonDAO * | daoImpl | ) | [inline] |
virtual DAOMode DAOInterface::getMode | ( | ) | [inline, virtual] |
DAOInterface& DAOInterface::byteCopy | ( | RawObj * | obj, | |
unsigned int | dataSize | |||
) | [inline] |
Performs a raw byte copy.
WARNING: This does not allocate the storage space for the object during deserialization. The RawObj pointer must point to valid memory of the appropriate size.
Handles a raw byte copy with the DAO for structs/objects that do not implement DAOSerializable and are have no associated serialization function that could be passed to invokeExternalSerializer().
Use of this function is strongly discouraged. invokeExternalSerializer() is the recommended method for serializing structures that do not participate in the DAOSerializable hierarchy.
DAOInterface& DAOInterface::operator & | ( | DAOSerializable & | t | ) | [inline] |
Primary method used for object serialization.
This is the operator invoked by the DAOSerializable object from its DAOSerializable::serialize() method when it's parsing an embedded serializable object. Eg. Class A and B implement DAOSerializable. Class A contains an instance (b) of class B. A::serialize(DAOInterface &dao) invokes this routine via:
dao & b
Definition at line 154 of file CkptDAO.h.
References DAOSerializable::serialize().
byte_array* DAOInterface::getOutputData | ( | ) | [inline] |
Definition at line 159 of file CkptDAO.h.
References DAO_OUTPUT, and CommonDAO::getMode().
Referenced by CkptContainer::commit(), and CkptContainer::persist().
void DAOInterface::invokeExternalSerializer | ( | ExtClass & | extObj, | |
void(*)(DAOInterface &, ExtClass &) | eS | |||
) | [inline] |
Invokes the serialization code for a class that doesn't implement DAOSerializable.
Permits the serialization of objects and structures that can't participate in the DAOSerializable heirarchy (a structure in a library for example). This can be bypassed by wrappering the struct, but this is a lighterweight mechanism.
Routes a serialization path through a user defined function rather than the serialize method of a class. The function should be defined with the prototype: void functionName(DAOInterface &, <ExternalObjectType> & ) where <ExternalObjectType> is the type of the class to be serialized. eg. struct Alpha { int x; } void alphaSerializer(DAOInterface &dao, Alpha &a) { dao & a.x; } In some other code, where an Alpha needs to be serialized: Alpha a; a.x = 42; dao.invokeExternalSerializer(alpha, alphaSerializer);
extObj | - object to be serialized by the DAO | |
eS | - serialization routine external to the class of extObj |
DAOInterface& DAOInterface::operator & | ( | Serializable *& | t | ) | [inline] |
Process a pointer reference.
We can only process pointers to objects that implement the DAOSerializable interface, have a default constructor and have registered via the TypeRegistry.
Definition at line 198 of file CkptDAO.h.
References DAOSerializable::serialize().
CommonDAO* DAOInterface::impl [private] |