Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/serial2/Serializer.h>
Public Member Functions | |
virtual | ~Serializer (void) |
virtual void | flush (void)=0 |
virtual void | beginObject (const rtti::Type &clazz, const void *object)=0 |
virtual void | endObject (const rtti::Type &clazz, const void *object)=0 |
virtual void | beginField (CString name)=0 |
virtual void | endField (void)=0 |
virtual void | onPointer (const rtti::Type &clazz, const void *object)=0 |
virtual void | beginCompound (const void *object)=0 |
virtual void | onItem (void)=0 |
virtual void | endCompound (const void *)=0 |
virtual void | onEnum (const void *address, int value, const rtti::Type &clazz)=0 |
virtual void | onValue (const bool &v)=0 |
virtual void | onValue (const signed int &v)=0 |
virtual void | onValue (const unsigned int &v)=0 |
virtual void | onValue (const signed char &v)=0 |
virtual void | onValue (const unsigned char &v)=0 |
virtual void | onValue (const signed short &v)=0 |
virtual void | onValue (const unsigned short &v)=0 |
virtual void | onValue (const signed long &v)=0 |
virtual void | onValue (const unsigned long &v)=0 |
virtual void | onValue (const signed long long &v)=0 |
virtual void | onValue (const unsigned long long &v)=0 |
virtual void | onValue (const float &v)=0 |
virtual void | onValue (const double &v)=0 |
virtual void | onValue (const long double &v)=0 |
virtual void | onValue (const CString &v)=0 |
virtual void | onValue (const String &v)=0 |
Base class of serialization classes. The serialization is the conversion from the memory representation of a data structure to a sequential representation. This is useful to store a data structure in file or to send it over the network.
To implement a concrete serializer, one has to inherit from this class and to override the virtual functions. The serialization function will be called according the serialized value.
|
inlinevirtual |
This function is called to serialize a compound object, that is, an object containing a collection of values with the same type.
object | Compound object to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by elm::serial2::__serialize(), CollectionSerializer< Vector< T >, T >::serialize(), DataSerializer< Vector< T, M >, T >::serialize(), and CollecAC< Coll, T >::serialize().
Called to begin the serialization of a field in an object.
This call is always preceded by call to beginObject() for the object containing the field and there is no more call to this function as soon as the corresponding endObject() call is performed.
Between a call to a beginField() and of a endField(), calls to the serializer functions are performed to serialize the corresponding data.
name | Name of the field. |
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by elm::serial2::__serialize().
|
pure virtual |
Called to start the serialization of a new object.
clazz | Object class descriptor. |
object | Serialized object. |
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by from_class< T >::serialize().
This function is called at the end of a compound.
This function is only called after a call to beginCompound() and matches any call to beginCompound().
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by elm::serial2::__serialize(), CollectionSerializer< Vector< T >, T >::serialize(), DataSerializer< Vector< T, M >, T >::serialize(), and CollecAC< Coll, T >::serialize().
Called to begin the serialization of a field in an object.
This call is always preceded by call to beginField() and there is no more call to this function as soon as the corresponding endObject() call is performed.
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by elm::serial2::__serialize().
|
pure virtual |
Called to finish the serialization of a new object. This function call is always preceded by a call to beginObject().
clazz | Object class descriptor. |
object | Serialized object. |
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by from_class< T >::serialize().
Flush to the media (disk, network) the current state of the serialization.
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called when a value of type enumerate has to be serialized.
address | Address of the value. |
value | Value to serialzie. |
clazz | Enumerated type. |
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by Enum< T >::serialize(), and from_enum< T >::serialize().
For each value of a compound object, a call to this function is performed.
This function call is always preceded by a call to beginCompound() and will not call anymore after a call to endCompound().
This call is followed by calls to other serialization function in order to serialize the value itself.
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by elm::serial2::__serialize(), CollectionSerializer< Vector< T >, T >::serialize(), DataSerializer< Vector< T, M >, T >::serialize(), and CollecAC< Coll, T >::serialize().
|
pure virtual |
This function is called to serialize a pointer to an object.
A special caution must be devoted to serialize pointer because of the possibility of a circular data structures that may lead to endless looping on this function.
clazz | Class of the pointed object. |
object | Pointed object to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by elm::serial2::__serialize().
Called to serialize a value of type boolean.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
Referenced by elm::serial2::__serialize(), from_type< T >::serialize(), IntType< T >::serialize(), FloatType< T >::serialize(), BoolType::serialize(), StringType::serialize(), and CStringType::serialize().
Called to serialize a value of type C string.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type double-precision floating point.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type single-precision floating point.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type quadruple-precision floating point.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type signed byte.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type signed integer.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type signed long integer.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type signed long long integer.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type signed short integer.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
Called to serialize a value of type ELM string.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type unsigned byte.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type unsigned integer.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type unsigned long integer.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type unsigned long long integer.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.
|
pure virtual |
Called to serialize a value of type unsigned short integer.
v | Value to serialize. |
Implemented in XOMElementSerializer, and TextSerializer.