RSTT: util::DataBuffer Class Reference

RSTT 3.1.0 Regional Seismic Travel Time

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
util::DataBuffer Class Reference

A byte array container used to hold binary data in the same manner as disk based file system. More...

`#include <DataBuffer.h>`

## Public Member Functions
| DataBuffer ()
| DataBuffer (bool doPad)
| DataBuffer (string *str)
| DataBuffer (const DataBuffer &db)
virtual | ~DataBuffer ()
DataBuffer & | operator= (const DataBuffer &db)
void | dumpBuffer ()
void | writeToFile (ofstream &ofs)
void | writeToFile (fstream &ofs)
void | readFromFile (fstream &ifs, int num_bytes)
void | readFromFile (ifstream &ifs, int num_bytes)
void | readFromFile (fstream &ifs, int64 filePos, int num_bytes)
void | readFromFile (ifstream &ifs, int64 filePos, int num_bytes)
const string & | readMD5HashKey ()
string | generateMD5HashKey ()
string | generateDataBufMD5HashKey ()
void | align4Byte ()
| Aligns the DataBuffer position pointer on a 4 byte boundary if it is not currently aligned as such. More...
void | align8Byte ()
| Aligns the DataBuffer position pointer on an 8 byte boundary if it is not currently aligned as such. More...
void | checkBufferSize (int sincr)
| Checks the current buffer storage size and increments to see if it can contain sincr more bytes. If not it increments the size so that sincr bytes can be added safely. More...
void | clear ()
| Clear the DataBuffer. More...
const string & | readString ()
| Read a string and return a reference to be assigned to another string in the client. This function assumes the length of the string occurs imediately before the actual string data. More...
void | readString (string &str, int num_chars)
| Read num_chars from 'this' databuffer into the input string, str. More...
void | readCharArray (char *array, int num_chars)
| Read num_chars characters from 'this' DataBuffer into /em array. More...
uByte | readByte ()
| Read a byte from the buffer and update the iterator. More...
uByte | readByte (int pos)
| Read a byte from the positions specified by pos ... doesn't update dbDataPos. More...
void | readByteArray (uByte *array, int num_bytes)
| Read num_bytes characters from 'this' DataBuffer into array. More...
bool | readBool ()
| Read a bool from the buffer and update the iterator. More...
bool | readBool (int pos)
| Read a bool from the positions specified by pos ... doesn't update dbDataPos. More...
void | readBoolArray (bool *array, int num_bools)
| Read num_bools booleans from 'this' DataBuffer into array. More...
int | readInt32 ()
| Read an int from the buffer. Make sure the buffer is 4byte alligned before reading. More...
int | readInt32 (int pos)
| Read the int from the positions specified by pos ... doesn't update dbDataPos. More...
int | readRawInt32 ()
| Read an Int32 ... don't check for alignment ... fast but client is responsible for alignment. More...
void | readIntArray (int *array, int num_ints)
| Read num_ints integers from 'this' DataBuffer into array. More...
int64 | readInt64 ()
| Read a long from the buffer. Make sure the buffer is 8byte alligned before reading. More...
int64 | readInt64 (int pos)
| Read the long from the positions specified by pos ... doesn't update dbDataPos. More...
int64 | readRawInt64 ()
| Read a long ... don't check for alignment ... fast but client is responsible for alignment. More...
void | readLongArray (int64 *array, int num_longs)
| Read num_longs int64s from 'this' DataBuffer into array. More...
float | readFloat ()
| Read a float from the buffer. Make sure the buffer is 4byte alligned before reading. More...
float | readFloat (int pos)
| Read the float from the positions specified by pos ... doesn't update dbDataPos. More...
float | readRawFloat ()
| Read a float ... don't check for alignment ... fast but client is responsible for alignment. More...
void | readFloatArray (float *array, int num_floats)
| Read num_floats floats from 'this' DataBuffer into array. More...
double | readDouble ()
| Read a double from the buffer. Make sure the buffer is 8byte alligned before reading. More...
double | readDouble (int pos)
| Just read the double from the positions specified by pos ... doesn't update dbDataPos. More...
double | readRawDouble ()
| Read a double ... don't check for alignment ... fast but client is responsible for alignment. More...
void | readDoubleArray (double *array, int num_doubles)
| Read num_doubles doubles from 'this' DataBuffer into array. More...
void | writeString (const string &in_string)
| Write the string in_string into 'this' DataBuffer. More...
void | writeString (char *char_string)
| Write the string char_string into 'this' DataBuffer. More...
void | writeCharArray (const char *array, int num_chars)
| Write num_chars of the character array into 'this' DataBuffer. More...
void | writeByte (uByte b)
| Write a byte (b) to the DataBuffer. Make sure the buffer is sized appropriately before writing. More...
void | writeByte (uByte b, int pos)
| Write a uByte (b) at databuffer position pos. Does not update the iterator. More...
void | writeRawByte (uByte b)
| Write a uByte (b) ... don't check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly. More...
void | writeByteArray (const uByte *array, int num_bytes)
| Write num_bytes uBytes from the input array into 'this' DataBuffer. More...
void | writeBool (bool b)
| Write a bool (b) to the DataBuffer. Make sure the buffer is sized appropriately before writing. More...
void | writeBool (bool b, int pos)
| Write a bool (b) at databuffer position pos. Does not update the iterator. More...
void | writeRawBool (bool b)
| Write a bool (b) ... do not check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly. More...
void | writeBoolArray (const bool *array, int num_bools)
| Write num_bools bools from the input array into 'this' DataBuffer. More...
void | writeInt32 (int i)
| Write an Int32 (i) to the DataBuffer. Make sure the buffer is 4byte alligned and sized appropriatly before reading. More...
void | writeInt32 (int i, int pos)
| Write an int (i) at databuffer position pos. Do not update the iterator. More...
void | writeRawInt32 (int i)
| Write an Int32 (i) ... do not check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly. More...
void | writeIntArray (const int *array, int num_ints)
| Write num_ints ints from the input array into 'this' DataBuffer. More...
void | writeInt64 (int64 i)
| Write an Int64 (i) to the DataBuffer. Make sure the buffer is 8byte alligned and sized appropriatly before reading. More...
void | writeInt64 (int64 i, int pos)
| Write a long (i) at databuffer position pos. Does not update the iterator. More...
void | writeRawInt64 (int64 i)
| Write an Int64 (i) ... don't check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly. More...
void | writeLongArray (const int64 *array, int num_longs)
| Write num_longs longs from the input array into 'this' DataBuffer. More...
void | writeFloat (float f)
| Write a float (f) to the DataBuffer. Make sure the buffer is 4byte alligned and sized appropriatly before reading. More...
void | writeFloat (float f, int pos)
| Write a float (f) at databuffer position pos. Does not update the iterator. More...
void | writeRawFloat (float f)
| Write a float (f) ... do not check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly. More...
void | writeFloatArray (const float *array, int num_floats)
| Write num_floats floats from the input array into 'this' DataBuffer. More...
void | writeDouble (double d)
| Write a double (d) to the DataBuffer. Make sure the buffer is 8byte alligned and sized appropriatly before reading. More...
void | writeDouble (double d, int pos)
| Write a double (d) at databuffer position pos. Does not update the iterator. More...
void | writeRawDouble (double d)
| Write a double (d) ... do not check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly. More...
void | writeDoubleArray (const double *array, int num_doubles)
| Write num_doubles doubles from the input array into 'this' DataBuffer. More...
virtual string | get_class_name () const
| Returns the class name. More...
virtual int | class_size () const
| Returns the class size (in bytes). More...
void | setSize (int num_bytes)
| Set the size of the data buffer to num_bytes. More...
int | size ()
| Return the current DataBuffer size. More...
void | resetPos ()
| Reset the buffers iterator location to zero. More...
void | setPosToEnd ()
| Set the buffers iterator position to dbSize. If current iterator exceeds dbsize then dbsize is set and dbDataPos is unchanged. More...
int | getPos () const
| Return the buffers iterator location. More...
void | incrementPos (int increment)
| Increment the buffers iterator by increment bytes. This is an unsafe operation. If dbDataPos + increment > dbSize. dbSize is NOT checked. More...
void | decrementPos (int decrement)
| Decrement the buffers iterator by decrement bytes. This is an unsafe operation. If dbDataPos - decrement < 0. More...
string | getData () const
| Return a reference to the DataBuffer. More...
int | getCapacity () const
| Return allocated capacity of 'this' DataBuffer. More...
char * | getPosPointer ()
| Return a pointer to the current iterator location in the buffer. More...
char * | getPosPointer (int pos)
| Return a Pointer to position pos in the buffer. More...
void | setByteOrderReverse (bool bor)
| Sets the byte order reverse flag to bor. More...
void | byteOrderReverseOn ()
| Sets the byte order reverse flag to true. More...
void | byteOrderReverseOff ()
| Sets the byte order reverse flag to false. More...
bool | isByteOrderReversed () const
| Returns true if the byte order in reads and writes is reversed for all 2, 4, or 8 byte intrinsincs (short, int, long, float, double, etc.). More...
void | reserve (int sze)
| brief Reserves space in the DataBuffer More...

