VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVreMessageBundle Struct Reference

Detailed Description

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
 

Constructor & Destructor Documentation

◆ DtVreMessageBundle()

makVre::DtVreMessageBundle::DtVreMessageBundle ( int maxSize)

Constructor.

Parameters
maxSizeMaximum size of the buffer in bytes

Allocates a new buffer of the specified size for bundling messages.

◆ ~DtVreMessageBundle()

makVre::DtVreMessageBundle::~DtVreMessageBundle ( )

Destructor.

Deallocates the buffer memory.

Member Function Documentation

◆ reset()

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.

◆ used()

int makVre::DtVreMessageBundle::used ( )

Gets the number of bytes currently used in the buffer.

Returns
Number of bytes used

◆ bufferRemaining()

int makVre::DtVreMessageBundle::bufferRemaining ( )

Gets the number of bytes remaining in the buffer.

Returns
Number of bytes remaining

◆ canAdd()

bool makVre::DtVreMessageBundle::canAdd ( int size)

Checks if a message of the specified size can be added to the buffer.

Parameters
sizeSize of the message in bytes
Returns
True if the message can be added, false otherwise

◆ add()

void makVre::DtVreMessageBundle::add ( char * data,
int size )

Adds a message to the buffer.

Parameters
dataPointer to the message data
sizeSize of the message in bytes

Copies the message data into the buffer and advances the write position.

Member Data Documentation

◆ myBuffer

char* makVre::DtVreMessageBundle::myBuffer

Pointer to the buffer containing bundled messages.

◆ myWriteHead

char* makVre::DtVreMessageBundle::myWriteHead

Current write position in the buffer.

◆ myMaxSize

int makVre::DtVreMessageBundle::myMaxSize

Maximum size of the buffer in bytes.


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