Pixel Dust Game Engine  v0.9.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ISerializer Class Referenceabstract
Inheritance diagram for ISerializer:
Inheritance graph
[legend]

Public Member Functions

virtual void serialize_8u (uint64 val)=0
 Serialize an 8 byte (64 bit) value into a buffer.
 
void serialize_8 (int64 val)
 
virtual void serialize_4u (uint32 val)=0
 Serialize a 4 byte (32 bit) value into a buffer.
 
void serialize_4 (int32 val)
 
virtual void serialize_3u (uint32 val)=0
 Serialize a 3 byte (24 bit) value into a buffer.
 
virtual void serialize_2u (uint16 val)=0
 Serialize a 2 byte (16 bit) value into a buffer.
 
void serialize_2 (int16 val)
 
virtual void serialize_1u (uint8 val)=0
 Serialize an 1 byte (8 bit) value into a buffer.
 
void serialize_1 (int8 val)
 
void serialize_f (float val)
 Serialize a floating point value into a buffer.
 
void serialize_d (double val)
 Serialize a double precision floating point value into a buffer.
 
virtual void serialize_bool (bool val)=0
 Serialize a boolean (1 bit) value into a buffer.
 
virtual void serialize_uint (uint32 num)=0
 Serialize an unsigned integer value into a buffer.
 
virtual void serialize_color (const Color &c)=0
 Serialize a pdg::Color.
 
virtual void serialize_offset (const Offset &o)=0
 Serialize a pdg::Offset.
 
void serialize_point (const Point &p)
 Serialize a pdg::Point.
 
void serialize_vector (const Vector &v)
 Serialize a pdg::Vector.
 
virtual void serialize_rect (const Rect &r)=0
 Serialize a pdg::Rect.
 
virtual void serialize_rotr (const RotatedRect &rr)=0
 Serialize a pdg::RotatedRect.
 
virtual void serialize_quad (const Quad &q)=0
 Serialize a pdg::Quad.
 
virtual void serialize_str (const char *str)=0
 Serialize an string value into a buffer.
 
void serialize_string (const std::string &str)
 Serialize a string value from a std::string.
 
virtual void serialize_mem (const void *mem, uint32 memLen)=0
 Serialize an arbitrary block of memory.
 
virtual void serialize_obj (const ISerializable *obj)=0
 Serialize a serializable object.
 
template<typename T >
void serialize_ref (const T *obj) MAY_THROW(unknown_object)
 Serialize a reference to a non-serializable object.
 
uint32 sizeof_8u (uint64 val) const
 
uint32 sizeof_8 (int64 val) const
 
uint32 sizeof_4u (uint32 val) const
 
uint32 sizeof_4 (int32 val) const
 
uint32 sizeof_3u (uint32 val) const
 
uint32 sizeof_2u (uint16 val) const
 
uint32 sizeof_2 (int16 val) const
 
uint32 sizeof_1u (uint8 val) const
 
uint32 sizeof_1 (int8 val) const
 
virtual uint32 sizeof_bool (bool val) const =0
 How many bytes are used to serialize a particular boolean value.
 
virtual uint32 sizeof_uint (uint32 num) const =0
 How many bytes are used to serialize a particular unsigned integer value.
 
virtual uint32 sizeof_color (const Color &c) const =0
 How many bytes are used to serialize a particular pdg::Color value.
 
virtual uint32 sizeof_offset (const Offset &o) const =0
 How many bytes are used to serialize a particular pdg::Offset, Point or Vector value.
 
uint32 sizeof_vector (const Vector &v) const
 
uint32 sizeof_point (const Point &p) const
 
virtual uint32 sizeof_rect (const Rect &r) const =0
 How many bytes are used to serialize a particular pdg::Rect value.
 
virtual uint32 sizeof_rotr (const RotatedRect &rr) const =0
 How many bytes are used to serialize a particular pdg::RotatedRect value.
 
virtual uint32 sizeof_quad (const Quad &q) const =0
 How many bytes are used to serialize a particular pdg::Quad value.
 
virtual uint32 sizeof_str (const char *str) const =0
 How many bytes are used to serialize a particular string.
 
uint32 sizeof_string (const std::string &str) const
 How many bytes are used to serialize a particular std::string.
 
virtual uint32 sizeof_mem (const void *mem, uint32 memLen) const =0
 How many bytes are used to serialize a particular block of memory.
 
virtual uint32 sizeof_obj (const ISerializable *obj)=0
 How many bytes are used to serialize a particular object, including tags and size data.
 
template<typename T >
uint32 sizeof_ref (const T *obj) const MAY_THROW(unknown_object)
 
ISerializersetSendTags (bool sendThem)
 Turn on or off the sync tags for this steam.
 

Static Public Attributes

static int s_TraceDepth
 
static bool s_DebugMode
 

Protected Member Functions

virtual char * statusDump (int hiliteBytes=0)=0
 
virtual void startMark ()=0
 
virtual int bytesFromMark ()=0
 
virtual void serialize_ptr (const void *ptr)=0
 
virtual uint32 sizeof_ptr (const void *ptr) const =0
 
 ISerializer ()
 

Protected Attributes

bool mSendTags
 

Detailed Description

An interface to represent serialization capabilities

Constructor & Destructor Documentation

ISerializer ( )
inlineprotected

Member Function Documentation

virtual int bytesFromMark ( )
protectedpure virtual

Implemented in Serializer.

void serialize_1 ( int8  val)
inline
virtual void serialize_1u ( uint8  val)
pure virtual

Serialize an 1 byte (8 bit) value into a buffer.

internal pointer gets advanced by 1 byte

Parameters
valthe 8 bit value to serialize

Implemented in Serializer.

void serialize_2 ( int16  val)
inline
virtual void serialize_2u ( uint16  val)
pure virtual

Serialize a 2 byte (16 bit) value into a buffer.

internal pointer gets advanced by 2 bytes

Parameters
valthe 16 bit value to serialize

Implemented in Serializer.

virtual void serialize_3u ( uint32  val)
pure virtual

Serialize a 3 byte (24 bit) value into a buffer.

internal pointer gets advanced by 3 bytes

Parameters
valthe 24 bit value to serialize

Implemented in Serializer.

void serialize_4 ( int32  val)
inline
virtual void serialize_4u ( uint32  val)
pure virtual

Serialize a 4 byte (32 bit) value into a buffer.

internal pointer gets advanced by 4 bytes

Parameters
valthe 32 bit value to serialize

Implemented in Serializer.

void serialize_8 ( int64  val)
inline
virtual void serialize_8u ( uint64  val)
pure virtual

Serialize an 8 byte (64 bit) value into a buffer.

internal pointer gets advanced by 8 bytes

Parameters
valthe 64 bit value to serialize

Implemented in Serializer.

virtual void serialize_bool ( bool  val)
pure virtual

Serialize a boolean (1 bit) value into a buffer.

internal pointer gets advanced by 1 or 0 bytes, depending on the bytes needed to store the value

Parameters
valthe boolean to serialize This is optimized for series of boolean values, so that between 1 and 8 bools serialized sequentially only use a single byte

Implemented in Serializer.

virtual void serialize_color ( const Color c)
pure virtual

Serialize a pdg::Color.

internal pointer gets advanced by total size of serialized color

Parameters
cthe Color to serialize

Implemented in Serializer.

void serialize_d ( double  val)
inline

Serialize a double precision floating point value into a buffer.

internal pointer gets advanced by 8 bytes

Parameters
valthe floating point value to serialize
void serialize_f ( float  val)
inline

Serialize a floating point value into a buffer.

internal pointer gets advanced by 4 bytes

Parameters
valthe floating point value to serialize
virtual void serialize_mem ( const void *  mem,
uint32  memLen 
)
pure virtual

Serialize an arbitrary block of memory.

internal pointer gets advanced by serialized size of the memory block

Parameters
valthe 8 bit value to serialize

Implemented in Serializer.

virtual void serialize_obj ( const ISerializable obj)
pure virtual

Serialize a serializable object.

internal pointer gets advanced by total size of serialized obj

Parameters
objthe object to serialize This works by writing the object's unique tag, then serializing the size of the object via obj->getSerializedSize() and then finally calling obj->serialize() to actually serialize the object's data

Implemented in Serializer.

virtual void serialize_offset ( const Offset o)
pure virtual

Serialize a pdg::Offset.

internal pointer gets advanced by total size of serialized Offset

Parameters
othe Offset to serialize

Implemented in Serializer.

void serialize_point ( const Point p)
inline

Serialize a pdg::Point.

internal pointer gets advanced by total size of serialized Point

Parameters
pthe Point to serialize
virtual void serialize_ptr ( const void *  ptr)
protectedpure virtual

Implemented in Serializer.

virtual void serialize_quad ( const Quad q)
pure virtual

Serialize a pdg::Quad.

internal pointer gets advanced by total size of serialized quad

Parameters
qthe Quad to serialize

Implemented in Serializer.

virtual void serialize_rect ( const Rect r)
pure virtual

Serialize a pdg::Rect.

internal pointer gets advanced by total size of serialized rect

Parameters
rthe Rect to serialize

Implemented in Serializer.

void serialize_ref ( const T *  obj)

Serialize a reference to a non-serializable object.

virtual void serialize_rotr ( const RotatedRect rr)
pure virtual

Serialize a pdg::RotatedRect.

internal pointer gets advanced by total size of serialized rect

Parameters
rthe Rect to serialize

Implemented in Serializer.

virtual void serialize_str ( const char *  str)
pure virtual

Serialize an string value into a buffer.

internal pointer gets advanced by serialized size of string

Parameters
valthe 8 bit value to serialize

Implemented in Serializer.

void serialize_string ( const std::string &  str)
inline

Serialize a string value from a std::string.

internal pointer gets advanced by serialized size of string

Parameters
str,astd::string to be serialized
virtual void serialize_uint ( uint32  num)
pure virtual

Serialize an unsigned integer value into a buffer.

internal pointer gets advanced by 1, 3, 5 bytes, depending on the bytes needed to store the value

Parameters
numthe unsigned value to serialize

Implemented in Serializer.

void serialize_vector ( const Vector v)
inline

Serialize a pdg::Vector.

internal pointer gets advanced by total size of serialized Vector

Parameters
pthe Vector to serialize
ISerializer& setSendTags ( bool  sendThem)
inline

Turn on or off the sync tags for this steam.

uint32 sizeof_1 ( int8  val) const
inline
uint32 sizeof_1u ( uint8  val) const
inline
uint32 sizeof_2 ( int16  val) const
inline
uint32 sizeof_2u ( uint16  val) const
inline
uint32 sizeof_3u ( uint32  val) const
inline
uint32 sizeof_4 ( int32  val) const
inline
uint32 sizeof_4u ( uint32  val) const
inline
uint32 sizeof_8 ( int64  val) const
inline
uint32 sizeof_8u ( uint64  val) const
inline
virtual uint32 sizeof_bool ( bool  val) const
pure virtual

How many bytes are used to serialize a particular boolean value.

Implemented in Serializer.

virtual uint32 sizeof_color ( const Color c) const
pure virtual

How many bytes are used to serialize a particular pdg::Color value.

Implemented in Serializer.

virtual uint32 sizeof_mem ( const void *  mem,
uint32  memLen 
) const
pure virtual

How many bytes are used to serialize a particular block of memory.

Implemented in Serializer.

virtual uint32 sizeof_obj ( const ISerializable obj)
pure virtual

How many bytes are used to serialize a particular object, including tags and size data.

Since objects are only serialized once, it is critical that you call this on objects in the same order you actually serialize those object. The first call for a particular object will return the number of bytes for the serialized object stream plus tag overhead. Successive calls will return the number of bytes used to store a reference to the object, usually a much smaller number. A NULL object pointer will always take a constant number of bytes needed for the null object tag

Implemented in Serializer.

virtual uint32 sizeof_offset ( const Offset o) const
pure virtual

How many bytes are used to serialize a particular pdg::Offset, Point or Vector value.

Implemented in Serializer.

uint32 sizeof_point ( const Point p) const
inline
virtual uint32 sizeof_ptr ( const void *  ptr) const
protectedpure virtual

Implemented in Serializer.

virtual uint32 sizeof_quad ( const Quad q) const
pure virtual

How many bytes are used to serialize a particular pdg::Quad value.

Implemented in Serializer.

virtual uint32 sizeof_rect ( const Rect r) const
pure virtual

How many bytes are used to serialize a particular pdg::Rect value.

Implemented in Serializer.

uint32 sizeof_ref ( const T *  obj) const
virtual uint32 sizeof_rotr ( const RotatedRect rr) const
pure virtual

How many bytes are used to serialize a particular pdg::RotatedRect value.

Implemented in Serializer.

virtual uint32 sizeof_str ( const char *  str) const
pure virtual

How many bytes are used to serialize a particular string.

Implemented in Serializer.

uint32 sizeof_string ( const std::string &  str) const
inline

How many bytes are used to serialize a particular std::string.

virtual uint32 sizeof_uint ( uint32  num) const
pure virtual

How many bytes are used to serialize a particular unsigned integer value.

Implemented in Serializer.

uint32 sizeof_vector ( const Vector v) const
inline
virtual void startMark ( )
protectedpure virtual

Implemented in Serializer.

virtual char* statusDump ( int  hiliteBytes = 0)
protectedpure virtual

Implemented in Serializer.

Member Data Documentation

bool mSendTags
protected
bool s_DebugMode
static
int s_TraceDepth
static