## Static Public Member Functions
static void | reverseBOArray (int n, char *a, int s)
static void | reverseBO2Array (int n, char *a)
static void | reverseBO4Array (int n, char *a)
static void | reverseBO8Array (int n, char *a)
static void | reverseBO2 (char *d)
| Reverses byte order of d. d is assumed to point to an 2 byte element. More...
static void | reverseBO4 (char *d)
| Reverses byte order of d. d is assumed to point to an 4 byte element. More...
static void | reverseBO8 (char *d)
| Reverses byte order of d. d is assumed to point to an 8 byte element. More...
static string | class_name ()
| Static function that returns the class name. More...
static int | getAllocationReqSize ()

## Static Public Attributes
static const int | ALLOCATION_REQ_SIZE
| Default allocation requirement size for a data buffer. More...

## Protected Attributes
string * | dbData
| A string object is used to contain the actual data. More...
int | dbDataPos
| The current iterator position in the data container (dbData). More...
int | dbSize
| The current size of the data container. More...
bool | dbPad
| A boolean, that if true, maintains 4 and 8 byte alignment in support of double alignment compilation. More...
bool | dbReverse
| A boolean, that if true, reverses the byte order of all 2, 4, and 8 byte intrinsics (shorts, ints, long, floats, doubles, etc.). This flag is set by the FileDatabase object only and otherwise defaults to false. The flag is used to convert byte order between big- and little- endian formats. More...
bool | dbOwnStr
| A boolean, that if true, indicates the storage string for this DataBuffer is owned and therefore deleted when the DataBuffer is deleted. More...

