Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Serializer Class Referenceabstract

#include <elm/serial2/Serializer.h>

+ Inheritance diagram for Serializer:

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~Serializer()

virtual ~Serializer ( void  )
inlinevirtual

Member Function Documentation

◆ beginCompound()

void beginCompound ( const void object)
pure virtual

This function is called to serialize a compound object, that is, an object containing a collection of values with the same type.

Parameters
objectCompound 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().

◆ beginField()

void beginField ( CString  name)
pure virtual

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.

Parameters
nameName of the field.

Implemented in XOMElementSerializer, and TextSerializer.

Referenced by elm::serial2::__serialize().

◆ beginObject()

void beginObject ( const rtti::Type clazz,
const void object 
)
pure virtual

Called to start the serialization of a new object.

Parameters
clazzObject class descriptor.
objectSerialized object.

Implemented in XOMElementSerializer, and TextSerializer.

Referenced by from_class< T >::serialize().

◆ endCompound()

void endCompound ( const void )
pure virtual

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().

◆ endField()

void endField ( void  )
pure virtual

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().

◆ endObject()

void endObject ( const rtti::Type clazz,
const void object 
)
pure virtual

Called to finish the serialization of a new object. This function call is always preceded by a call to beginObject().

Parameters
clazzObject class descriptor.
objectSerialized object.

Implemented in XOMElementSerializer, and TextSerializer.

Referenced by from_class< T >::serialize().

◆ flush()

void flush ( void  )
pure virtual

Flush to the media (disk, network) the current state of the serialization.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onEnum()

void onEnum ( const void address,
int  value,
const rtti::Type clazz 
)
pure virtual

Called when a value of type enumerate has to be serialized.

Parameters
addressAddress of the value.
valueValue to serialzie.
clazzEnumerated type.

Implemented in XOMElementSerializer, and TextSerializer.

Referenced by Enum< T >::serialize(), and from_enum< T >::serialize().

◆ onItem()

void onItem ( void  )
pure virtual

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().

◆ onPointer()

void onPointer ( const rtti::Type clazz,
const void object 
)
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.

Parameters
clazzClass of the pointed object.
objectPointed object to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

Referenced by elm::serial2::__serialize().

◆ onValue() [1/16]

void onValue ( const bool v)
pure virtual

◆ onValue() [2/16]

void onValue ( const CString v)
pure virtual

Called to serialize a value of type C string.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [3/16]

void onValue ( const double &  v)
pure virtual

Called to serialize a value of type double-precision floating point.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [4/16]

void onValue ( const float &  v)
pure virtual

Called to serialize a value of type single-precision floating point.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [5/16]

void onValue ( const long double &  v)
pure virtual

Called to serialize a value of type quadruple-precision floating point.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [6/16]

void onValue ( const signed char &  v)
pure virtual

Called to serialize a value of type signed byte.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [7/16]

void onValue ( const signed int &  v)
pure virtual

Called to serialize a value of type signed integer.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [8/16]

void onValue ( const signed long &  v)
pure virtual

Called to serialize a value of type signed long integer.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [9/16]

void onValue ( const signed long long &  v)
pure virtual

Called to serialize a value of type signed long long integer.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [10/16]

void onValue ( const signed short &  v)
pure virtual

Called to serialize a value of type signed short integer.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [11/16]

void onValue ( const String v)
pure virtual

Called to serialize a value of type ELM string.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [12/16]

void onValue ( const unsigned char &  v)
pure virtual

Called to serialize a value of type unsigned byte.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [13/16]

void onValue ( const unsigned int &  v)
pure virtual

Called to serialize a value of type unsigned integer.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [14/16]

void onValue ( const unsigned long &  v)
pure virtual

Called to serialize a value of type unsigned long integer.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [15/16]

void onValue ( const unsigned long long &  v)
pure virtual

Called to serialize a value of type unsigned long long integer.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.

◆ onValue() [16/16]

void onValue ( const unsigned short &  v)
pure virtual

Called to serialize a value of type unsigned short integer.

Parameters
vValue to serialize.

Implemented in XOMElementSerializer, and TextSerializer.


The documentation for this class was generated from the following files: