SerializationContext Class Reference

#include <Pt/SerializationContext.h>

Context for the serialization of types.

Inherited by XmlSerializationContext.

Public Member Functions

 SerializationContext ()
 Default Constructor.
 
virtual ~SerializationContext ()
 Destructor.
 
void beginLoad (void *obj, const std::type_info &ti, const char *name, const char *id)
 Begin loading a type.
 
bool beginSave (const void *p, const char *name)
 Begin saving a type.
 
void clear ()
 Clears all content.
 
template<typename T >
bool compose (const SerializationInfo &si, T &type) const
 Returns true if the type could be composed with a surrogate.
 
template<typename T >
bool decompose (SerializationInfo &si, const T &type)
 Returns true if the type could be decomposed with a surrogate.
 
void enableReferencing (bool enabled)
 Enables recording of references.
 
void finishLoad ()
 Finish loading a type.
 
void finishSave ()
 Finish saving a type.
 
void fixup ()
 Fixup all prepared references to their targets.
 
SerializationInfoget ()
 Gets a SerializationInfo object from the pool.
 
const char * getId (const void *p)
 Get the ID for a reference.
 
template<typename T >
const
BasicSerializationSurrogate< T > * 
getSurrogate () const
 Find a surrogate for a type.
 
bool isReferencing () const
 Returns true if references are recorded.
 
const char * makeId (const void *p)
 Create an ID for a type, if referenced.
 
void prepareFixup (void *obj, const char *id, FixupInfo::FixupHandler fh, unsigned mid)
 Prepare a reference to fixup for an ID.
 
void prepareId (const void *p)
 Mark a type as being referenced.
 
void push (SerializationInfo *si)
 Pushes a SerializationInfo object back on the pool.
 
void rebindFixup (const char *id, void *obj, void *prev)
 Rebind reference to fixup for a ID.
 
void rebindTarget (const char *id, void *obj)
 Rebind a ID to a referenced type.
 
template<typename T >
void registerSurrogate (const std::string &typeName, void(*compose)(const Pt::SerializationInfo &si, T &type), void(*decompose)(Pt::SerializationInfo &si, const T &type))
 Register a serialization surrogate function pair.
 
template<typename T >
void registerSurrogate (const char *typeName, void(*compose)(const Pt::SerializationInfo &si, T &type), void(*decompose)(Pt::SerializationInfo &si, const T &type))
 Register a serialization surrogate function pair.
 

Protected Member Functions

virtual void onBeginLoad (void *obj, const std::type_info &fixupInfo, const char *name, const char *id)
 Begin loading a type.
 
virtual bool onBeginSave (const void *p, const char *name)
 Begin saving a type.
 
virtual void onClear ()
 Clears all content.
 
virtual void onFinishLoad ()
 Finish loading a type.
 
virtual void onFinishSave ()
 Finish saving a type.
 
virtual void onFixup ()
 Fixup all prepared references to their targets.
 
virtual const char * onGetId (const void *p)
 Get the ID for a reference.
 
virtual const char * onMakeId (const void *p)
 Create an ID for a type, if referenced.
 
virtual void onPrepareFixup (void *obj, const char *id, FixupInfo::FixupHandler fh, unsigned mid)
 Prepare a reference to fixup for an ID.
 
virtual void onPrepareId (const void *p)
 Mark a type as being referenced.
 
virtual void onRebindFixup (const char *id, void *obj, void *prev)
 Rebind reference to fixup for a ID.
 
virtual void onRebindTarget (const char *id, void *obj)
 Rebind a ID to a referenced type.