## Detailed Description

A byte array container used to hold binary data in the same manner as disk based file system.

The object contains a padding facility to maintain 1, 4, and 8 byte aligned objects so that the objects that utilize this class can be compiled as doubly aligned. This object is used extensively in support of database object serialization. The class contains a long list of methods and properties supporting read/write capability for string, char, byte, bool, int, long, float, and double types. Most types also contain an array read/write capability. Finally, the ability to read and write compressed data is provided using the zlib library facility.

Definition at line 80 of file DataBuffer.h.

## Constructor & Destructor Documentation

## ◆ DataBuffer() [1/4]

util::DataBuffer::DataBuffer | ( |  | ) |

## ◆ DataBuffer() [2/4]

util::DataBuffer::DataBuffer | ( | bool | doPad | ) |

## ◆ DataBuffer() [3/4]

util::DataBuffer::DataBuffer | ( | string * | str | ) |

## ◆ DataBuffer() [4/4]

util::DataBuffer::DataBuffer | ( | const DataBuffer & | db | ) |

## ◆ ~DataBuffer()

virtual util::DataBuffer::~DataBuffer | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ align4Byte()

void util::DataBuffer::align4Byte | ( |  | ) |
| inline

Aligns the DataBuffer position pointer on a 4 byte boundary if it is not currently aligned as such.

Definition at line 437 of file DataBuffer.h.

## ◆ align8Byte()

void util::DataBuffer::align8Byte | ( |  | ) |
| inline

Aligns the DataBuffer position pointer on an 8 byte boundary if it is not currently aligned as such.

Definition at line 454 of file DataBuffer.h.

## ◆ byteOrderReverseOff()

void util::DataBuffer::byteOrderReverseOff | ( |  | ) |
| inline

Sets the byte order reverse flag to false.

Definition at line 1596 of file DataBuffer.h.

## ◆ byteOrderReverseOn()

void util::DataBuffer::byteOrderReverseOn | ( |  | ) |
| inline

Sets the byte order reverse flag to true.

Definition at line 1586 of file DataBuffer.h.

## ◆ checkBufferSize()

void util::DataBuffer::checkBufferSize | ( | int | sincr | ) |
| inline

Checks the current buffer storage size and increments to see if it can contain sincr more bytes. If not it increments the size so that sincr bytes can be added safely.

