Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# Ogre::Serializer Class Reference

Generic class for serialising data to / from binary chunk-based files. More...

`#include <OgreSerializer.h>`

Inheritance diagram for Ogre::Serializer:

[legend]
List of all members.

## Public Methods

| Serializer ()
virtual | ~Serializer ()

## Protected Methods

virtual void | writeFileHeader (void)
virtual void | writeChunkHeader (unsigned short id, unsigned long size)
void | writeReals (const Real *pReal, size_t count)
void | writeShorts (const unsigned short *pShort, size_t count)
void | writeInts (const unsigned int *pInt, size_t count)
void | writeLongs (const unsigned long *pLong, size_t count)
void | writeBools (const bool *pLong, size_t count)
void | writeObject (const Vector3 &vec)
void | writeObject (const Quaternion &q)
void | writeString (const String &string)
void | writeData (const void *buf, size_t size, size_t count)
virtual void | readFileHeader (DataChunk &chunk)
virtual unsigned short | readChunk (DataChunk &chunk)
void | readBools (DataChunk &chunk, bool *pDest, size_t count)
void | readReals (DataChunk &chunk, Real *pDest, size_t count)
void | readShorts (DataChunk &chunk, unsigned short *pDest, size_t count)
void | readInts (DataChunk &chunk, unsigned int *pDest, size_t count)
void | readLongs (DataChunk &chunk, unsigned long *pDest, size_t count)
void | readObject (DataChunk &chunk, Vector3 *pDest)
void | readObject (DataChunk &chunk, Quaternion *pDest)
String | readString (DataChunk &chunk)
String | readString (DataChunk &chunk, size_t numChars)
virtual void | flipToLittleEndian (void *pData, size_t size, size_t count=1)
virtual void | flipFromLittleEndian (void *pData, size_t size, size_t count=1)
virtual void | flipEndian (void *pData, size_t size, size_t count)
virtual void | flipEndian (void *pData, size_t size)

## Protected Attributes

unsigned long | mCurrentChunkLen
FILE * | mpfFile
String | mVersion

## Detailed Description

Generic class for serialising data to / from binary chunk-based files.

Remarks:
  This class provides a number of useful methods for exporting / importing data from chunk-oriented binary files (e.g. .mesh and .skeleton).

Definition at line 39 of file OgreSerializer.h.

## Constructor & Destructor Documentation

Ogre::Serializer::Serializer | ( |  | ) |

| Definition at line 41 of file OgreSerializer.cpp. References mVersion.

Ogre::Serializer::~Serializer | ( |  | ) | `[virtual]`

| Definition at line 47 of file OgreSerializer.cpp.

## Member Function Documentation

void Ogre::Serializer::flipEndian | ( | void * | pData,
|  | size_t | size
| ) | `[protected, virtual]`

| Definition at line 310 of file OgreSerializer.cpp.

void Ogre::Serializer::flipEndian | ( | void * | pData,
|  | size_t | size,
|  | size_t | count
| ) | `[protected, virtual]`

| Definition at line 302 of file OgreSerializer.cpp. Referenced by flipFromLittleEndian(), and flipToLittleEndian().

void Ogre::Serializer::flipFromLittleEndian | ( | void * | pData,
|  | size_t | size,
|  | size_t | count = 1
| ) | `[protected, virtual]`

| Definition at line 295 of file OgreSerializer.cpp. References flipEndian(). Referenced by readInts(), readLongs(), readReals(), and readShorts().

void Ogre::Serializer::flipToLittleEndian | ( | void * | pData,
|  | size_t | size,
|  | size_t | count = 1
| ) | `[protected, virtual]`

| Definition at line 288 of file OgreSerializer.cpp. References flipEndian(). Referenced by writeInts(), writeLongs(), writeReals(), and writeShorts().

void Ogre::Serializer::readBools | ( | DataChunk & | chunk,
|  | bool * | pDest,
|  | size_t | count
| ) | `[protected]`

