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 enableReferencing (bool enabled)
 Enables recording of references.
 
bool isReferencing () const
 Returns true if references are recorded.
 
SerializationInfoget ()
 Gets a SerializationInfo object from the pool.
 
void push (SerializationInfo *si)
 Pushes a SerializationInfo object back on the pool.
 
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.
 
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.
 
template<typename T >
const BasicSerializationSurrogate< T > * getSurrogate () const
 Find a surrogate for a type.
 
void clear ()
 Clears all content.
 
bool beginSave (const void *p, const char *name)
 Begin saving a type.
 
void finishSave ()
 Finish saving a type.
 
void prepareId (const void *p)
 Mark a type as being referenced.
 
const char * getId (const void *p)
 Get the ID for a reference.
 
const char * makeId (const void *p)
 Create an ID for a type, if referenced.
 
void beginLoad (void *obj, const std::type_info &ti, const char *name, const char *id)
 Begin loading a type.
 
void finishLoad ()
 Finish loading a type.
 
void rebindTarget (const char *id, void *obj)
 Rebind a ID to a referenced type.
 
void rebindFixup (const char *id, void *obj, void *prev)
 Rebind reference to fixup for a ID.
 
void prepareFixup (void *obj, const char *id, FixupInfo::FixupHandler fh, unsigned mid)
 Prepare a reference to fixup for an ID.
 
void fixup ()
 Fixup all prepared references to their targets.
 

Protected Member Functions

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