Definition at line 472 of file DataBuffer.h.

## ◆ class_name()

string util::DataBuffer::class_name | ( |  | ) |
| inlinestatic

Static function that returns the class name.

Definition at line 406 of file DataBuffer.h.

## ◆ class_size()

int util::DataBuffer::class_size | ( |  | ) | const
| inlinevirtual

Returns the class size (in bytes).

Definition at line 426 of file DataBuffer.h.

## ◆ clear()

void util::DataBuffer::clear | ( |  | ) |
| inline

Clear the DataBuffer.

Definition at line 486 of file DataBuffer.h.

## ◆ decrementPos()

void util::DataBuffer::decrementPos | ( | int | decrement | ) |
| inline

Decrement the buffers iterator by decrement bytes. This is an unsafe operation. If dbDataPos - decrement < 0.

Definition at line 1472 of file DataBuffer.h.

## ◆ dumpBuffer()

void util::DataBuffer::dumpBuffer | ( |  | ) |

## ◆ generateDataBufMD5HashKey()

string util::DataBuffer::generateDataBufMD5HashKey | ( |  | ) |

## ◆ generateMD5HashKey()

string util::DataBuffer::generateMD5HashKey | ( |  | ) |

## ◆ get_class_name()

string util::DataBuffer::get_class_name | ( |  | ) | const
| inlinevirtual

Returns the class name.

Definition at line 416 of file DataBuffer.h.

## ◆ getAllocationReqSize()

static int util::DataBuffer::getAllocationReqSize | ( |  | ) |
| static

## ◆ getCapacity()

int util::DataBuffer::getCapacity | ( |  | ) | const
| inline

Return allocated capacity of 'this' DataBuffer.

Definition at line 1492 of file DataBuffer.h.

## ◆ getData()

string util::DataBuffer::getData | ( |  | ) | const
| inline

Return a reference to the DataBuffer.

Definition at line 1482 of file DataBuffer.h.

## ◆ getPos()

int util::DataBuffer::getPos | ( |  | ) | const
| inline

Return the buffers iterator location.

Definition at line 1449 of file DataBuffer.h.

## ◆ getPosPointer() [1/2]

char * util::DataBuffer::getPosPointer | ( |  | ) |
| inline

Return a pointer to the current iterator location in the buffer.

Definition at line 1502 of file DataBuffer.h.

## ◆ getPosPointer() [2/2]

char * util::DataBuffer::getPosPointer | ( | int | pos | ) |
| inline

Return a Pointer to position pos in the buffer.

Definition at line 1513 of file DataBuffer.h.

## ◆ incrementPos()

void util::DataBuffer::incrementPos | ( | int | increment | ) |
| inline

Increment the buffers iterator by increment bytes. This is an unsafe operation. If dbDataPos + increment > dbSize. dbSize is NOT checked.

Definition at line 1461 of file DataBuffer.h.

## ◆ isByteOrderReversed()

bool util::DataBuffer::isByteOrderReversed | ( |  | ) | const
| inline

Returns true if the byte order in reads and writes is reversed for all 2, 4, or 8 byte intrinsincs (short, int, long, float, double, etc.).

Definition at line 1607 of file DataBuffer.h.

## ◆ operator=()

DataBuffer& util::DataBuffer::operator= | ( | const DataBuffer & | db | ) |

## ◆ readBool() [1/2]

bool util::DataBuffer::readBool | ( |  | ) |
| inline

Read a bool from the buffer and update the iterator.

Definition at line 590 of file DataBuffer.h.

## ◆ readBool() [2/2]

bool util::DataBuffer::readBool | ( | int | pos | ) |
| inline

Read a bool from the positions specified by pos ... doesn't update dbDataPos.

Definition at line 605 of file DataBuffer.h.

## ◆ readBoolArray()

void util::DataBuffer::readBoolArray | ( | bool * | array,
|  | int | num_bools
| ) |  |
| inline

Read num_bools booleans from 'this' DataBuffer into array.

Definition at line 618 of file DataBuffer.h.

## ◆ readByte() [1/2]

uByte util::DataBuffer::readByte | ( |  | ) |
| inline

Read a byte from the buffer and update the iterator.

Definition at line 549 of file DataBuffer.h.

## ◆ readByte() [2/2]

uByte util::DataBuffer::readByte | ( | int | pos | ) |
| inline

Read a byte from the positions specified by pos ... doesn't update dbDataPos.

