A SerializationProxy is an object that knows how to serialize and deserialize objects of a particular type. This is an abstract class. Subclasses implement the logic for serializing particular types of logic.
A global registry maintains the list of what SerializationProxy to use for each type of object. Call registerProxy() to register the proxy for a particular type. This is typically done at application startup or by a dynamic library’s initialization code.
SerializationProxy(const std::string &typeName)¶
Create a new SerializationProxy.
typeName – the name of the object type this proxy knows how to serialize. This name is stored in the output stream during serialization, and is used to select a proxy during deserialization. This typically is the class name, although that is not a requirement.
const std::string &getTypeName() const¶
Get the name of the object type this proxy manipulates, as passed to the constructor.
virtual void serialize(const void *object, SerializationNode &node) const = 0¶
Subclasses implement this method to record information about an object being serialized.
object – a pointer to the object being serialized
node – all data to be serialized should be stored into this node, either directly as properties or indirectly by adding child nodes to it
Public Static Functions
static void registerProxy(const std::type_info &type, const SerializationProxy *proxy)¶
Register a SerializationProxy to be used for objects of a particular type.
type – the type_info for the object type
proxy – the proxy to use for objects of the specified type
static const SerializationProxy &getProxy(const std::string &typeName)¶
Get the SerializationProxy to use for objects of a particular type, specified by name.
typeName – the name of the object type to get a proxy for
- SerializationProxy(const std::string &typeName)¶