C4 Engine
C4 Engine API Documentation

class Compressor

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

class Compressor

Member Functions
Compressor::GetDataSize Returns the current size of the compressed data.
Compressor::WriteData Writes arbitrary data to the internal buffer.
Constructor

Compressor(char *ptr);

Compressor objects should be constructed only by the Message Manager.
Description
A Compressor object is passed to the Message::CompressMessage function before the Message Manager sends a message. The message object should use the << operator or the Compressor::WriteData function to store its data in the Compressor object's internal buffer. Data written by the << operator is always written in big endian order so that messages can be sent between machines having different native endians.
IMPORTANT. The total size of the data written to the Compressor object should not exceed kMaxMessageSize - 1 bytes.
Overloaded Operators
Compressor& operator <<(const char& x); Writes a single 8-bit character to the internal buffer.
Compressor& operator <<(const int8& x); Writes a single 8-bit signed byte to the internal buffer.
Compressor& operator <<(const uint8& x); Writes a single 8-bit unsigned byte to the internal buffer.
Compressor& operator <<(const int16& x); Writes a single 16-bit integer to the internal buffer.
Compressor& operator <<(const uint16& x); Writes a single 16-bit unsigned integer to the internal buffer.
Compressor& operator <<(const int32& x); Writes a single 32-bit integer to the internal buffer.
Compressor& operator <<(const uint32& x); Writes a single 32-bit unsigned integer to the internal buffer.
Compressor& operator <<(const int64& x); Writes a single 64-bit integer to the internal buffer.
Compressor& operator <<(const uint64& x); Writes a single 64-bit unsigned integer to the internal buffer.
Compressor& operator <<(const float& x); Writes a single 32-bit floating-point value to the internal buffer.
Compressor& operator <<(const Vector2D& v); Writes two 32-bit floating-point values to the internal buffer from the vector v.
Compressor& operator <<(const Vector3D& v); Writes three 32-bit floating-point values to the internal buffer from the vector v.
Compressor& operator <<(const Vector4D& v); Writes four 32-bit floating-point values to the internal buffer from the vector v.
Compressor& operator <<(const Quaternion& q); Writes four 32-bit floating-point values to the internal buffer from the quaternion q.
Compressor& operator <<(const ColorRGB& c); Writes three 32-bit floating-point values to the internal buffer from the color c.
Compressor& operator <<(const ColorRGBA& c); Writes four 32-bit floating-point values to the internal buffer from the color c.
Compressor& operator <<(const char *text); Writes a null-terminated text string to the internal buffer.
See Also

Message::CompressMessage

Decompressor