Definition at line 564 of file DataBuffer.h.

## ◆ readByteArray()

void util::DataBuffer::readByteArray | ( | uByte * | array,
|  | int | num_bytes
| ) |  |
| inline

Read num_bytes characters from 'this' DataBuffer into array.

Definition at line 577 of file DataBuffer.h.

## ◆ readCharArray()

void util::DataBuffer::readCharArray | ( | char * | array,
|  | int | num_chars
| ) |  |
| inline

Read num_chars characters from 'this' DataBuffer into /em array.

Definition at line 536 of file DataBuffer.h.

## ◆ readDouble() [1/2]

double util::DataBuffer::readDouble | ( |  | ) |
| inline

Read a double from the buffer. Make sure the buffer is 8byte alligned before reading.

Definition at line 835 of file DataBuffer.h.

## ◆ readDouble() [2/2]

double util::DataBuffer::readDouble | ( | int | pos | ) |
| inline

Just read the double from the positions specified by pos ... doesn't update dbDataPos.

Definition at line 852 of file DataBuffer.h.

## ◆ readDoubleArray()

void util::DataBuffer::readDoubleArray | ( | double * | array,
|  | int | num_doubles
| ) |  |
| inline

Read num_doubles doubles from 'this' DataBuffer into array.

Definition at line 882 of file DataBuffer.h.

## ◆ readFloat() [1/2]

float util::DataBuffer::readFloat | ( |  | ) |
| inline

Read a float from the buffer. Make sure the buffer is 4byte alligned before reading.

Definition at line 767 of file DataBuffer.h.

## ◆ readFloat() [2/2]

float util::DataBuffer::readFloat | ( | int | pos | ) |
| inline

Read the float from the positions specified by pos ... doesn't update dbDataPos.

Definition at line 784 of file DataBuffer.h.

## ◆ readFloatArray()

void util::DataBuffer::readFloatArray | ( | float * | array,
|  | int | num_floats
| ) |  |
| inline

Read num_floats floats from 'this' DataBuffer into array.

Definition at line 814 of file DataBuffer.h.

## ◆ readFromFile() [1/4]

void util::DataBuffer::readFromFile | ( | fstream & | ifs,
|  | int | num_bytes
| ) |  |

## ◆ readFromFile() [2/4]

void util::DataBuffer::readFromFile | ( | fstream & | ifs,
|  | int64 | filePos,
|  | int | num_bytes
| ) |  |

## ◆ readFromFile() [3/4]

void util::DataBuffer::readFromFile | ( | ifstream & | ifs,
|  | int | num_bytes
| ) |  |

## ◆ readFromFile() [4/4]

void util::DataBuffer::readFromFile | ( | ifstream & | ifs,
|  | int64 | filePos,
|  | int | num_bytes
| ) |  |

## ◆ readInt32() [1/2]

int util::DataBuffer::readInt32 | ( |  | ) |
| inline

Read an int from the buffer. Make sure the buffer is 4byte alligned before reading.

Definition at line 632 of file DataBuffer.h.

## ◆ readInt32() [2/2]

int util::DataBuffer::readInt32 | ( | int | pos | ) |
| inline

Read the int from the positions specified by pos ... doesn't update dbDataPos.

Definition at line 649 of file DataBuffer.h.

## ◆ readInt64() [1/2]

int64 util::DataBuffer::readInt64 | ( |  | ) |
| inline

Read a long from the buffer. Make sure the buffer is 8byte alligned before reading.

Definition at line 699 of file DataBuffer.h.

## ◆ readInt64() [2/2]

int64 util::DataBuffer::readInt64 | ( | int | pos | ) |
| inline

Read the long from the positions specified by pos ... doesn't update dbDataPos.

Definition at line 716 of file DataBuffer.h.

## ◆ readIntArray()

void util::DataBuffer::readIntArray | ( | int * | array,
|  | int | num_ints
| ) |  |
| inline

Read num_ints integers from 'this' DataBuffer into array.

Definition at line 679 of file DataBuffer.h.

## ◆ readLongArray()

void util::DataBuffer::readLongArray | ( | int64 * | array,
|  | int | num_longs
| ) |  |
| inline

Read num_longs int64s from 'this' DataBuffer into array.

Definition at line 746 of file DataBuffer.h.

## ◆ readMD5HashKey()

const string& util::DataBuffer::readMD5HashKey | ( |  | ) |

