#include <access.h>
Public Member Functions | |
CAccess () | |
virtual | ~CAccess () |
Static Public Member Functions | |
static bool | extractSerializationData (std::vector< unsigned char > &buffer, int dataName, std::vector< unsigned char > &data) |
static int | getDataLocationAndSize (const std::vector< unsigned char > &buffer, int dataName, int &theSize) |
static void | insertSerializationData (std::vector< unsigned char > &buffer, int dataName, const std::vector< unsigned char > &data) |
static float | pop_float (std::vector< unsigned char > &buffer) |
static int | pop_int (std::vector< unsigned char > &buffer) |
static void | push_float (std::vector< unsigned char > &buffer, float data) |
static void | push_int (std::vector< unsigned char > &buffer, int data) |
This class contains helper functions to insert/extract items to/from scene objects. It assumes that the developer stores data under the DEVELOPER_HEADER in the form: item1ID,item1DataLengthInBytes,item1Data,item2ID,item2DataLengthInBytes,item2Data, etc.
CAccess::CAccess | ( | ) |
Definition at line 13 of file access.cpp.
CAccess::~CAccess | ( | ) | [virtual] |
Definition at line 16 of file access.cpp.
bool CAccess::extractSerializationData | ( | std::vector< unsigned char > & | buffer, |
int | dataName, | ||
std::vector< unsigned char > & | data | ||
) | [static] |
Extracts the data saved under the dataName
item. Note that the data is erased from the input data buffer
.
buffer | The buffer from which the data must be extracted. |
dataName | The ID of the data to be extracted (must be in CustomDataHeaders). |
data | The extracted data value. |
Definition at line 47 of file access.cpp.
int CAccess::getDataLocationAndSize | ( | const std::vector< unsigned char > & | buffer, |
int | dataName, | ||
int & | theSize | ||
) | [static] |
Returns the location and size of the specified field in the custom data.
buffer | Vector containing the custom data. |
dataName | The ID of the required data (must be in CustomDataHeaders). |
theSize | The size of the specified field. |
buffer
. Definition at line 19 of file access.cpp.
void CAccess::insertSerializationData | ( | std::vector< unsigned char > & | buffer, |
int | dataName, | ||
const std::vector< unsigned char > & | data | ||
) | [static] |
Inserts data under the dataName
item.
buffer | The buffer in which the data must be inserted. |
dataName | The ID of the data to be inserted (must be in CustomDataHeaders). |
data | The data value. |
Definition at line 63 of file access.cpp.
float CAccess::pop_float | ( | std::vector< unsigned char > & | buffer | ) | [static] |
Extract a float from the custom data. Returns 0 if the buffer
is smaller than sizeof(float). If the buffer is larger than sizeof(float) only the last sizeof(float) bytes are considered.
buffer | The custom data. |
Definition at line 127 of file access.cpp.
int CAccess::pop_int | ( | std::vector< unsigned char > & | buffer | ) | [static] |
Extract an integer from the custom data. Returns 0 if the buffer
is smaller than sizeof(int). If the buffer is larger than sizeof(int) only the last sizeof(int) bytes are considered.
buffer | The custom data. |
Definition at line 108 of file access.cpp.
void CAccess::push_float | ( | std::vector< unsigned char > & | buffer, |
float | data | ||
) | [static] |
Insert a float in the custom data.
buffer | The custom data. |
data | The float to be inserted. |
Definition at line 101 of file access.cpp.
void CAccess::push_int | ( | std::vector< unsigned char > & | buffer, |
int | data | ||
) | [static] |
Insert an integer in the custom data.
buffer | The custom data. |
data | The integer to be inserted. |
Definition at line 94 of file access.cpp.