![]() |
Pixel Dust Game Engine
v0.9.5
|
A container for static methods that do the actual serialization. More...
Public Member Functions | |
virtual void | serialize_8u (uint64 val) |
Serialize an 8 byte (64 bit) value into a buffer. | |
virtual void | serialize_4u (uint32 val) |
Serialize a 4 byte (32 bit) value into a buffer. | |
virtual void | serialize_3u (uint32 val) |
Serialize a 3 byte (24 bit) value into a buffer. | |
virtual void | serialize_2u (uint16 val) |
Serialize a 2 byte (16 bit) value into a buffer. | |
virtual void | serialize_1u (uint8 val) |
Serialize an 1 byte (8 bit) value into a buffer. | |
virtual void | serialize_bool (bool val) |
Serialize a boolean (1 bit) value into a buffer. | |
virtual void | serialize_uint (uint32 num) |
Serialize an unsigned integer value into a buffer. | |
virtual void | serialize_str (const char *str) |
Serialize an string value into a buffer. | |
virtual void | serialize_mem (const void *mem, uint32 memLen) |
Serialize an arbitrary block of memory. | |
virtual void | serialize_obj (const ISerializable *obj) |
Serialize a serializable object. | |
virtual void | serialize_color (const Color &c) |
Serialize a pdg::Color. | |
virtual void | serialize_offset (const Offset &o) |
Serialize a pdg::Offset. | |
virtual void | serialize_rect (const Rect &r) |
Serialize a pdg::Rect. | |
virtual void | serialize_rotr (const RotatedRect &rr) |
Serialize a pdg::RotatedRect. | |
virtual void | serialize_quad (const Quad &q) |
Serialize a pdg::Quad. | |
virtual uint32 | sizeof_bool (bool val) const |
How many bytes are used to serialize a particular boolean value. | |
virtual uint32 | sizeof_uint (uint32 num) const |
How many bytes are used to serialize a particular unsigned integer value. | |
virtual uint32 | sizeof_str (const char *str) const |
How many bytes are used to serialize a particular string. | |
virtual uint32 | sizeof_mem (const void *mem, uint32 memLen) const |
How many bytes are used to serialize a particular block of memory. | |
virtual uint32 | sizeof_obj (const ISerializable *obj) |
How many bytes are used to serialize a particular object, including tags and size data. | |
virtual uint32 | sizeof_color (const Color &c) const |
How many bytes are used to serialize a particular pdg::Color value. | |
virtual uint32 | sizeof_offset (const Offset &o) const |
How many bytes are used to serialize a particular pdg::Offset, Point or Vector value. | |
virtual uint32 | sizeof_rect (const Rect &r) const |
How many bytes are used to serialize a particular pdg::Rect value. | |
virtual uint32 | sizeof_rotr (const RotatedRect &rr) const |
How many bytes are used to serialize a particular pdg::RotatedRect value. | |
virtual uint32 | sizeof_quad (const Quad &q) const |
How many bytes are used to serialize a particular pdg::Quad value. | |
uint8 * | getDataPtr () |
size_t | getDataSize () |
Serializer () | |
virtual | ~Serializer () |
![]() | |
void | serialize_8 (int64 val) |
void | serialize_4 (int32 val) |
void | serialize_2 (int16 val) |
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. | |
void | serialize_point (const Point &p) |
Serialize a pdg::Point. | |
void | serialize_vector (const Vector &v) |
Serialize a pdg::Vector. | |
void | serialize_string (const std::string &str) |
Serialize a string value from a std::string. | |
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 |
uint32 | sizeof_vector (const Vector &v) const |
uint32 | sizeof_point (const Point &p) const |
uint32 | sizeof_string (const std::string &str) const |
How many bytes are used to serialize a particular std::string. | |
template<typename T > | |
uint32 | sizeof_ref (const T *obj) const MAY_THROW(unknown_object) |
ISerializer & | setSendTags (bool sendThem) |
Turn on or off the sync tags for this steam. | |
Protected Member Functions | |
virtual char * | statusDump (int hiliteBytes=0) |
virtual void | startMark () |
virtual int | bytesFromMark () |
virtual void | serialize_ptr (const void *ptr) |
virtual uint32 | sizeof_ptr (const void *ptr) const |
virtual void | ensureSpace (size_t bytes) |
![]() | |
ISerializer () | |
Protected Attributes | |
uint8 * | mDataPtr |
uint8 * | mDataEnd |
uint8 * | p |
size_t | mAllocatedSize |
size_t | mBlockSize |
std::vector< const ISerializable * > | mSerializedInstances |
std::vector< const ISerializable * > | mSerializedSizeInstances |
int | mSerializeObjDepth |
uint8 * | mMark |
uint8 * | mLastBoolPtr |
int | mBoolBitOffset |
int | mBoolSizeCount |
bool | mUsingTags |
![]() | |
bool | mSendTags |
Additional Inherited Members | |
![]() | |
static int | s_TraceDepth |
static bool | s_DebugMode |
A container for static methods that do the actual serialization.
Serializer | ( | ) |
|
virtual |
|
protectedvirtual |
Implements ISerializer.
|
protectedvirtual |
|
inline |
|
inline |
|
virtual |
Serialize an 1 byte (8 bit) value into a buffer.
internal pointer gets advanced by 1 byte
val | the 8 bit value to serialize |
Implements ISerializer.
|
virtual |
Serialize a 2 byte (16 bit) value into a buffer.
internal pointer gets advanced by 2 bytes
val | the 16 bit value to serialize |
Implements ISerializer.
|
virtual |
Serialize a 3 byte (24 bit) value into a buffer.
internal pointer gets advanced by 3 bytes
val | the 24 bit value to serialize |
Implements ISerializer.
|
virtual |
Serialize a 4 byte (32 bit) value into a buffer.
internal pointer gets advanced by 4 bytes
val | the 32 bit value to serialize |
Implements ISerializer.
|
virtual |
Serialize an 8 byte (64 bit) value into a buffer.
internal pointer gets advanced by 8 bytes
val | the 64 bit value to serialize |
Implements ISerializer.
|
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
val | the 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 |
Implements ISerializer.
|
virtual |
Serialize a pdg::Color.
internal pointer gets advanced by total size of serialized color
c | the Color to serialize |
Implements ISerializer.
|
virtual |
Serialize an arbitrary block of memory.
internal pointer gets advanced by serialized size of the memory block
val | the 8 bit value to serialize |
Implements ISerializer.
|
virtual |
Serialize a serializable object.
internal pointer gets advanced by total size of serialized obj
obj | the 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 |
Implements ISerializer.
|
virtual |
Serialize a pdg::Offset.
internal pointer gets advanced by total size of serialized Offset
o | the Offset to serialize |
Implements ISerializer.
|
protectedvirtual |
Implements ISerializer.
|
virtual |
Serialize a pdg::Quad.
internal pointer gets advanced by total size of serialized quad
q | the Quad to serialize |
Implements ISerializer.
|
virtual |
Serialize a pdg::Rect.
internal pointer gets advanced by total size of serialized rect
r | the Rect to serialize |
Implements ISerializer.
|
virtual |
Serialize a pdg::RotatedRect.
internal pointer gets advanced by total size of serialized rect
r | the Rect to serialize |
Implements ISerializer.
|
virtual |
Serialize an string value into a buffer.
internal pointer gets advanced by serialized size of string
val | the 8 bit value to serialize |
Implements ISerializer.
|
virtual |
Serialize an unsigned integer value into a buffer.
internal pointer gets advanced by 1, 3 or 5 bytes, depending on the bytes needed to store the value
num | the unsigned value to serialize |
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular boolean value.
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular pdg::Color value.
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular block of memory.
Implements ISerializer.
|
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 the same order that 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
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular pdg::Offset, Point or Vector value.
Implements ISerializer.
|
protectedvirtual |
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular pdg::Quad value.
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular pdg::Rect value.
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular pdg::RotatedRect value.
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular string.
Implements ISerializer.
|
virtual |
How many bytes are used to serialize a particular unsigned integer value.
Implements ISerializer.
|
protectedvirtual |
Implements ISerializer.
|
protectedvirtual |
Implements ISerializer.
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |