|
VR-Engage
2.2
|
This class provides a buffer for bundling multiple VREngage messages together for efficient network transmission. It manages a resizable buffer and provides methods for adding messages, checking capacity, and tracking buffer usage.
#include <networkForwarder.h>
Public Member Functions | |
| DtVreMessageBundle (int maxSize) | |
| ~DtVreMessageBundle () | |
| void | reset () |
| int | used () |
| int | bufferRemaining () |
| bool | canAdd (int size) |
| void | add (char *data, int size) |
Public Attributes | |
| char * | myBuffer |
| char * | myWriteHead |
| int | myMaxSize |
| makVre::DtVreMessageBundle::DtVreMessageBundle | ( | int | maxSize | ) |
Constructor.
| maxSize | Maximum size of the buffer in bytes |
Allocates a new buffer of the specified size for bundling messages.
| makVre::DtVreMessageBundle::~DtVreMessageBundle | ( | ) |
Destructor.
Deallocates the buffer memory.
| void makVre::DtVreMessageBundle::reset | ( | ) |
Resets the write position to the beginning of the buffer.
Allows the buffer to be reused after its contents have been sent.
| int makVre::DtVreMessageBundle::used | ( | ) |
Gets the number of bytes currently used in the buffer.
| int makVre::DtVreMessageBundle::bufferRemaining | ( | ) |
Gets the number of bytes remaining in the buffer.
| bool makVre::DtVreMessageBundle::canAdd | ( | int | size | ) |
Checks if a message of the specified size can be added to the buffer.
| size | Size of the message in bytes |
| void makVre::DtVreMessageBundle::add | ( | char * | data, |
| int | size ) |
Adds a message to the buffer.
| data | Pointer to the message data |
| size | Size of the message in bytes |
Copies the message data into the buffer and advances the write position.
| char* makVre::DtVreMessageBundle::myBuffer |
Pointer to the buffer containing bundled messages.
| char* makVre::DtVreMessageBundle::myWriteHead |
Current write position in the buffer.
| int makVre::DtVreMessageBundle::myMaxSize |
Maximum size of the buffer in bytes.