Public Member Functions | Static Public Member Functions

Celartem::SerializableData< T > Class Template Reference

#include <cel_serializable.h>

Inheritance diagram for Celartem::SerializableData< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void serialize (Stream *inStream, size_t inLevel, Endian inEndian)
virtual AutoPtr< Serializableduplicate () const
T & getValue ()
const T & getValue () const

Static Public Member Functions

static Serializablecreate (const T &t)
static AutoPtr< Serializabledeserialize (Stream *inStream, size_t inLevel, Endian inEndian)

Detailed Description

template<class T>
class Celartem::SerializableData< T >

This class template is to add serialize/deserialize feature to existing non-serializable classes.
With this class, all you have to do is to implement following two methods:

            void serialize(Stream *inStream, size_t inLevel) const;
            void deserialize(Stream *inStream, size_t inLevel);

They should be normal methods; NOT virtual methods.


Member Function Documentation

template<class T>
static Serializable* Celartem::SerializableData< T >::create ( const T &  t  )  [inline, static]

This method is a factory for the Serializable instance from the specified instance of T .

Parameters:
t The instance to store.
template<class T>
static AutoPtr<Serializable> Celartem::SerializableData< T >::deserialize ( Stream inStream,
size_t  inLevel,
Endian  inEndian 
) [inline, static]

This method only calles the deserialize method of T.

Parameters:
inStream The stream from which the instance information is read.
inLevel The de-serialization level. In the top level, this value is 0.
inEndian The endianness used to read the data.
Returns:
Pointer to the newly created Serializable instance.
template<class T>
virtual AutoPtr<Serializable> Celartem::SerializableData< T >::duplicate (  )  const [inline, virtual]

To deal with duplicate method, the data type used with SerializableData template should be shared without any risk.

Returns:
Pointer to the newly created Serializable instance.

Implements Celartem::Serializable.

template<class T>
const T& Celartem::SerializableData< T >::getValue (  )  const [inline]

This method returns a const reference to the T instance.

template<class T>
T& Celartem::SerializableData< T >::getValue (  )  [inline]

This method returns a reference to the T instance.

template<class T>
virtual void Celartem::SerializableData< T >::serialize ( Stream inStream,
size_t  inLevel,
Endian  inEndian 
) [inline, virtual]

This method only calls the serialize method of T .

Parameters:
inStream The stream to which the instance information is written.
inLevel The serialization level. In the top level, this value is 0.
inEndian The endianness used to write the data.

Implements Celartem::Serializable.


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

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:18.
Caminova Logo