C4 Engine Terathon Software C4 Engine API Documentation

• Message Manager

API Links
Developer Links

class Compressor

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

class Compressor

Member Functions
Compressor::GetSize Returns the current size of the compressed data.
Compressor::Write 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::Compress function before the Message Manager sends a message. The message object should use the << operator or the Compressor::Write 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 unsigned char& x); Writes a single 8-bit unsigned character to the internal buffer.
Compressor& operator <<(const short& x); Writes a single 16-bit integer to the internal buffer.
Compressor& operator <<(const unsigned short& x); Writes a single 16-bit unsigned integer to the internal buffer.
Compressor& operator <<(const long& x); Writes a single 32-bit integer to the internal buffer.
Compressor& operator <<(const unsigned long& x); Writes a single 32-bit unsigned integer to the internal buffer.
Compressor& operator <<(const long64& x); Writes a single 64-bit integer to the internal buffer.
Compressor& operator <<(const ulong64& 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::Compress

Decompressor