Data structures and types can be serialized to text or binary formats using Pt's serialization. This is used within the framework to load and store data or to implement remote procedure calls. It is extensible to work with all kinds of types, including STL containers, PODs (plain old data types), builtin language types or custom data types. The framework separates the process of composing and decomposing types from the formatting stage, resulting in a two-phase serialization process. This also allows to resolve and fixup shared pointers or references.
A type is serializable, if two operators are implemented to compose and decompose it to a SerializationInfo. The SerializationContext provides improved memory management, a mechanism to generate IDs for shared pointers and a way to further customize or override serialization for a type. Alternatively, performance can be increased by implementing a Composer or Decomposer for the type, however it is more complicated to do so.
Various formats are supported by implementing Formatters. Other modules of the framework also implement Formatters, for example to support serialization to XML. The Serializer and Deserializer combine a Formatter and a SerializationContext, manage composition and decomposition and thus form the high-level interface for the serialization of a set of types.
Classes | |
class | BasicComposer< T > |
Manages the composition of types during serialization. More... | |
class | BasicDecomposer< T > |
Manages the decomposition of types during serialization. More... | |
class | Composer |
Composes types during serialization. More... | |
class | Decomposer |
Manages the decomposition of types during serialization. More... | |
class | Deserializer |
Deserializes a set of types. More... | |
class | FixupInfo |
Fixup of references during serialization. More... | |
class | Formatter |
Support for serialization to different formats. More... | |
class | LoadInfo |
Loads referencable types. More... | |
class | SaveInfo |
Saves referencable types. More... | |
class | SerializationContext |
Context for the serialization of types. More... | |
class | SerializationError |
Error during serialization of a type. More... | |
class | SerializationInfo |
Represents arbitrary types during serialization. More... | |
class | Serializer |
Serializes a set of types. More... | |
Functions | |
template<typename T > | |
void | fixup (const FixupInfo &fixup, T *&fixme) |
Fixup references during serialization. | |
template<typename T > | |
void | fixup (const FixupInfo &fixup, T &fixme) |
Fixup references during serialization. | |
template<typename T > | |
void | load (const LoadInfo &li, T &type) |
Loads referencable types. | |
template<typename T > | |
void | save (SaveInfo &si, const T &type) |
Saves referencable types. | |