## ◆ readRawDouble()

double util::DataBuffer::readRawDouble | ( |  | ) |
| inline

Read a double ... don't check for alignment ... fast but client is responsible for alignment.

Definition at line 867 of file DataBuffer.h.

## ◆ readRawFloat()

float util::DataBuffer::readRawFloat | ( |  | ) |
| inline

Read a float ... don't check for alignment ... fast but client is responsible for alignment.

Definition at line 799 of file DataBuffer.h.

## ◆ readRawInt32()

int util::DataBuffer::readRawInt32 | ( |  | ) |
| inline

Read an Int32 ... don't check for alignment ... fast but client is responsible for alignment.

Definition at line 664 of file DataBuffer.h.

## ◆ readRawInt64()

int64 util::DataBuffer::readRawInt64 | ( |  | ) |
| inline

Read a long ... don't check for alignment ... fast but client is responsible for alignment.

Definition at line 731 of file DataBuffer.h.

## ◆ readString() [1/2]

const string & util::DataBuffer::readString | ( |  | ) |
| inline

Read a string and return a reference to be assigned to another string in the client. This function assumes the length of the string occurs imediately before the actual string data.

Definition at line 504 of file DataBuffer.h.

## ◆ readString() [2/2]

void util::DataBuffer::readString | ( | string & | str,
|  | int | num_chars
| ) |  |
| inline

Read num_chars from 'this' databuffer into the input string, str.

Definition at line 523 of file DataBuffer.h.

## ◆ reserve()

void util::DataBuffer::reserve | ( | int | sze | ) |
| inline

brief Reserves space in the DataBuffer

Reserves space in the DataBuffer.

Definition at line 1619 of file DataBuffer.h.

## ◆ resetPos()

void util::DataBuffer::resetPos | ( |  | ) |
| inline

Reset the buffers iterator location to zero.

Definition at line 1421 of file DataBuffer.h.

## ◆ reverseBO2()

void util::DataBuffer::reverseBO2 | ( | char * | d | ) |
| inlinestatic

Reverses byte order of d. d is assumed to point to an 2 byte element.

Definition at line 1524 of file DataBuffer.h.

## ◆ reverseBO2Array()

static void util::DataBuffer::reverseBO2Array | ( | int | n,
|  | char * | a
| ) |  |
| static

## ◆ reverseBO4()

void util::DataBuffer::reverseBO4 | ( | char * | d | ) |
| inlinestatic

Reverses byte order of d. d is assumed to point to an 4 byte element.

Definition at line 1536 of file DataBuffer.h.

## ◆ reverseBO4Array()

static void util::DataBuffer::reverseBO4Array | ( | int | n,
|  | char * | a
| ) |  |
| static

## ◆ reverseBO8()

void util::DataBuffer::reverseBO8 | ( | char * | d | ) |
| inlinestatic

Reverses byte order of d. d is assumed to point to an 8 byte element.

Definition at line 1552 of file DataBuffer.h.

## ◆ reverseBO8Array()

static void util::DataBuffer::reverseBO8Array | ( | int | n,
|  | char * | a
| ) |  |
| static

## ◆ reverseBOArray()

static void util::DataBuffer::reverseBOArray | ( | int | n,
|  | char * | a,
|  | int | s
| ) |  |
| static

## ◆ setByteOrderReverse()

void util::DataBuffer::setByteOrderReverse | ( | bool | bor | ) |
| inline

Sets the byte order reverse flag to bor.

Definition at line 1576 of file DataBuffer.h.

## ◆ setPosToEnd()

void util::DataBuffer::setPosToEnd | ( |  | ) |
| inline

Set the buffers iterator position to dbSize. If current iterator exceeds dbsize then dbsize is set and dbDataPos is unchanged.

Definition at line 1436 of file DataBuffer.h.

## ◆ setSize()

void util::DataBuffer::setSize | ( | int | num_bytes | ) |
| inline

Set the size of the data buffer to num_bytes.

Definition at line 1396 of file DataBuffer.h.

## ◆ size()

int util::DataBuffer::size | ( |  | ) |
| inline

Return the current DataBuffer size.

Definition at line 1406 of file DataBuffer.h.

## ◆ writeBool() [1/2]

void util::DataBuffer::writeBool | ( | bool | b | ) |
| inline

Write a bool (b) to the DataBuffer. Make sure the buffer is sized appropriately before writing.

