Pixel Dust Game Engine  v0.9.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | List of all members
ISerializable Class Referenceabstract

Represents an object which can be serialized. More...

Inheritance diagram for ISerializable:
Inheritance graph
[legend]
Collaboration diagram for ISerializable:
Collaboration graph
[legend]

Public Member Functions

virtual uint32 getSerializedSize (ISerializer *serializer) const =0
 Get number of bytes needed to hold serialized state.
 
virtual void serialize (ISerializer *serializer) const =0
 Write self out to a serializer.
 
virtual void deserialize (IDeserializer *deserializer)=0
 Read self from a deserializer.
 
virtual uint32 getMyClassTag () const =0
 Get a tag value that uniquely represents this class.
 
 ISerializable ()
 
virtual ~ISerializable ()
 
- Public Member Functions inherited from RefCountedObj
virtual void addRef () const throw ()
 
virtual void release () const throw ()
 

Detailed Description

Represents an object which can be serialized.

Subclasses must implement all the methods derive from the serializable template like this:

#define CLASS_TAG_MY_SERIALIZABLECLASS 500

class MySerializableClass : public Serializable<MySerializableClass> { SERIALIZABLE_TAG( CLASS_TAG_MYSERIALIZABLECLASS ) ... };

If your class derives indirectly from Serializable, then you will need to also add SERIALIZABLE_CREATOR() like this:

class MyDerivedSerializableClass : public MySerializableClass { SERIALIZABLE_TAG( CLASS_TAG_MYDERIVEDCLASS ) ... SERIALIZABLE_CREATOR( MyDerivedSerializableClass ) };

Constructor & Destructor Documentation

ISerializable ( )
inline
virtual ~ISerializable ( )
inlinevirtual

Member Function Documentation

virtual void deserialize ( IDeserializer deserializer)
pure virtual

Read self from a deserializer.

Parameters
bufferpointer to a deserializer
See Also
serialize() and getSerializedSize();

Implemented in ISpriteDrawHelper, ISpriteCollideHelper, and IAnimationHelper.

virtual uint32 getMyClassTag ( ) const
pure virtual

Get a tag value that uniquely represents this class.

This value is used to determine which class factory to call to instantiate an object during deserialization, so this value cannot change during the lifetime of the serialized stream Use SERIALIZABLE_TAG() to declare this in your classes

virtual uint32 getSerializedSize ( ISerializer serializer) const
pure virtual

Get number of bytes needed to hold serialized state.

Returns
required number of bytes, or zero if error

Implemented in ISpriteDrawHelper, ISpriteCollideHelper, and IAnimationHelper.

virtual void serialize ( ISerializer serializer) const
pure virtual

Write self out to a serializer.

Parameters
serializerpointer to a serializer
See Also
deserialize() and getSerializedSize()

Implemented in ISpriteDrawHelper, ISpriteCollideHelper, and IAnimationHelper.