torque Torque Game Engine Documentation
TGE Version 1.5.2

BitStream Class Reference

#include <bitStream.h>

Inheritance diagram for BitStream:

Inheritance graph
[legend]

Public Member Functions

void setBuffer (void *bufPtr, S32 bufSize, S32 maxSize=0)
U8getBuffer ()
U8getBytePtr ()
U32 getReadByteSize ()
S32 getCurPos () const
void setCurPos (const U32)
 BitStream (void *bufPtr, S32 bufSize, S32 maxWriteSize=-1)
void clear ()
void setStringBuffer (char buffer[256])
void writeInt (S32 value, S32 bitCount)
S32 readInt (S32 bitCount)
void writeCussedU32 (U32 val)
 Use this method to write out values in a concise but ass backwards way.
U32 readCussedU32 ()
void writeSignedInt (S32 value, S32 bitCount)
S32 readSignedInt (S32 bitCount)
void writeRangedU32 (U32 value, U32 rangeStart, U32 rangeEnd)
U32 readRangedU32 (U32 rangeStart, U32 rangeEnd)
F32 readFloat (S32 bitCount)
F32 readSignedFloat (S32 bitCount)
void writeFloat (F32 f, S32 bitCount)
void writeSignedFloat (F32 f, S32 bitCount)
void writeClassId (U32 classId, U32 classType, U32 classGroup)
S32 readClassId (U32 classType, U32 classGroup)
void writeNormalVector (const Point3F &vec, S32 bitCount)
void readNormalVector (Point3F *vec, S32 bitCount)
void clearCompressionPoint ()
void setCompressionPoint (const Point3F &p)
void writeCompressedPoint (const Point3F &p, F32 scale=0.01f)
void readCompressedPoint (Point3F *p, F32 scale=0.01f)
void writeNormalVector (const Point3F &vec, S32 angleBitCount, S32 zBitCount)
void readNormalVector (Point3F *vec, S32 angleBitCount, S32 zBitCount)
void writeAffineTransform (const MatrixF &)
void readAffineTransform (MatrixF *)
virtual void writeBits (S32 bitCount, const void *bitPtr)
virtual void readBits (S32 bitCount, void *bitPtr)
virtual bool writeFlag (bool val)
virtual bool readFlag ()
void setBit (S32 bitCount, bool set)
bool testBit (S32 bitCount)
bool isFull ()
bool isValid ()
bool _read (const U32 size, void *d)
bool _write (const U32 size, const void *d)
void readString (char stringBuf[256])
 Reads a string of maximum 255 characters long.
void writeString (const char *stringBuf, S32 maxLen=255)
 Writes a string to the stream.
bool hasCapability (const Capability) const
 Checks to see if this stream has the capability of a given function.
U32 getPosition () const
 Gets the position in the stream.
bool setPosition (const U32 in_newPosition)
 Sets the position of the stream. Returns if the new position is valid or not.
U32 getStreamSize ()
 Gets the size of the stream.

Static Public Member Functions

static BitStreamgetPacketStream (U32 writeSize=0)
static void sendPacketStream (const NetAddress *addr)
static Point3F dumbDownNormal (const Point3F &vec, S32 bitCount)

Protected Attributes

U8dataPtr
S32 bitNum
S32 bufSize
bool error
S32 maxReadBitNum
S32 maxWriteBitNum
char * stringBuffer
bool mCompressRelative
Point3F mCompressPoint

Friends

class HuffmanProcessor

Constructor & Destructor Documentation

BitStream::BitStream ( void bufPtr,
S32  bufSize,
S32  maxWriteSize = -1 
) [inline]


Member Function Documentation

static BitStream* BitStream::getPacketStream ( U32  writeSize = 0  )  [static]

static void BitStream::sendPacketStream ( const NetAddress addr  )  [static]

void BitStream::setBuffer ( void bufPtr,
S32  bufSize,
S32  maxSize = 0 
)

U8* BitStream::getBuffer (  )  [inline]

U8* BitStream::getBytePtr (  ) 

U32 BitStream::getReadByteSize (  ) 

S32 BitStream::getCurPos (  )  const [inline]

void BitStream::setCurPos ( const   U32  )  [inline]

void BitStream::clear (  ) 

void BitStream::setStringBuffer ( char  buffer[256]  ) 

void BitStream::writeInt ( S32  value,
S32  bitCount 
)

S32 BitStream::readInt ( S32  bitCount  ) 

void BitStream::writeCussedU32 ( U32  val  )  [inline]

Use this method to write out values in a concise but ass backwards way.

.. Good for values you expect to be frequently zero, often small. Worst case this will bloat values by nearly 20% (5 extra bits!) Best case you'll get one bit (if it's zero).

This is not so much for efficiency's sake, as to make life painful for people that want to reverse engineer our network or file formats.

U32 BitStream::readCussedU32 (  )  [inline]

void BitStream::writeSignedInt ( S32  value,
S32  bitCount 
)

S32 BitStream::readSignedInt ( S32  bitCount  ) 

void BitStream::writeRangedU32 ( U32  value,
U32  rangeStart,
U32  rangeEnd 
) [inline]

U32 BitStream::readRangedU32 ( U32  rangeStart,
U32  rangeEnd 
) [inline]

F32 BitStream::readFloat ( S32  bitCount  ) 

F32 BitStream::readSignedFloat ( S32  bitCount  ) 

void BitStream::writeFloat ( F32  f,
S32  bitCount 
)

void BitStream::writeSignedFloat ( F32  f,
S32  bitCount 
)

void BitStream::writeClassId ( U32  classId,
U32  classType,
U32  classGroup 
)

S32 BitStream::readClassId ( U32  classType,
U32  classGroup 
)

void BitStream::writeNormalVector ( const Point3F vec,
S32  bitCount 
)

void BitStream::readNormalVector ( Point3F vec,
S32  bitCount 
)

void BitStream::clearCompressionPoint (  ) 

void BitStream::setCompressionPoint ( const Point3F p  ) 

void BitStream::writeCompressedPoint ( const Point3F p,
F32  scale = 0.01f 
)

void BitStream::readCompressedPoint ( Point3F p,
F32  scale = 0.01f 
)

static Point3F BitStream::dumbDownNormal ( const Point3F vec,
S32  bitCount 
) [static]

void BitStream::writeNormalVector ( const Point3F vec,
S32  angleBitCount,
S32  zBitCount 
)

void BitStream::readNormalVector ( Point3F vec,
S32  angleBitCount,
S32  zBitCount 
)

void BitStream::writeAffineTransform ( const MatrixF  ) 

void BitStream::readAffineTransform ( MatrixF  ) 

virtual void BitStream::writeBits ( S32  bitCount,
const void bitPtr 
) [virtual]

Reimplemented in InfiniteBitStream.

virtual void BitStream::readBits ( S32  bitCount,
void bitPtr 
) [virtual]

virtual bool BitStream::writeFlag ( bool  val  )  [virtual]

Reimplemented in InfiniteBitStream.

bool BitStream::readFlag (  )  [inline, virtual]

void BitStream::setBit ( S32  bitCount,
bool  set 
)

bool BitStream::testBit ( S32  bitCount  ) 

bool BitStream::isFull (  )  [inline]

bool BitStream::isValid (  )  [inline]

bool BitStream::_read ( const U32  size,
void d 
) [virtual]

Implements Stream.

bool BitStream::_write ( const U32  size,
const void d 
) [virtual]

Implements Stream.

void BitStream::readString ( char  stringBuf[256]  )  [virtual]

Reads a string of maximum 255 characters long.

Reimplemented from Stream.

void BitStream::writeString ( const char *  stringBuf,
S32  maxLen = 255 
) [virtual]

Writes a string to the stream.

Reimplemented from Stream.

bool BitStream::hasCapability ( const   Capability  )  const [inline, virtual]

Checks to see if this stream has the capability of a given function.

Implements Stream.

U32 BitStream::getPosition (  )  const [virtual]

Gets the position in the stream.

Implements Stream.

bool BitStream::setPosition ( const U32  in_newPosition  )  [virtual]

Sets the position of the stream. Returns if the new position is valid or not.

Implements Stream.

U32 BitStream::getStreamSize (  )  [virtual]

Gets the size of the stream.

Implements Stream.


Friends And Related Function Documentation

friend class HuffmanProcessor [friend]


Field Documentation

U8* BitStream::dataPtr [protected]

S32 BitStream::bitNum [protected]

S32 BitStream::bufSize [protected]

bool BitStream::error [protected]

char* BitStream::stringBuffer [protected]

bool BitStream::mCompressRelative [protected]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen