Torque2D Reference
|
#include <bitStream.h>
Public Member Functions | |
void | setBuffer (void *bufPtr, S32 bufSize, S32 maxSize=0) |
U8 * | getBuffer () |
U8 * | getBytePtr () |
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) |
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) |
void | writeRangedS32 (S32 value, S32 min, S32 max) |
S32 | readRangedS32 (S32 min, S32 max) |
Reads a ranged signed integer written with writeRangedS32. More... | |
F32 | readFloat (S32 bitCount) |
F32 | readSignedFloat (S32 bitCount) |
void | writeFloat (F32 f, S32 bitCount) |
void | writeSignedFloat (F32 f, S32 bitCount) |
void | writeRangedF32 (F32 value, F32 min, F32 max, U32 numBits) |
F32 | readRangedF32 (F32 min, F32 max, U32 numBits) |
Reads a ranged floating point value written with writeRangedF32. More... | |
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 | readVector (Point3F *vec, F32 minMag, F32 maxMag, S32 magBits, S32 angleBits, S32 zBits) |
void | writeVector (Point3F vec, F32 minMag, F32 maxMag, S32 magBits, S32 angleBits, S32 zBits) |
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. More... | |
void | writeString (const char *stringBuf, S32 maxLen=255) |
Writes a string to the stream. More... | |
bool | hasCapability (const Capability) const |
Checks to see if this stream has the capability of a given function. More... | |
U32 | getPosition () const |
Gets the position in the stream. More... | |
bool | setPosition (const U32 in_newPosition) |
Sets the position of the stream. Returns if the new position is valid or not. More... | |
U32 | getStreamSize () |
Gets the size of the stream. More... | |
![]() | |
Stream () | |
virtual | ~Stream () |
Stream::Status | getStatus () const |
Gets the status of the stream. More... | |
void | readLine (U8 *buffer, U32 bufferSize) |
void | writeLine (U8 *buffer) |
writes a line to the stream More... | |
const char * | readSTString (bool casesens=false) |
void | readLongString (U32 maxStringLen, char *stringBuf) |
void | writeLongString (U32 maxStringLen, const char *string) |
bool | Put (char character) |
bool | writeFormattedBuffer (const char *format,...) |
bool | writeStringBuffer (const char *buffer) |
Writes a NULL terminated string buffer. More... | |
bool | write (const ColorI &) |
Write an integral color to the stream. More... | |
bool | write (const ColorF &) |
Write a floating point color to the stream. More... | |
bool | read (ColorI *) |
Read an integral color from the stream. More... | |
bool | read (ColorF *) |
Read a floating point color from the stream. More... | |
bool | read (const U32 in_numBytes, void *out_pBuffer) |
bool | write (const U32 in_numBytes, const void *in_pBuffer) |
bool | read (bool *out_pRead) |
bool | write (const bool &in_rWrite) |
bool | copyFrom (Stream *other) |
Copy the contents of another stream into this one. More... | |
void | writeTabs (U32 count) |
Write a number of tabs to this stream. More... | |
Static Public Member Functions | |
static BitStream * | getPacketStream (U32 writeSize=0) |
static void | sendPacketStream (const NetAddress *addr) |
static Point3F | dumbDownNormal (const Point3F &vec, S32 bitCount) |
![]() | |
static const char * | getStatusString (const Status in_status) |
Gets a printable string form of the status. More... | |
Protected Attributes | |
U8 * | dataPtr |
S32 | bitNum |
S32 | bufSize |
bool | error |
S32 | maxReadBitNum |
S32 | maxWriteBitNum |
char * | stringBuffer |
bool | mCompressRelative |
Point3F | mCompressPoint |
Friends | |
class | HuffmanProcessor |
Additional Inherited Members | |
![]() | |
enum | Status { Ok = 0, IOError, EOS, IllegalCall, Closed, UnknownError } |
Status constantants for the stream. More... | |
enum | Capability { StreamWrite = BIT(0), StreamRead = BIT(1), StreamPosition = BIT(2) } |
![]() | |
void | setStatus (const Status in_newStatus) |
|
inline |
|
virtual |
Implements Stream.
|
virtual |
Implements Stream.
void clear | ( | ) |
void clearCompressionPoint | ( | ) |
|
inline |
U8 * getBytePtr | ( | ) |
|
inline |
|
static |
|
virtual |
Gets the position in the stream.
Implements Stream.
U32 getReadByteSize | ( | ) |
|
virtual |
Gets the size of the stream.
Implements Stream.
|
inlinevirtual |
Checks to see if this stream has the capability of a given function.
Implements Stream.
|
inline |
|
inline |
void readAffineTransform | ( | MatrixF * | matrix | ) |
|
virtual |
S32 readClassId | ( | U32 | classType, |
U32 | classGroup | ||
) |
void readCompressedPoint | ( | Point3F * | p, |
F32 | scale = 0.01f |
||
) |
|
inline |
|
inlinevirtual |
F32 readFloat | ( | S32 | bitCount | ) |
S32 readInt | ( | S32 | bitCount | ) |
void readNormalVector | ( | Point3F * | vec, |
S32 | bitCount | ||
) |
void readNormalVector | ( | Point3F * | vec, |
S32 | angleBitCount, | ||
S32 | zBitCount | ||
) |
|
inline |
Reads a ranged floating point value written with writeRangedF32.
|
inline |
Reads a ranged signed integer written with writeRangedS32.
|
inline |
F32 readSignedFloat | ( | S32 | bitCount | ) |
S32 readSignedInt | ( | S32 | bitCount | ) |
|
virtual |
Reads a string of maximum 255 characters long.
Reimplemented from Stream.
void readVector | ( | Point3F * | vec, |
F32 | minMag, | ||
F32 | maxMag, | ||
S32 | magBits, | ||
S32 | angleBits, | ||
S32 | zBits | ||
) |
|
static |
void setBit | ( | S32 | bitCount, |
bool | set | ||
) |
void setBuffer | ( | void * | bufPtr, |
S32 | bufSize, | ||
S32 | maxSize = 0 |
||
) |
void setCompressionPoint | ( | const Point3F & | p | ) |
|
inline |
|
virtual |
Sets the position of the stream. Returns if the new position is valid or not.
Implements Stream.
void setStringBuffer | ( | char | buffer[256] | ) |
bool testBit | ( | S32 | bitCount | ) |
void writeAffineTransform | ( | const MatrixF & | matrix | ) |
|
virtual |
Reimplemented in InfiniteBitStream.
void writeClassId | ( | U32 | classId, |
U32 | classType, | ||
U32 | classGroup | ||
) |
void writeCompressedPoint | ( | const Point3F & | p, |
F32 | scale = 0.01f |
||
) |
|
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.
|
virtual |
Reimplemented in InfiniteBitStream.
void writeFloat | ( | F32 | f, |
S32 | bitCount | ||
) |
void writeInt | ( | S32 | value, |
S32 | bitCount | ||
) |
void writeNormalVector | ( | const Point3F & | vec, |
S32 | bitCount | ||
) |
void writeNormalVector | ( | const Point3F & | vec, |
S32 | angleBitCount, | ||
S32 | zBitCount | ||
) |
|
inline |
Writes a clamped floating point value to the stream with the desired bits of precision.
|
inline |
Writes a clamped signed integer to the stream using an optimal amount of bits for the range.
|
inline |
void writeSignedFloat | ( | F32 | f, |
S32 | bitCount | ||
) |
void writeSignedInt | ( | S32 | value, |
S32 | bitCount | ||
) |
|
virtual |
Writes a string to the stream.
Reimplemented from Stream.
void writeVector | ( | Point3F | vec, |
F32 | minMag, | ||
F32 | maxMag, | ||
S32 | magBits, | ||
S32 | angleBits, | ||
S32 | zBits | ||
) |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |