C4 Engine
C4 Engine API Documentation

class Decompressor

Defined in:  C4Messages.h
Decompresses data for a message.
Definition

class Decompressor

Member Functions
Decompressor::GetDataSize Returns the total size of the compressed data.
Decompressor::ReadData Reads arbitrary data from the internal buffer.
Constructor

Decompressor(char *ptr);

Decompressor objects should be constructed only by the Message Manager.
Description
A Decompressor object is passed to the Message::DecompressMessage function after the Message Manager receives a message. The message object should use the >> operator or the Decompressor::ReadData function to read its data from the Decompressor object's internal buffer. Data read by the >> operator is always converted from big endian order to the native endian of the local machine so that messages can be sent between machines having different native endians.
Overloaded Operators
Decompressor& operator >>(char& x); Reads a single 8-bit character from the internal buffer.
Decompressor& operator >>(int8& x); Reads a single 8-bit byte from the internal buffer.
Decompressor& operator >>(uint8& x); Reads a single 8-bit unsigned byte from the internal buffer.
Decompressor& operator >>(int16& x); Reads a single 16-bit integer from the internal buffer.
Decompressor& operator >>(uint16& x); Reads a single 16-bit unsigned integer from the internal buffer.
Decompressor& operator >>(int32& x); Reads a single 32-bit integer from the internal buffer.
Decompressor& operator >>(uint32& x); Reads a single 32-bit unsigned integer from the internal buffer.
Decompressor& operator >>(int64& x); Reads a single 64-bit integer from the internal buffer.
Decompressor& operator >>(uint64& x); Reads a single 64-bit unsigned integer from the internal buffer.
Decompressor& operator >>(float& x); Reads a single 32-bit floating-point value from the internal buffer.
Decompressor& operator >>(Vector2D& v); Reads two 32-bit floating-point values from the internal buffer and stores them in the vector v.
Decompressor& operator >>(Vector3D& v); Reads three 32-bit floating-point values from the internal buffer and stores them in the vector v.
Decompressor& operator >>(Vector4D& v); Reads four 32-bit floating-point values from the internal buffer and stores them in the vector v.
Decompressor& operator >>(Quaternion& q); Reads four 32-bit floating-point values from the internal buffer and stores them in the quaternion q.
Decompressor& operator >>(ColorRGB& c); Reads three 32-bit floating-point values from the internal buffer and stores them in the color c.
Decompressor& operator >>(ColorRGBA& c); Reads four 32-bit floating-point values from the internal buffer and stores them in the color c.
template <int32 len> Decompressor& operator >>(String<len>& text); Reads a null-terminated text string from the internal buffer.
See Also

Message::DecompressMessage

Compressor