GL Studio C++ Runtime API
|
#include <gls_glo_file.h>
Public Member Functions | |
Writer (const std::string &filename, const bool open, const unsigned char *timestamp) | |
std::string | Filename () |
std::string | BaseFilename () |
unsigned char * | Timestamp () |
void | OpenForWriting () |
Open file and prepare to write. | |
void | DefaultChecking (bool val) |
void | StartObjectRecord () |
Start writing an object record. | |
void | AddObjectAttribute (const unsigned int enumeration, const unsigned int size, const void *data) |
void | AddBoolean (const unsigned int enumerator, const bool value) |
void | AddU8 (const unsigned int enumerator, const unsigned char value) |
void | AddU16 (const unsigned int enumerator, const unsigned short value) |
void | AddS16 (const unsigned int enumerator, const short value) |
void | AddU32 (const unsigned int enumerator, const unsigned int value) |
void | AddS32 (const unsigned int enumerator, const int value) |
void | AddString (const unsigned int enumerator, const std::string &value) |
void | AddCString (const unsigned int enumerator, const char *value) |
void | AddFloat (const unsigned int enumerator, const float value) |
void | AddDouble (const unsigned int enumerator, const double value) |
void | AddVector (const unsigned int enumerator, const Vector &value) |
void | AddGlsColor (const unsigned int enumerator, const glsColor &value) |
void | AddMatrix (const unsigned int enumerator, const GlsMatrixAffineD &value) |
void | AddVertexArray (const unsigned int enumerator, const unsigned int nVertices, const Vertex verts[]) |
void | AddVectorArray (const unsigned int enumerator, const unsigned int nVertices, const Vector verts[]) |
void | AddFloatArray (const unsigned int enumerator, const unsigned int nVertices, const float verts[]) |
void | AddDoubleArray (const unsigned int enumerator, const unsigned int nVertices, const double verts[]) |
void | AddMaterialIndices (const unsigned int enumerator, DynamicArray< int > &values) |
void | AddVector2DArray (const unsigned int enumerator, const unsigned int nVertices, const Vector verts[]) |
unsigned int | AddExtendedAttributeHeader (unsigned int enumerator, unsigned int size=0) |
unsigned int | AddAttributeHeader (unsigned int enumerator, unsigned char size=0) |
void | AddBoolean (const unsigned int enumerator, const bool value, const bool defVal) |
void | AddU8 (const unsigned int enumerator, const unsigned char value, const unsigned char defVal) |
void | AddU16 (const unsigned int enumerator, const unsigned short value, const unsigned short defVal) |
void | AddS16 (const unsigned int enumerator, const short value, const short defVal) |
void | AddU32 (const unsigned int enumerator, const unsigned int value, const unsigned int defVal) |
void | AddS32 (const unsigned int enumerator, const int value, const int defVal) |
void | AddGlsColor (const unsigned int enumerator, const glsColor &value, const glsColor &defVal) |
void | AddFloat (const unsigned int enumerator, const float value, const float defVal) |
void | AddDouble (const unsigned int enumerator, const double value, const double defVal) |
void | WriteU8 (const unsigned char val) |
void | WriteS8 (const char val) |
void | WriteU16 (const unsigned short val) |
void | WriteS16 (const short val) |
void | WriteU32 (const unsigned int val) |
void | WriteS32 (const int val) |
void | WriteFloat (const float val) |
void | WriteDouble (const double val) |
void | WriteGlsColor (const glsColor &value) |
void | WriteU8 (const unsigned char val, const unsigned int offset) |
void | WriteU32 (const unsigned int val, const unsigned int offset) |
void | AddMatrix (const unsigned int enumerator, const GlsMatrixAffineD &value, const bool checkForIdentity) |
void | EndObjectRecord () |
End the current object record. | |
void | Flush () |
Flush the current buffer to disk and rewind. | |
void | Close () |
Close the file. | |
Protected Member Functions | |
void | WriteFileHeader () |
Writes the file header data to the GLO file. | |
Protected Attributes | |
std::string | _filename |
The file name of the GLO file to write. | |
bool | _initialized |
If true, the file is ready for writing. | |
FILE * | _out |
The OS file handle to the file to be written. | |
bool | _defaultChecking |
If true, will not write values to file that match default values. | |
unsigned char | _timestamp [GLO_FILE_TIMESTAMP_SIZE] |
Storage for the file generation timestamp. | |
GloFileHeader | _header |
File header information to be written to the file. | |
unsigned int | _numObjects |
Current count of the number of objects in the file. | |
short | _numParams |
Current count of the number of params in the current object. | |
WriteBuffer * | _buffer |
Byte buffer to store params in. | |
The Writer class. Handles output of GLS property values to the GLO file format.
Writer | ( | const std::string & | filename, |
const bool | open, | ||
const unsigned char * | timestamp | ||
) |
Create a GLO file writer for the given file
filename | The filename to write the GLO file to. |
open | If true, open the file on construction. |
timestamp | The timestamp to write to the file. |
unsigned int AddAttributeHeader | ( | unsigned int | enumerator, |
unsigned char | size = 0 |
||
) |
Write a standard header to the GLO file.
enumerator | The identifier for this attribute. |
size | The size of this attribute. |
void AddBoolean | ( | const unsigned int | enumerator, |
const bool | value | ||
) |
Write a boolean value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddBoolean | ( | const unsigned int | enumerator, |
const bool | value, | ||
const bool | defVal | ||
) |
Same as AddBoolean(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddCString | ( | const unsigned int | enumerator, |
const char * | value | ||
) |
Write a C string value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddDouble | ( | const unsigned int | enumerator, |
const double | value | ||
) |
Write a double value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddDouble | ( | const unsigned int | enumerator, |
const double | value, | ||
const double | defVal | ||
) |
Same as AddDouble(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddDoubleArray | ( | const unsigned int | enumerator, |
const unsigned int | nVertices, | ||
const double | verts[] | ||
) |
Write a list of doubles to the GLO file.
enumerator | The identifier for this attribute. |
nVertices | The number of doubles to write. |
verts | A list containing the doubles to write. |
unsigned int AddExtendedAttributeHeader | ( | unsigned int | enumerator, |
unsigned int | size = 0 |
||
) |
Use these to write custom data structures to the file. Can write structures larger than 255 bytes to the GLO file.
enumerator | The identifier for this attribute. |
size | The size of this attribute. |
void AddFloat | ( | const unsigned int | enumerator, |
const float | value | ||
) |
Write a float value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddFloat | ( | const unsigned int | enumerator, |
const float | value, | ||
const float | defVal | ||
) |
Same as AddFloat(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddFloatArray | ( | const unsigned int | enumerator, |
const unsigned int | nVertices, | ||
const float | verts[] | ||
) |
Write a list of floats to the GLO file.
enumerator | the identifier for this attribute |
nVertices | the number of floats to write |
verts | a list containing the floats to write |
void AddGlsColor | ( | const unsigned int | enumerator, |
const glsColor & | value | ||
) |
Write a color value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
Same as AddGlsColor(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddMaterialIndices | ( | const unsigned int | enumerator, |
DynamicArray< int > & | values | ||
) |
Write a list of material indices to the GLO file.
enumerator | The identifier for this attribute. |
values | The material indices list to write. |
void AddMatrix | ( | const unsigned int | enumerator, |
const GlsMatrixAffineD & | value | ||
) |
Write a 4x4 matrix value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddMatrix | ( | const unsigned int | enumerator, |
const GlsMatrixAffineD & | value, | ||
const bool | checkForIdentity | ||
) |
Method to add matrix, but only if it isn't identity.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
checkForIdentity | If true, will check for identify before writing to file. |
void AddObjectAttribute | ( | const unsigned int | enumeration, |
const unsigned int | size, | ||
const void * | data | ||
) |
Add an object attribute to the file for the current object.
enumeration | Identifier for this attribute. |
size | The size to be written in bytes. |
data | The data to be written. |
void AddS16 | ( | const unsigned int | enumerator, |
const short | value | ||
) |
Write a signed 16 bit value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddS16 | ( | const unsigned int | enumerator, |
const short | value, | ||
const short | defVal | ||
) |
Same as AddS16(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddS32 | ( | const unsigned int | enumerator, |
const int | value | ||
) |
Write a signed 32 bit value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddS32 | ( | const unsigned int | enumerator, |
const int | value, | ||
const int | defVal | ||
) |
Same as AddS32(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddString | ( | const unsigned int | enumerator, |
const std::string & | value | ||
) |
Write a std::string value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddU16 | ( | const unsigned int | enumerator, |
const unsigned short | value | ||
) |
Write an unsigned 16 bit value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddU16 | ( | const unsigned int | enumerator, |
const unsigned short | value, | ||
const unsigned short | defVal | ||
) |
Same as AddU16(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddU32 | ( | const unsigned int | enumerator, |
const unsigned int | value | ||
) |
Write an unsigned 32 bit value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddU32 | ( | const unsigned int | enumerator, |
const unsigned int | value, | ||
const unsigned int | defVal | ||
) |
Same as AddU32(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddU8 | ( | const unsigned int | enumerator, |
const unsigned char | value | ||
) |
Write an unsigned 8 bit value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddU8 | ( | const unsigned int | enumerator, |
const unsigned char | value, | ||
const unsigned char | defVal | ||
) |
Same as AddU8(), but check against the default value, unless _defaultChecking is false. If the value matches the default value, it will not be written to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
defVal | The default value for this attribute. |
void AddVector | ( | const unsigned int | enumerator, |
const Vector & | value | ||
) |
Write a Vector value to the GLO file.
enumerator | The identifier for this attribute. |
value | The value for this attribute. |
void AddVector2DArray | ( | const unsigned int | enumerator, |
const unsigned int | nVertices, | ||
const Vector | verts[] | ||
) |
Same as AddVectorArray but only writes X & Y coordinates
enumerator | The identifier for this attribute. |
nVertices | The number of vectors to write. |
verts | A list containing the vectors to write. |
void AddVectorArray | ( | const unsigned int | enumerator, |
const unsigned int | nVertices, | ||
const Vector | verts[] | ||
) |
Write a list of vectors to the GLO file.
enumerator | The identifier for this attribute. |
nVertices | The number of vectors to write. |
verts | A list containing the vectors to write. |
void AddVertexArray | ( | const unsigned int | enumerator, |
const unsigned int | nVertices, | ||
const Vertex | verts[] | ||
) |
Write a list of vertices to the GLO file.
enumerator | The identifier for this attribute. |
nVertices | The number of vertices to write. |
verts | A list containing the vertices to write. |
std::string BaseFilename | ( | ) |
|
inline |
If true, values will be written to the GLO file only if they are different from the default value.
val | The new default checking flag to set. |
std::string Filename | ( | ) |
|
inline |
void WriteDouble | ( | const double | val | ) |
Write a double value directly to the GLO file.
val | The value to write. |
void WriteFloat | ( | const float | val | ) |
Write a float value directly to the GLO file.
val | The value to write. |
void WriteGlsColor | ( | const glsColor & | value | ) |
Write a color value directly to the GLO file.
value | The value to write. |
void WriteS16 | ( | const short | val | ) |
Write a signed 16 bit value directly to the GLO file.
val | The value to write. |
void WriteS32 | ( | const int | val | ) |
Write a signed 32 bit value directly to the GLO file.
val | The value to write. |
void WriteS8 | ( | const char | val | ) |
Write a signed 8 bit value directly to the GLO file.
val | The value to write. |
void WriteU16 | ( | const unsigned short | val | ) |
Write an unsigned 16 bit value directly to the GLO file.
val | The value to write. |
void WriteU32 | ( | const unsigned int | val | ) |
Write an unsigned 32 bit value directly to the GLO file.
val | The value to write. |
void WriteU32 | ( | const unsigned int | val, |
const unsigned int | offset | ||
) |
Write an unsigned 8 bit value directly to the GLO file. Writes at the specified offset into the file.
val | The value to write. |
offset | The offset at which to write the value. |
void WriteU8 | ( | const unsigned char | val | ) |
Write an unsigned 8 bit value directly to the GLO file.
val | The value to write. |
void WriteU8 | ( | const unsigned char | val, |
const unsigned int | offset | ||
) |
Write an unsigned 8 bit value directly to the GLO file. Writes at the specified offset into the file.
val | The value to write. |
offset | The offset at which to write the value. |