Definition at line 1030 of file DataBuffer.h.

## ◆ writeBool() [2/2]

void util::DataBuffer::writeBool | ( | bool | b,
|  | int | pos
| ) |  |
| inline

Write a bool (b) at databuffer position pos. Does not update the iterator.

Definition at line 1047 of file DataBuffer.h.

## ◆ writeBoolArray()

void util::DataBuffer::writeBoolArray | ( | const bool * | array,
|  | int | num_bools
| ) |  |
| inline

Write num_bools bools from the input array into 'this' DataBuffer.

Definition at line 1074 of file DataBuffer.h.

## ◆ writeByte() [1/2]

void util::DataBuffer::writeByte | ( | uByte | b | ) |
| inline

Write a byte (b) to the DataBuffer. Make sure the buffer is sized appropriately before writing.

Definition at line 968 of file DataBuffer.h.

## ◆ writeByte() [2/2]

void util::DataBuffer::writeByte | ( | uByte | b,
|  | int | pos
| ) |  |
| inline

Write a uByte (b) at databuffer position pos. Does not update the iterator.

Definition at line 985 of file DataBuffer.h.

## ◆ writeByteArray()

void util::DataBuffer::writeByteArray | ( | const uByte * | array,
|  | int | num_bytes
| ) |  |
| inline

Write num_bytes uBytes from the input array into 'this' DataBuffer.

Definition at line 1012 of file DataBuffer.h.

## ◆ writeCharArray()

void util::DataBuffer::writeCharArray | ( | const char * | array,
|  | int | num_chars
| ) |  |
| inline

Write num_chars of the character array into 'this' DataBuffer.

Definition at line 950 of file DataBuffer.h.

## ◆ writeDouble() [1/2]

void util::DataBuffer::writeDouble | ( | double | d | ) |
| inline

Write a double (d) to the DataBuffer. Make sure the buffer is 8byte alligned and sized appropriatly before reading.

Definition at line 1317 of file DataBuffer.h.

## ◆ writeDouble() [2/2]

void util::DataBuffer::writeDouble | ( | double | d,
|  | int | pos
| ) |  |
| inline

Write a double (d) at databuffer position pos. Does not update the iterator.

Definition at line 1338 of file DataBuffer.h.

## ◆ writeDoubleArray()

void util::DataBuffer::writeDoubleArray | ( | const double * | array,
|  | int | num_doubles
| ) |  |
| inline

Write num_doubles doubles from the input array into 'this' DataBuffer.

Definition at line 1368 of file DataBuffer.h.

## ◆ writeFloat() [1/2]

void util::DataBuffer::writeFloat | ( | float | f | ) |
| inline

Write a float (f) to the DataBuffer. Make sure the buffer is 4byte alligned and sized appropriatly before reading.

Definition at line 1242 of file DataBuffer.h.

## ◆ writeFloat() [2/2]

void util::DataBuffer::writeFloat | ( | float | f,
|  | int | pos
| ) |  |
| inline

Write a float (f) at databuffer position pos. Does not update the iterator.

Definition at line 1263 of file DataBuffer.h.

## ◆ writeFloatArray()

void util::DataBuffer::writeFloatArray | ( | const float * | array,
|  | int | num_floats
| ) |  |
| inline

Write num_floats floats from the input array into 'this' DataBuffer.

Definition at line 1292 of file DataBuffer.h.

## ◆ writeInt32() [1/2]

void util::DataBuffer::writeInt32 | ( | int | i | ) |
| inline

Write an Int32 (i) to the DataBuffer. Make sure the buffer is 4byte alligned and sized appropriatly before reading.

Definition at line 1092 of file DataBuffer.h.

## ◆ writeInt32() [2/2]

void util::DataBuffer::writeInt32 | ( | int | i,
|  | int | pos
| ) |  |
| inline

Write an int (i) at databuffer position pos. Do not update the iterator.

Definition at line 1113 of file DataBuffer.h.

## ◆ writeInt64() [1/2]

void util::DataBuffer::writeInt64 | ( | int64 | i | ) |
| inline

Write an Int64 (i) to the DataBuffer. Make sure the buffer is 8byte alligned and sized appropriatly before reading.

Definition at line 1167 of file DataBuffer.h.

## ◆ writeInt64() [2/2]

void util::DataBuffer::writeInt64 | ( | int64 | i,
|  | int | pos
| ) |  |
| inline

