Public Member Functions | Static Public Member Functions | List of all members
Celartem::SerializableData< T > Class Template Reference

#include <cel_serializable.h>

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

Public Member Functions

virtual void serialize (Stream *inStream, size_t inLevel, Endian inEndian)
 
virtual AutoPtr< Serializableduplicate () const
 
T & getValue ()
 
const T & getValue () const
 
- Public Member Functions inherited from Celartem::Serializable
const GuidgetClassId () const
 
String getClassName () const
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 

Static Public Member Functions

static Serializablecreate (const T &t)
 
static AutoPtr< Serializabledeserialize (Stream *inStream, size_t inLevel, Endian inEndian)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

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)
inlinestatic

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

Parameters
tThe instance to store.
template<class T >
static AutoPtr<Serializable> Celartem::SerializableData< T >::deserialize ( Stream inStream,
size_t  inLevel,
Endian  inEndian 
)
inlinestatic

This method only calles the deserialize method of T.

Parameters
inStreamThe stream from which the instance information is read.
inLevelThe de-serialization level. In the top level, this value is 0.
inEndianThe 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
inlinevirtual

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 >
T& Celartem::SerializableData< T >::getValue ( )
inline

This method returns a reference to the T instance.

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

This method returns a const reference to the T instance.

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

This method only calls the serialize method of T .

Parameters
inStreamThe stream to which the instance information is written.
inLevelThe serialization level. In the top level, this value is 0.
inEndianThe endianness used to write the data.

Implements Celartem::Serializable.


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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo