Utility class providing helper methods for reading / writing structured data held in a DataStream.
More...
|
| StreamSerialiser (const DataStreamPtr &stream, Endian endianMode=ENDIAN_AUTO, bool autoHeader=true, RealStorageFormat realFormat=REAL_FLOAT) |
| Constructor. More...
|
|
virtual | ~StreamSerialiser () |
|
virtual bool | eof () const |
| Reports whether the stream is at the end of file. More...
|
|
virtual const Chunk * | getCurrentChunk () const |
| Get the definition of the current chunk being read (if any). More...
|
|
size_t | getCurrentChunkDepth () const |
| Report the current depth of the chunk nesting, whether reading or writing. More...
|
|
uint32 | getCurrentChunkID () const |
| Get the ID of the chunk that's currently being read/written, if any. More...
|
|
virtual Endian | getEndian () const |
| Get the endian mode. More...
|
|
size_t | getOffsetFromChunkStart () const |
| Get the current byte position relative to the start of the data section of the last chunk that was read or written. More...
|
|
virtual bool | isEndOfChunk (uint32 id) |
| Return whether the current data pointer is at the end of the current chunk. More...
|
|
virtual uint32 | peekNextChunkID () |
| Call this to 'peek' at the next chunk ID without permanently moving the stream pointer. More...
|
|
virtual void | read (AxisAlignedBox *aabb, size_t count=1) |
|
virtual void | read (bool *val, size_t count=1) |
|
virtual void | read (Matrix3 *m, size_t count=1) |
|
virtual void | read (Matrix4 *m, size_t count=1) |
|
virtual void | read (Node *node, size_t count=1) |
|
virtual void | read (Plane *plane, size_t count=1) |
|
virtual void | read (Quaternion *q, size_t count=1) |
|
virtual void | read (Radian *angle, size_t count=1) |
|
virtual void | read (Ray *ray, size_t count=1) |
|
virtual void | read (Real *val, size_t count=1) |
|
virtual void | read (Sphere *sphere, size_t count=1) |
|
virtual void | read (String *string) |
|
template<typename T > |
void | read (T *pT, size_t count=1) |
| Catch-all method to read primitive types. More...
|
|
virtual void | read (Vector2 *vec, size_t count=1) |
| read a Vector3 More...
|
|
virtual void | read (Vector3 *vec, size_t count=1) |
|
virtual void | read (Vector4 *vec, size_t count=1) |
|
virtual const Chunk * | readChunkBegin () |
| Reads the start of the next chunk in the file. More...
|
|
virtual const Chunk * | readChunkBegin (uint32 id, uint16 maxVersion, const String &msg=BLANKSTRING) |
| Reads the start of the next chunk so long as it's of a given ID and version. More...
|
|
virtual void | readChunkEnd (uint32 id) |
| Finish the reading of a chunk. More...
|
|
virtual void | readData (void *buf, size_t size, size_t count) |
| Read arbitrary data from a stream. More...
|
|
virtual void | startDeflate (size_t avail_in=0) |
| Start (un)compressing data. More...
|
|
virtual void | stopDeflate () |
| Stop (un)compressing data. More...
|
|
virtual void | undoReadChunk (uint32 id) |
| Call this to 'rewind' the stream to just before the start of the current chunk. More...
|
|
virtual void | write (const AxisAlignedBox *aabb, size_t count=1) |
|
virtual void | write (const bool *boolean, size_t count=1) |
|
virtual void | write (const Matrix3 *m, size_t count=1) |
|
virtual void | write (const Matrix4 *m, size_t count=1) |
|
virtual void | write (const Node *node, size_t count=1) |
|
virtual void | write (const Plane *plane, size_t count=1) |
|
virtual void | write (const Quaternion *q, size_t count=1) |
|
virtual void | write (const Radian *angle, size_t count=1) |
|
virtual void | write (const Ray *ray, size_t count=1) |
|
virtual void | write (const Real *val, size_t count=1) |
|
virtual void | write (const Sphere *sphere, size_t count=1) |
|
virtual void | write (const String *string) |
|
template<typename T > |
void | write (const T *pT, size_t count=1) |
| Catch-all method to write primitive types. More...
|
|
virtual void | write (const Vector2 *vec, size_t count=1) |
|
virtual void | write (const Vector3 *vec, size_t count=1) |
|
virtual void | write (const Vector4 *vec, size_t count=1) |
|
virtual void | writeChunkBegin (uint32 id, uint16 version=1) |
| Begin writing a new chunk. More...
|
|
virtual void | writeChunkEnd (uint32 id) |
| End writing a chunk. More...
|
|
virtual void | writeData (const void *buf, size_t size, size_t count) |
| Write arbitrary data to a stream. More...
|
|
Utility class providing helper methods for reading / writing structured data held in a DataStream.
- Chunks are contained serially in the file, but they can also be nested in order both to provide context, and to group chunks together for potential skipping.
- The data format of a chunk is as follows:
- Chunk ID (32-bit uint). This can be any number unique in a context, except the numbers 0x0000, 0x0001 and 0x1000, which are reserved for Ogre's use
- Chunk version (16-bit uint). Chunks can change over time so this version number reflects that
- Length (32-bit uint). The length of the chunk data section, including nested chunks. Note that this length excludes this header, but includes the header of any nested chunks.
- Checksum (32-bit uint). Checksum value generated from the above - basically lets us check this is a valid chunk.
- Chunk data The 'Chunk data' section will contain chunk-specific data, which may include other nested chunks.