Write a long (i) at databuffer position pos. Does not update the iterator.

Definition at line 1188 of file DataBuffer.h.

## ◆ writeIntArray()

void util::DataBuffer::writeIntArray | ( | const int * | array,
|  | int | num_ints
| ) |  |
| inline

Write num_ints ints from the input array into 'this' DataBuffer.

Definition at line 1142 of file DataBuffer.h.

## ◆ writeLongArray()

void util::DataBuffer::writeLongArray | ( | const int64 * | array,
|  | int | num_longs
| ) |  |
| inline

Write num_longs longs from the input array into 'this' DataBuffer.

Definition at line 1217 of file DataBuffer.h.

## ◆ writeRawBool()

void util::DataBuffer::writeRawBool | ( | bool | b | ) |
| inline

Write a bool (b) ... do not check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly.

Definition at line 1061 of file DataBuffer.h.

## ◆ writeRawByte()

void util::DataBuffer::writeRawByte | ( | uByte | b | ) |
| inline

Write a uByte (b) ... don't check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly.

Definition at line 999 of file DataBuffer.h.

## ◆ writeRawDouble()

void util::DataBuffer::writeRawDouble | ( | double | d | ) |
| inline

Write a double (d) ... do not check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly.

Definition at line 1353 of file DataBuffer.h.

## ◆ writeRawFloat()

void util::DataBuffer::writeRawFloat | ( | float | f | ) |
| inline

Write a float (f) ... do not check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly.

Definition at line 1278 of file DataBuffer.h.

## ◆ writeRawInt32()

void util::DataBuffer::writeRawInt32 | ( | int | i | ) |
| inline

Write an Int32 (i) ... do not check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly.

Definition at line 1128 of file DataBuffer.h.

## ◆ writeRawInt64()

void util::DataBuffer::writeRawInt64 | ( | int64 | i | ) |
| inline

Write an Int64 (i) ... don't check for alignment or size ... fast but the client is responsible for handling alignment and sizing correctly.

Definition at line 1203 of file DataBuffer.h.

## ◆ writeString() [1/2]

void util::DataBuffer::writeString | ( | char * | char_string | ) |
| inline

Write the string char_string into 'this' DataBuffer.

Definition at line 939 of file DataBuffer.h.

## ◆ writeString() [2/2]

void util::DataBuffer::writeString | ( | const string & | in_string | ) |
| inline

Write the string in_string into 'this' DataBuffer.

Definition at line 906 of file DataBuffer.h.

## ◆ writeToFile() [1/2]

void util::DataBuffer::writeToFile | ( | fstream & | ofs | ) |

## ◆ writeToFile() [2/2]

void util::DataBuffer::writeToFile | ( | ofstream & | ofs | ) |

## Member Data Documentation

## ◆ ALLOCATION_REQ_SIZE

const int util::DataBuffer::ALLOCATION_REQ_SIZE
| static

Default allocation requirement size for a data buffer.

Definition at line 359 of file DataBuffer.h.

## ◆ dbData

string* util::DataBuffer::dbData
| protected

A string object is used to contain the actual data.

Definition at line 373 of file DataBuffer.h.

## ◆ dbDataPos

int util::DataBuffer::dbDataPos
| protected

The current iterator position in the data container (dbData).

Definition at line 376 of file DataBuffer.h.

## ◆ dbOwnStr

bool util::DataBuffer::dbOwnStr
| protected

A boolean, that if true, indicates the storage string for this DataBuffer is owned and therefore deleted when the DataBuffer is deleted.

Definition at line 395 of file DataBuffer.h.

## ◆ dbPad

bool util::DataBuffer::dbPad
| protected

A boolean, that if true, maintains 4 and 8 byte alignment in support of double alignment compilation.

Definition at line 383 of file DataBuffer.h.

## ◆ dbReverse

bool util::DataBuffer::dbReverse
| protected

A boolean, that if true, reverses the byte order of all 2, 4, and 8 byte intrinsics (shorts, ints, long, floats, doubles, etc.). This flag is set by the FileDatabase object only and otherwise defaults to false. The flag is used to convert byte order between big- and little- endian formats.

Definition at line 390 of file DataBuffer.h.

## ◆ dbSize

int util::DataBuffer::dbSize
| protected

The current size of the data container.

Definition at line 379 of file DataBuffer.h.

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

- rstt/SLBM/include/DataBuffer.h