Ogre::StreamSerialiser Class Reference
Core » Resources

Utility class providing helper methods for reading / writing structured data held in a DataStream. More...

`#include <OgreStreamSerialiser.h>`

Inheritance diagram for Ogre::StreamSerialiser:
[legend]

## Classes

struct | Chunk
| Definition of a chunk of data in a file. More...

## Public Types

enum | Endian { ENDIAN_AUTO, ENDIAN_BIG, ENDIAN_LITTLE }
| The endianness of files. More...
enum | RealStorageFormat { REAL_FLOAT, REAL_DOUBLE }
| The storage format of Real values. More...

## Public Member Functions

| 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...
void | operator delete (void *ptr)
void | operator delete (void *ptr, void *)
void | operator delete (void *ptr, const char *, int, const char *)
void | operator delete[] (void *ptr)
void | operator delete[] (void *ptr, const char *, int, const char *)
void * | operator new (size_t sz, const char *file, int line, const char *func)
| operator new, with debug line info More...
void * | operator new (size_t sz)
void * | operator new (size_t sz, void *ptr)
| placement operator new More...
void * | operator new[] (size_t sz, const char *file, int line, const char *func)
| array operator new, with debug line info More...
void * | operator new[] (size_t sz)
virtual uint32 | peekNextChunkID ()
| Call this to 'peek' at the next chunk ID without permanently moving the stream pointer. More...
template<typename T >
void | read (T *pT, size_t count=1)
| Catch-all method to read primitive types. More...
virtual void | read (Real *val, size_t count=1)
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 void | read (Quaternion *q, 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 (String *string)
virtual void | read (AxisAlignedBox *aabb, size_t count=1)
virtual void | read (Sphere *sphere, size_t count=1)
virtual void | read (Plane *plane, size_t count=1)
virtual void | read (Ray *ray, size_t count=1)
virtual void | read (Radian *angle, size_t count=1)
virtual void | read (Node *node, size_t count=1)
virtual void | read (bool *val, 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=StringUtil::BLANK)
| 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...
template<typename T >
void | write (const T *pT, size_t count=1)
| Catch-all method to write primitive types. More...
virtual void | write (const Real *val, size_t count=1)
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 | write (const Quaternion *q, 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 String *string)
virtual void | write (const AxisAlignedBox *aabb, size_t count=1)
virtual void | write (const Sphere *sphere, size_t count=1)
virtual void | write (const Plane *plane, size_t count=1)
virtual void | write (const Ray *ray, size_t count=1)
virtual void | write (const Radian *angle, size_t count=1)
virtual void | write (const Node *node, size_t count=1)
virtual void | write (const bool *boolean, 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...

## Static Public Member Functions

static uint32 | makeIdentifier (const String &code)
| Pack a 4-character code into a 32-bit identifier. More...

## Protected Types

typedef deque< Chunk * >::type | ChunkStack

## Protected Member Functions

virtual uint32 | calculateChecksum (Chunk *c)
virtual void | checkStream (bool failOnEof=false, bool validateReadable=false, bool validateWriteable=false) const
virtual void | determineEndianness ()
virtual void | flipEndian (void *pData, size_t size, size_t count)
virtual void | flipEndian (void *pData, size_t size)
virtual Chunk * | popChunk (uint id)
virtual Chunk * | readChunkImpl ()
template<typename T , typename U >
void | readConverted (T *dst, U typeToRead, size_t count)
virtual void | readDoublesAsFloats (float *val, size_t count)
virtual void | readFloatsAsDoubles (double *val, size_t count)
virtual void | readHeader ()
virtual void | writeChunkImpl (uint32 id, uint16 version)
template<typename T , typename U >
void | writeConverted (const T *src, U typeToWrite, size_t count)
virtual void | writeDoublesAsFloats (const double *val, size_t count)
virtual void | writeFloatsAsDoubles (const float *val, size_t count)
virtual void | writeHeader ()

## Protected Attributes

ChunkStack | mChunkStack
| Current list of open chunks. More...
Endian | mEndian
bool | mFlipEndian
DataStreamPtr | mOriginalStream
bool | mReadWriteHeader
RealStorageFormat | mRealFormat
DataStreamPtr | mStream

## Static Protected Attributes

static uint32 | CHUNK_HEADER_SIZE
static uint32 | HEADER_ID
static uint32 | REVERSE_HEADER_ID

## Detailed Description

Utility class providing helper methods for reading / writing structured data held in a DataStream.

Remarks
  The structure of a file read / written by this class is a series of 'chunks'. A chunk-based format has the advantage of being extensible later, and it's robust, in that a reader can skip chunks that they are not able (or willing) to process.

  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:
  1. 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
  2. Chunk version (16-bit uint). Chunks can change over time so this version number reflects that
  3. 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.
  4. Checksum (32-bit uint). Checksum value generated from the above - basically lets us check this is a valid chunk.
  5. Chunk data The 'Chunk data' section will contain chunk-specific data, which may include other nested chunks.

Definition at line 66 of file OgreStreamSerialiser.h.

## Member Typedef Documentation

## ChunkStack

typedef deque<Chunk*>::type Ogre::StreamSerialiser::ChunkStack

protected

Definition at line 335 of file OgreStreamSerialiser.h.

## Member Enumeration Documentation

## Endian

enum Ogre::StreamSerialiser::Endian

The endianness of files.

Enumerator
ENDIAN_AUTO | Automatically determine endianness.
ENDIAN_BIG | Use big endian (0x1000 is serialised as 0x10 0x00)
ENDIAN_LITTLE | Use little endian (0x1000 is serialised as 0x00 0x10)

Definition at line 70 of file OgreStreamSerialiser.h.

## RealStorageFormat

enum Ogre::StreamSerialiser::RealStorageFormat

The storage format of Real values.

Enumerator
REAL_FLOAT | Real is stored as float, reducing precision if you're using OGRE_DOUBLE_PRECISION.
REAL_DOUBLE | Real as stored as double, not useful unless you're using OGRE_DOUBLE_PRECISION.

Definition at line 81 of file OgreStreamSerialiser.h.

## Constructor & Destructor Documentation

## StreamSerialiser()

Ogre::StreamSerialiser::StreamSerialiser | ( | const DataStreamPtr & | stream,
|  | Endian | endianMode = `ENDIAN_AUTO`,
|  | bool | autoHeader = `true`,
|  | RealStorageFormat | realFormat = `REAL_FLOAT`
| ) |  |

Constructor.

Parameters

  stream | The stream on which you will read / write data.
  endianMode | The endian mode in which to read / writedata. If left at the default, when writing the endian mode will be the native platform mode, and when reading it's expected that the first chunk encountered will be the header chunk, which will determine the endian mode.
  autoHeader | If true, the first write or read to this stream will automatically read / write the header too. This is required if you set endianMode to ENDIAN_AUTO, but if you manually set the endian mode, then you can skip writing / reading the header if you wish, if for example this stream is midway through a file which has already included header information.
  realFormat | Set the format you want to write reals in. Only useful for files that you're writing (since when reading this is picked up from the file), and can only be changed if autoHeader is true, since real format is stored in the header. Defaults to float unless you're using OGRE_DOUBLE_PRECISION.

## ~StreamSerialiser()

virtual Ogre::StreamSerialiser::~StreamSerialiser | ( |  | ) |

virtual

## Member Function Documentation

## calculateChecksum()

virtual uint32 Ogre::StreamSerialiser::calculateChecksum | ( | Chunk * | c | ) |

protected virtual

## checkStream()

virtual void Ogre::StreamSerialiser::checkStream | ( | bool | failOnEof = `false`,
|  | bool | validateReadable = `false`,
|  | bool | validateWriteable = `false`
| ) |  | const

protected virtual

## determineEndianness()

virtual void Ogre::StreamSerialiser::determineEndianness | ( |  | ) |

protected virtual

## eof()

virtual bool Ogre::StreamSerialiser::eof | ( |  | ) | const

virtual

Reports whether the stream is at the end of file.

## flipEndian() [1/2]

virtual void Ogre::StreamSerialiser::flipEndian | ( | void * | pData,
|  | size_t | size,
|  | size_t | count
| ) |  |

protected virtual

## flipEndian() [2/2]

virtual void Ogre::StreamSerialiser::flipEndian | ( | void * | pData,
|  | size_t | size
| ) |  |

protected virtual

## getCurrentChunk()

virtual const Chunk* Ogre::StreamSerialiser::getCurrentChunk | ( |  | ) | const

virtual

Get the definition of the current chunk being read (if any).

## getCurrentChunkDepth()

size_t Ogre::StreamSerialiser::getCurrentChunkDepth | ( |  | ) | const

Report the current depth of the chunk nesting, whether reading or writing.

Remarks
  Returns how many levels of nested chunks are currently being processed, either writing or reading. In order to tidily finish, you must call read/writeChunkEnd this many times.

Definition at line 153 of file OgreStreamSerialiser.h.

References Ogre::StringUtil::BLANK.

## getCurrentChunkID()

uint32 Ogre::StreamSerialiser::getCurrentChunkID | ( |  | ) | const

Get the ID of the chunk that's currently being read/written, if any.

Returns
  The id of the current chunk being read / written (at the tightest level of nesting), or zero if no chunk is being processed.

## getEndian()

virtual Endian Ogre::StreamSerialiser::getEndian | ( |  | ) | const

virtual

Get the endian mode.

Remarks
  If the result is ENDIAN_AUTO, this mode will change when the first piece of data is read / written.

Definition at line 137 of file OgreStreamSerialiser.h.

## getOffsetFromChunkStart()

size_t Ogre::StreamSerialiser::getOffsetFromChunkStart | ( |  | ) | const

Get the current byte position relative to the start of the data section of the last chunk that was read or written.

Returns
  the offset. Note that a return value of 0 means that either the position is at the start of the chunk data section (ie right after the header), or that no chunk is currently active. Use getCurrentChunkID or getCurrentChunkDepth to determine if a chunk is active.

## isEndOfChunk()

virtual bool Ogre::StreamSerialiser::isEndOfChunk | ( | uint32 | id | ) |

virtual

Return whether the current data pointer is at the end of the current chunk.

Parameters

  id | The id of the chunk that you were reading (for validation purposes)

## makeIdentifier()

static uint32 Ogre::StreamSerialiser::makeIdentifier | ( | const String & | code | ) |

static

Pack a 4-character code into a 32-bit identifier.

Remarks
  You can use this to generate id's for your chunks based on friendlier 4-character codes rather than assigning numerical IDs, if you like.

Parameters

  code | String to pack - must be 4 characters.

## operator delete() [1/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) |

inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

## operator delete() [2/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  |

inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

## operator delete() [3/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [1/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) |

inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [2/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

## operator new() [1/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

## operator new() [2/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) |

inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

## operator new() [3/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr
| ) |  |

inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

## operator new[]() [1/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

## operator new[]() [2/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) |

inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

## peekNextChunkID()

virtual uint32 Ogre::StreamSerialiser::peekNextChunkID | ( |  | ) |

virtual

Call this to 'peek' at the next chunk ID without permanently moving the stream pointer.

## popChunk()

virtual Chunk* Ogre::StreamSerialiser::popChunk | ( | uint | id | ) |

protected virtual

## read() [1/16]

template<typename T >

void Ogre::StreamSerialiser::read | ( | T * | pT,
|  | size_t | count = `1`
| ) |  |

Catch-all method to read primitive types.

Definition at line 297 of file OgreStreamSerialiser.h.

## read() [2/16]

virtual void Ogre::StreamSerialiser::read | ( | Real * | val,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [3/16]

virtual void Ogre::StreamSerialiser::read | ( | Vector2 * | vec,
|  | size_t | count = `1`
| ) |  |

virtual

read a Vector3

## read() [4/16]

virtual void Ogre::StreamSerialiser::read | ( | Vector3 * | vec,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [5/16]

virtual void Ogre::StreamSerialiser::read | ( | Vector4 * | vec,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [6/16]

virtual void Ogre::StreamSerialiser::read | ( | Quaternion * | q,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [7/16]

virtual void Ogre::StreamSerialiser::read | ( | Matrix3 * | m,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [8/16]

virtual void Ogre::StreamSerialiser::read | ( | Matrix4 * | m,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [9/16]

virtual void Ogre::StreamSerialiser::read | ( | String * | string | ) |

virtual

## read() [10/16]

virtual void Ogre::StreamSerialiser::read | ( | AxisAlignedBox * | aabb,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [11/16]

virtual void Ogre::StreamSerialiser::read | ( | Sphere * | sphere,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [12/16]

virtual void Ogre::StreamSerialiser::read | ( | Plane * | plane,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [13/16]

virtual void Ogre::StreamSerialiser::read | ( | Ray * | ray,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [14/16]

virtual void Ogre::StreamSerialiser::read | ( | Radian * | angle,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [15/16]

virtual void Ogre::StreamSerialiser::read | ( | Node * | node,
|  | size_t | count = `1`
| ) |  |

virtual

## read() [16/16]

virtual void Ogre::StreamSerialiser::read | ( | bool * | val,
|  | size_t | count = `1`
| ) |  |

virtual

## readChunkBegin() [1/2]

virtual const Chunk* Ogre::StreamSerialiser::readChunkBegin | ( |  | ) |

virtual

Reads the start of the next chunk in the file.

Remarks
  Files are serialised in a chunk-based manner, meaning that each section of data is prepended by a chunk header. After reading this chunk header, the next set of data is available directly afterwards.

Note
  When you have finished with this chunk, you should call readChunkEnd. This will perform a bit of validation and clear the chunk from the stack.

Returns
  The Chunk that comes next

## readChunkBegin() [2/2]

virtual const Chunk* Ogre::StreamSerialiser::readChunkBegin | ( | uint32 | id,
|  | uint16 | maxVersion,
|  | const String & | msg = `StringUtil::BLANK`
| ) |  |

virtual

Reads the start of the next chunk so long as it's of a given ID and version.

Remarks
  This method operates like readChunkBegin, except it checks the ID and version.

Parameters

  id | The ID you're expecting. If the next chunk isn't of this ID, then the chunk read is undone and the method returns null.
  maxVersion | The maximum version you're able to process. If the ID is correct but the version exceeds what is passed in here, the chunk is skipped over, the problem logged and null is returned.
  msg | Descriptive text added to the log if versions are not compatible

Returns
  The chunk if it passes the validation.

## readChunkEnd()

virtual void Ogre::StreamSerialiser::readChunkEnd | ( | uint32 | id | ) |

virtual

Finish the reading of a chunk.

Remarks
  You can call this method at any point after calling readChunkBegin, even if you didn't read all the rest of the data in the chunk. If you did not read to the end of a chunk, this method will automatically skip over the remainder of the chunk and position the stream just after it.

Parameters

  id | The id of the chunk that you were reading (for validation purposes)

## readChunkImpl()

virtual Chunk* Ogre::StreamSerialiser::readChunkImpl | ( |  | ) |

protected virtual

## readConverted()

template<typename T , typename U >

void Ogre::StreamSerialiser::readConverted | ( | T * | dst,
|  | U | typeToRead,
|  | size_t | count
| ) |  |

protected

Definition at line 374 of file OgreStreamSerialiser.h.

References Ogre::MEMCATEGORY_GENERAL, OGRE_ALLOC_T, and OGRE_FREE.

## readData()

virtual void Ogre::StreamSerialiser::readData | ( | void * | buf,
|  | size_t | size,
|  | size_t | count
| ) |  |

virtual

Read arbitrary data from a stream.

Parameters

  buf | Pointer to bytes
  size | The size of each element to read; each will be endian-flipped if necessary
  count | The number of elements to read

## readDoublesAsFloats()

virtual void Ogre::StreamSerialiser::readDoublesAsFloats | ( | float * | val,
|  | size_t | count
| ) |  |

protected virtual

## readFloatsAsDoubles()

virtual void Ogre::StreamSerialiser::readFloatsAsDoubles | ( | double * | val,
|  | size_t | count
| ) |  |

protected virtual

## readHeader()

virtual void Ogre::StreamSerialiser::readHeader | ( |  | ) |

protected virtual

## startDeflate()

virtual void Ogre::StreamSerialiser::startDeflate | ( | size_t | avail_in = `0` | ) |

virtual

Start (un)compressing data.

Parameters

  avail_in | Available bytes for uncompressing

## stopDeflate()

virtual void Ogre::StreamSerialiser::stopDeflate | ( |  | ) |

virtual

Stop (un)compressing data.

## undoReadChunk()

virtual void Ogre::StreamSerialiser::undoReadChunk | ( | uint32 | id | ) |

virtual

Call this to 'rewind' the stream to just before the start of the current chunk.

Remarks
  The most common case of wanting to use this is if you'd calledReadChunkBegin(), but the chunk you read wasn't one you wanted to process, and rather than skipping over it (which readChunkEnd() would do), you want to backtrack and give something else an opportunity to read it.

Parameters

  id | The id of the chunk that you were reading (for validation purposes)

## write() [1/16]

template<typename T >

void Ogre::StreamSerialiser::write | ( | const T * | pT,
|  | size_t | count = `1`
| ) |  |

Catch-all method to write primitive types.

Definition at line 263 of file OgreStreamSerialiser.h.

## write() [2/16]

virtual void Ogre::StreamSerialiser::write | ( | const Real * | val,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [3/16]

virtual void Ogre::StreamSerialiser::write | ( | const Vector2 * | vec,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [4/16]

virtual void Ogre::StreamSerialiser::write | ( | const Vector3 * | vec,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [5/16]

virtual void Ogre::StreamSerialiser::write | ( | const Vector4 * | vec,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [6/16]

virtual void Ogre::StreamSerialiser::write | ( | const Quaternion * | q,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [7/16]

virtual void Ogre::StreamSerialiser::write | ( | const Matrix3 * | m,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [8/16]

virtual void Ogre::StreamSerialiser::write | ( | const Matrix4 * | m,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [9/16]

virtual void Ogre::StreamSerialiser::write | ( | const String * | string | ) |

virtual

## write() [10/16]

virtual void Ogre::StreamSerialiser::write | ( | const AxisAlignedBox * | aabb,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [11/16]

virtual void Ogre::StreamSerialiser::write | ( | const Sphere * | sphere,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [12/16]

virtual void Ogre::StreamSerialiser::write | ( | const Plane * | plane,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [13/16]

virtual void Ogre::StreamSerialiser::write | ( | const Ray * | ray,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [14/16]

virtual void Ogre::StreamSerialiser::write | ( | const Radian * | angle,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [15/16]

virtual void Ogre::StreamSerialiser::write | ( | const Node * | node,
|  | size_t | count = `1`
| ) |  |

virtual

## write() [16/16]

virtual void Ogre::StreamSerialiser::write | ( | const bool * | boolean,
|  | size_t | count = `1`
| ) |  |

virtual

## writeChunkBegin()

virtual void Ogre::StreamSerialiser::writeChunkBegin | ( | uint32 | id,
|  | uint16 | version = `1`
| ) |  |

virtual

Begin writing a new chunk.

Remarks
  This starts the process of writing a new chunk to the stream. This will write the chunk header for you, and store a pointer so that the class can automatically go back and fill in the size for you later should you need it to. If you have already begun a chunk without ending it, then this method will start a nested chunk within it. Once written, you can then start writing chunk-specific data into your stream.

Note
  If this is the first chunk in the file

Parameters

  id | The identifier of the new chunk. Any value that's unique in the file context is valid, except for the numbers 0x0001 and 0x1000 which are reserved for internal header identification use.
  version | The version of the chunk you're writing

## writeChunkEnd()

virtual void Ogre::StreamSerialiser::writeChunkEnd | ( | uint32 | id | ) |

virtual

End writing a chunk.

Parameters

  id | The identifier of the chunk - this is really just a safety check, since you can only end the chunk you most recently started.

## writeChunkImpl()

virtual void Ogre::StreamSerialiser::writeChunkImpl | ( | uint32 | id,
|  | uint16 | version
| ) |  |

protected virtual

## writeConverted()

template<typename T , typename U >

void Ogre::StreamSerialiser::writeConverted | ( | const T * | src,
|  | U | typeToWrite,
|  | size_t | count
| ) |  |

protected

Definition at line 361 of file OgreStreamSerialiser.h.

References Ogre::MEMCATEGORY_GENERAL, OGRE_ALLOC_T, and OGRE_FREE.

## writeData()

virtual void Ogre::StreamSerialiser::writeData | ( | const void * | buf,
|  | size_t | size,
|  | size_t | count
| ) |  |

virtual

Write arbitrary data to a stream.

Parameters

  buf | Pointer to bytes
  size | The size of each element to write; each will be endian-flipped if necessary
  count | The number of elements to write

## writeDoublesAsFloats()

virtual void Ogre::StreamSerialiser::writeDoublesAsFloats | ( | const double * | val,
|  | size_t | count
| ) |  |

protected virtual

## writeFloatsAsDoubles()

virtual void Ogre::StreamSerialiser::writeFloatsAsDoubles | ( | const float * | val,
|  | size_t | count
| ) |  |

protected virtual

## writeHeader()

virtual void Ogre::StreamSerialiser::writeHeader | ( |  | ) |

protected virtual

## Member Data Documentation

## CHUNK_HEADER_SIZE

uint32 Ogre::StreamSerialiser::CHUNK_HEADER_SIZE

static protected

Definition at line 341 of file OgreStreamSerialiser.h.

## HEADER_ID

uint32 Ogre::StreamSerialiser::HEADER_ID

static protected

Definition at line 339 of file OgreStreamSerialiser.h.

## mChunkStack

ChunkStack Ogre::StreamSerialiser::mChunkStack

protected

Current list of open chunks.

Definition at line 337 of file OgreStreamSerialiser.h.

## mEndian

Endian Ogre::StreamSerialiser::mEndian

protected

Definition at line 331 of file OgreStreamSerialiser.h.

## mFlipEndian

bool Ogre::StreamSerialiser::mFlipEndian

protected

Definition at line 332 of file OgreStreamSerialiser.h.

## mOriginalStream

DataStreamPtr Ogre::StreamSerialiser::mOriginalStream

protected

Definition at line 330 of file OgreStreamSerialiser.h.

## mReadWriteHeader

bool Ogre::StreamSerialiser::mReadWriteHeader

protected

Definition at line 333 of file OgreStreamSerialiser.h.

## mRealFormat

RealStorageFormat Ogre::StreamSerialiser::mRealFormat

protected

Definition at line 334 of file OgreStreamSerialiser.h.

## mStream

DataStreamPtr Ogre::StreamSerialiser::mStream

protected

Definition at line 329 of file OgreStreamSerialiser.h.

## REVERSE_HEADER_ID

uint32 Ogre::StreamSerialiser::REVERSE_HEADER_ID

static protected

Definition at line 340 of file OgreStreamSerialiser.h.

The documentation for this class was generated from the following file:

- OgreStreamSerialiser.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.