| Definition at line 196 of file OgreSerializer.cpp. References free, malloc, and Ogre::DataChunk::read(). Referenced by Ogre::MeshSerializerImpl::readEdgeList(), Ogre::MeshSerializerImpl::readMesh(), Ogre::MeshSerializerImpl::readMeshLodInfo(), Ogre::MeshSerializerImpl::readMeshLodUsageGenerated(), and Ogre::MeshSerializerImpl::readSubMesh().

unsigned short Ogre::Serializer::readChunk | ( | DataChunk & | chunk | ) | `[protected, virtual]`

Definition at line 187 of file OgreSerializer.cpp.

References mCurrentChunkLen, readLongs(), and readShorts().

Referenced by Ogre::MeshSerializerImpl::importMesh(), Ogre::SkeletonSerializer::importSkeleton(), Ogre::SkeletonSerializer::readAnimation(), Ogre::SkeletonSerializer::readAnimationTrack(), Ogre::MeshSerializerImpl::readEdgeList(), Ogre::MeshSerializerImpl_v1_2::readGeometry(), Ogre::MeshSerializerImpl::readGeometry(), Ogre::MeshSerializerImpl::readGeometryVertexBuffer(), Ogre::MeshSerializerImpl::readGeometryVertexDeclaration(), Ogre::MeshSerializerImpl::readMesh(), Ogre::MeshSerializerImpl::readMeshLodInfo(), Ogre::MeshSerializerImpl::readMeshLodUsageGenerated(), Ogre::MeshSerializerImpl::readMeshLodUsageManual(), Ogre::MeshSerializerImpl::readSubMesh(), and Ogre::MeshSerializerImpl::readSubMeshNameTable().

void Ogre::Serializer::readFileHeader | ( | DataChunk & | chunk | ) | `[protected, virtual]`

| Definition at line 160 of file OgreSerializer.cpp. References Except, Ogre::HEADER_CHUNK_ID, mVersion, readShorts(), readString(), and Ogre::String. Referenced by Ogre::MeshSerializerImpl::importMesh(), and Ogre::SkeletonSerializer::importSkeleton().

void Ogre::Serializer::readInts | ( | DataChunk & | chunk,
|  | unsigned int * | pDest,
|  | size_t | count
| ) | `[protected]`

Definition at line 224 of file OgreSerializer.cpp.

References flipFromLittleEndian(), and Ogre::DataChunk::read().

Referenced by Ogre::MeshSerializerImpl_v1_2::readGeometry(), Ogre::MeshSerializerImpl::readGeometry(), Ogre::MeshSerializerImpl::readMeshBoneAssignment(), Ogre::MeshSerializerImpl::readMeshLodUsageGenerated(), Ogre::MeshSerializerImpl::readSubMesh(), and Ogre::MeshSerializerImpl::readSubMeshBoneAssignment().

void Ogre::Serializer::readLongs | ( | DataChunk & | chunk,
|  | unsigned long * | pDest,
|  | size_t | count
| ) | `[protected]`

| Definition at line 230 of file OgreSerializer.cpp. References flipFromLittleEndian(), and Ogre::DataChunk::read(). Referenced by readChunk(), Ogre::MeshSerializerImpl::readEdgeList(), and Ogre::MeshSerializerImpl_v1_2::readGeometryColours().

void Ogre::Serializer::readObject | ( | DataChunk & | chunk,
|  | Quaternion * | pDest
| ) | `[protected]`

| Definition at line 278 of file OgreSerializer.cpp. References readReals(), Ogre::Quaternion::w, Ogre::Quaternion::x, Ogre::Quaternion::y, and Ogre::Quaternion::z.

void Ogre::Serializer::readObject | ( | DataChunk & | chunk,
|  | Vector3 * | pDest
| ) | `[protected]`

| Definition at line 271 of file OgreSerializer.cpp. References readReals(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z. Referenced by Ogre::SkeletonSerializer::readBone(), and Ogre::SkeletonSerializer::readKeyFrame().

void Ogre::Serializer::readReals | ( | DataChunk & | chunk,
|  | Real * | pDest,
|  | size_t | count
| ) | `[protected]`

Definition at line 212 of file OgreSerializer.cpp.

References flipFromLittleEndian(), Ogre::DataChunk::read(), and Ogre::Real.

Referenced by Ogre::SkeletonSerializer::readAnimation(), Ogre::MeshSerializerImpl::readBoundsInfo(), Ogre::MeshSerializerImpl::readEdgeList(), Ogre::MeshSerializerImpl_v1_2::readGeometryNormals(), Ogre::MeshSerializerImpl_v1_2::readGeometryPositions(), Ogre::MeshSerializerImpl_v1_1::readGeometryTexCoords(), Ogre::MeshSerializerImpl_v1_2::readGeometryTexCoords(), Ogre::SkeletonSerializer::readKeyFrame(), Ogre::MeshSerializerImpl::readMeshBoneAssignment(), Ogre::MeshSerializerImpl::readMeshLodInfo(), readObject(), and Ogre::MeshSerializerImpl::readSubMeshBoneAssignment().

void Ogre::Serializer::readShorts | ( | DataChunk & | chunk,
|  | unsigned short * | pDest,
|  | size_t | count
| ) | `[protected]`

Definition at line 218 of file OgreSerializer.cpp.

References flipFromLittleEndian(), and Ogre::DataChunk::read().

Referenced by Ogre::MeshSerializer::importMesh(), Ogre::SkeletonSerializer::readAnimationTrack(), Ogre::SkeletonSerializer::readBone(), Ogre::SkeletonSerializer::readBoneParent(), readChunk(), Ogre::MeshSerializerImpl::readEdgeList(), readFileHeader(), Ogre::MeshSerializerImpl_v1_1::readGeometryTexCoords(), Ogre::MeshSerializerImpl_v1_2::readGeometryTexCoords(), Ogre::MeshSerializerImpl::readGeometryVertexBuffer(), Ogre::MeshSerializerImpl::readGeometryVertexElement(), Ogre::MeshSerializerImpl::readMeshBoneAssignment(), Ogre::MeshSerializerImpl::readMeshLodInfo(), Ogre::MeshSerializerImpl::readMeshLodUsageGenerated(), Ogre::MeshSerializerImpl::readSubMesh(), Ogre::MeshSerializerImpl::readSubMeshBoneAssignment(), Ogre::MeshSerializerImpl::readSubMeshNameTable(), and Ogre::MeshSerializerImpl::readSubMeshOperation().

String Ogre::Serializer::readString | ( | DataChunk & | chunk,
|  | size_t | numChars
| ) | `[protected]`

| Definition at line 236 of file OgreSerializer.cpp. References Ogre::DataChunk::read(), and Ogre::String.

String Ogre::Serializer::readString | ( | DataChunk & | chunk | ) | `[protected]`

Definition at line 245 of file OgreSerializer.cpp.

References Ogre::DataChunk::readUpTo(), and Ogre::String.

Referenced by Ogre::MeshSerializer::importMesh(), Ogre::SkeletonSerializer::readAnimation(), Ogre::SkeletonSerializer::readBone(), readFileHeader(), Ogre::MeshSerializerImpl::readMeshLodUsageManual(), Ogre::MeshSerializerImpl::readSkeletonLink(), Ogre::MeshSerializerImpl::readSubMesh(), and Ogre::MeshSerializerImpl::readSubMeshNameTable().

void Ogre::Serializer::writeBools | ( | const bool * | pLong,
|  | size_t | count
| ) | `[protected]`

| Definition at line 127 of file OgreSerializer.cpp. References free, malloc, and writeData(). Referenced by Ogre::MeshSerializerImpl::writeEdgeList(), Ogre::MeshSerializerImpl::writeLodSummary(), Ogre::MeshSerializerImpl::writeLodUsageGenerated(), Ogre::MeshSerializerImpl::writeMesh(), and Ogre::MeshSerializerImpl::writeSubMesh().

void Ogre::Serializer::writeChunkHeader | ( | unsigned short | id,
|  | unsigned long | size
| ) | `[protected, virtual]`

Definition at line 61 of file OgreSerializer.cpp.

References writeLongs(), and writeShorts().

Referenced by Ogre::SkeletonSerializer::writeAnimation(), Ogre::SkeletonSerializer::writeAnimationTrack(), Ogre::SkeletonSerializer::writeBone(), Ogre::SkeletonSerializer::writeBoneParent(), Ogre::MeshSerializerImpl::writeBoundsInfo(), Ogre::MeshSerializerImpl::writeEdgeList(), Ogre::MeshSerializerImpl::writeGeometry(), Ogre::SkeletonSerializer::writeKeyFrame(), Ogre::MeshSerializerImpl::writeLodSummary(), Ogre::MeshSerializerImpl::writeLodUsageGenerated(), Ogre::MeshSerializerImpl::writeLodUsageManual(), Ogre::MeshSerializerImpl::writeMesh(), Ogre::MeshSerializerImpl::writeMeshBoneAssignment(), Ogre::MeshSerializerImpl::writeSkeletonLink(), Ogre::MeshSerializerImpl::writeSubMesh(), Ogre::MeshSerializerImpl::writeSubMeshBoneAssignment(), Ogre::MeshSerializerImpl::writeSubMeshNameTable(), and Ogre::MeshSerializerImpl::writeSubMeshOperation().

void Ogre::Serializer::writeData | ( | const void * | buf,
|  | size_t | size,
|  | size_t | count
| ) | `[protected]`

| Definition at line 148 of file OgreSerializer.cpp. References mpfFile. Referenced by writeBools(), Ogre::MeshSerializerImpl::writeGeometry(), writeInts(), writeLongs(), writeReals(), and writeShorts().

void Ogre::Serializer::writeFileHeader | ( | void |  | ) | `[protected, virtual]`

| Definition at line 51 of file OgreSerializer.cpp. References Ogre::HEADER_CHUNK_ID, mVersion, writeShorts(), and writeString(). Referenced by Ogre::MeshSerializerImpl::exportMesh(), and Ogre::SkeletonSerializer::exportSkeleton().

void Ogre::Serializer::writeInts | ( | const unsigned int * | pInt,
|  | size_t | count
| ) | `[protected]`

| Definition at line 97 of file OgreSerializer.cpp. References flipToLittleEndian(), free, malloc, and writeData(). Referenced by Ogre::MeshSerializerImpl::writeGeometry(), Ogre::MeshSerializerImpl::writeLodUsageGenerated(), Ogre::MeshSerializerImpl::writeMeshBoneAssignment(), Ogre::MeshSerializerImpl::writeSubMesh(), and Ogre::MeshSerializerImpl::writeSubMeshBoneAssignment().

void Ogre::Serializer::writeLongs | ( | const unsigned long * | pLong,
|  | size_t | count
| ) | `[protected]`

| Definition at line 112 of file OgreSerializer.cpp. References flipToLittleEndian(), free, malloc, and writeData(). Referenced by writeChunkHeader(), and Ogre::MeshSerializerImpl::writeEdgeList().

void Ogre::Serializer::writeObject | ( | const Quaternion & | q | ) | `[protected]`

| Definition at line 263 of file OgreSerializer.cpp. References Ogre::Quaternion::w, writeReals(), Ogre::Quaternion::x, Ogre::Quaternion::y, and Ogre::Quaternion::z.

void Ogre::Serializer::writeObject | ( | const Vector3 & | vec | ) | `[protected]`

| Definition at line 255 of file OgreSerializer.cpp. References writeReals(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z. Referenced by Ogre::SkeletonSerializer::writeBone(), and Ogre::SkeletonSerializer::writeKeyFrame().

void Ogre::Serializer::writeReals | ( | const Real * | pReal,
|  | size_t | count
| ) | `[protected]`

Definition at line 67 of file OgreSerializer.cpp.

References flipToLittleEndian(), free, malloc, Ogre::Real, and writeData().

Referenced by Ogre::SkeletonSerializer::writeAnimation(), Ogre::MeshSerializerImpl::writeBoundsInfo(), Ogre::MeshSerializerImpl::writeEdgeList(), Ogre::SkeletonSerializer::writeKeyFrame(), Ogre::MeshSerializerImpl::writeLodUsageGenerated(), Ogre::MeshSerializerImpl::writeLodUsageManual(), Ogre::MeshSerializerImpl::writeMeshBoneAssignment(), writeObject(), and Ogre::MeshSerializerImpl::writeSubMeshBoneAssignment().

void Ogre::Serializer::writeShorts | ( | const unsigned short * | pShort,
|  | size_t | count
| ) | `[protected]`

Definition at line 82 of file OgreSerializer.cpp.

References flipToLittleEndian(), free, malloc, and writeData().

Referenced by Ogre::SkeletonSerializer::writeAnimationTrack(), Ogre::SkeletonSerializer::writeBone(), Ogre::SkeletonSerializer::writeBoneParent(), writeChunkHeader(), Ogre::MeshSerializerImpl::writeEdgeList(), writeFileHeader(), Ogre::MeshSerializerImpl::writeGeometry(), Ogre::MeshSerializerImpl::writeLodSummary(), Ogre::MeshSerializerImpl::writeLodUsageGenerated(), Ogre::MeshSerializerImpl::writeMeshBoneAssignment(), Ogre::MeshSerializerImpl::writeSubMesh(), Ogre::MeshSerializerImpl::writeSubMeshBoneAssignment(), Ogre::MeshSerializerImpl::writeSubMeshNameTable(), and Ogre::MeshSerializerImpl::writeSubMeshOperation().

void Ogre::Serializer::writeString | ( | const String & | string | ) | `[protected]`

| Definition at line 153 of file OgreSerializer.cpp. References mpfFile, and Ogre::String. Referenced by Ogre::SkeletonSerializer::writeAnimation(), Ogre::SkeletonSerializer::writeBone(), writeFileHeader(), Ogre::MeshSerializerImpl::writeLodUsageManual(), Ogre::MeshSerializerImpl::writeSkeletonLink(), Ogre::MeshSerializerImpl::writeSubMesh(), and Ogre::MeshSerializerImpl::writeSubMeshNameTable().

## Member Data Documentation

unsigned long Ogre::Serializer::mCurrentChunkLen`[protected]`

| Definition at line 48 of file OgreSerializer.h. Referenced by readChunk(), Ogre::SkeletonSerializer::readKeyFrame(), and Ogre::MeshSerializerImpl::readMesh().

FILE* Ogre::Serializer::mpfFile`[protected]`

| Definition at line 49 of file OgreSerializer.h. Referenced by Ogre::MeshSerializerImpl::exportMesh(), Ogre::SkeletonSerializer::exportSkeleton(), writeData(), and writeString().

String Ogre::Serializer::mVersion`[protected]`

| Definition at line 50 of file OgreSerializer.h. Referenced by Ogre::MeshSerializerImpl::MeshSerializerImpl(), Ogre::MeshSerializerImpl_v1_1::MeshSerializerImpl_v1_1(), Ogre::MeshSerializerImpl_v1_2::MeshSerializerImpl_v1_2(), readFileHeader(), Serializer(), Ogre::SkeletonSerializer::SkeletonSerializer(), and writeFileHeader().

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

- OgreSerializer.h
- OgreSerializer.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:51:38 2004