#include <BufferManager.hpp>
Public Member Functions | |
BufferManager (UInt32 preferredAllocSize=defaultAllocChunkSize, UInt32 preferredAllocChunkSize=defaultAllocChunkSize) | |
~BufferManager () | |
UInt32 | getBuffer (Byte **buffer) |
UInt32 | getWritePointer () |
UInt32 | setWritePointer (UInt32 newWritePointer) |
UInt32 | getReadPointer () |
UInt32 | setReadPointer (UInt32 newReadPointer) |
UInt32 | writeData (Byte *buffer, UInt32 count) |
UInt32 | writeByte (Byte data) |
UInt32 | writeUInt16 (UInt16 data) |
UInt32 | writeUInt32 (UInt32 data) |
UInt32 | writebit (UInt32 bitCount, UInt32 data) |
UInt32 | readData (Byte *buffer, UInt32 count) |
UInt32 | readByte (Byte *data) |
UInt32 | readUInt16 (UInt16 *data) |
UInt32 | readUInt32 (UInt32 *data) |
UInt32 | readbit (UInt32 bitCount, UInt32 *data) |
BufferManager::BufferManager | ( | UInt32 | preferredAllocSize = defaultAllocChunkSize , |
|
UInt32 | preferredAllocChunkSize = defaultAllocChunkSize | |||
) |
Buffer Manager constructor
preferredAllocSize | The allocation size initially | |
preferredAllocChunkSize | The chunk size used for each re-allocation |
BufferManager::~BufferManager | ( | ) |
Buffer Manager destructor
UInt32 BufferManager::getBuffer | ( | Byte ** | buffer | ) |
Return the actual storage area of data (the "network bytes" as a vector) along with the size of the data contained.
buffer | Place where the addess of the storage is saved |
UInt32 BufferManager::getReadPointer | ( | ) |
Get the current write pointer
UInt32 BufferManager::getWritePointer | ( | ) |
Get the current write pointer in the buffer
UInt32 BufferManager::readbit | ( | UInt32 | bitCount, | |
UInt32 * | data | |||
) |
Read bits in multiple of 8. The read pointer is updated
bitCount | Number of bits to read, must be a multiple of 8 | |
data | The location where read data is stored |
UInt32 BufferManager::readByte | ( | Byte * | data | ) |
Read a byte of network byte to the buffer at the write pointer. The read pointer is updated.
data | The location where read byte is stored |
UInt32 BufferManager::readData | ( | Byte * | buffer, | |
UInt32 | count | |||
) |
Read directly bytes of data into storage.
buffer | Address of location where data is to be added | |
count | Number of bytes to read |
UInt32 BufferManager::readUInt16 | ( | UInt16 * | data | ) |
Read a 16 bit unsigned short int. Endian convesion from network byte order is also done. The read pointer is updated.
data | The location where read data is stored |
UInt32 BufferManager::readUInt32 | ( | UInt32 * | data | ) |
Read a 32 bit unsigned int. Endian convesion from network byte order is also done. The read pointer is updated.
data | The location where read data is stored |
UInt32 BufferManager::setReadPointer | ( | UInt32 | newReadPointer | ) |
Set the network read pointer to desired value. Has no other checks and effects. This will not effect the data size of the buffer until something is actually read from the new location.
newReadPointer | The new value of network read pointer to set. |
UInt32 BufferManager::setWritePointer | ( | UInt32 | newWritePointer | ) |
Set the network write pointer to desired value.Has no other checks and effects. This will not effect the data size of the buffer until something is actually written to the new location.
newWritePointer | The new value of network write pointer to set. |
UInt32 BufferManager::writebit | ( | UInt32 | bitCount, | |
UInt32 | data | |||
) |
Write bits in multiple of 8. The write pointer and data size are updated
bitCount | Number of bits to write, must be a multiple of 8 | |
data | The bits of data to write |
UInt32 BufferManager::writeByte | ( | Byte | data | ) |
Write a byte of network byte to the buffer at the write pointer. The write pointer and data size are updated.
data | The byte of data to write |
UInt32 BufferManager::writeData | ( | Byte * | buffer, | |
UInt32 | count | |||
) |
Add directly bytes of data provided into storage. The bytes are assumed to be in network order
buffer | Address of location from where data is to be added | |
count | Number of bytes to be added |
UInt32 BufferManager::writeUInt16 | ( | UInt16 | data | ) |
Write a 16 bit unsigned short int. Endian convesion to network byte order is also done. The write pointer and data size are updated.
data | The data to write |
UInt32 BufferManager::writeUInt32 | ( | UInt32 | data | ) |
Write a 32 bit unsigned int. Endian convesion to network byte order is also done. The write pointer and data size are updated.
data | The data to write |