BufferWriter
BufferWriter

Class used to interface with a DataBuffer and append data to it

Functions
BufferWriter
BufferWriter(
uint8 *buffer,
std::size_t size,
std::size_t *offset
)

Constructor to create a BufferWriter object

Variables
m_buffer
uint8* m_buffer

The buffer to write to, at the specific position to start writing data

m_size
std::size_t m_size

The size available to write

m_writeOffset
std::size_t* m_writeOffset

A pointer to the current position to start writing in the buffer

Functions
buffer
uint8* buffer()

Gets the buffer to write to

Returns

The buffer to write to, as a byte reference

size
std::size_t size()

Gets the size of the buffer available to write

Returns

The size of the buffer available to write

commit
void commit(
std::size_t numBytesAdded
)

Commits a number of bytes that were added to the buffer by moving the current offset.

This function must be called after bytes are added to the buffer, or else they will be ignored as if they were never added.

Parameters
numBytesAdded
std::size_t

The number of bytes added to the buffer