Buffer

The list of Buffer objects in a Frame is iterated using a the following typedef:

rogue::interfaces::stream::Frame::BufferIterator

The uint8_t data within a Buffer is iterated using a the following typedef:

rogue::interfaces::stream::Buffer::iterator

Buffer objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::interfaces::stream::Buffer> rogue::interfaces::stream::BufferPtr

Alias for using shared pointer as BufferPtr.

The Buffer class description is shown below:

class Buffer

Frame buffer.

This class is a container for buffers which make up a frame. Each buffer is associated with a contiguous block of memory allocated by an instance of the Pool class. Each buffer within the frame has a reserved header and tail area to pre-reserve space which may be required by protocol layers. Direct interaction with the Buffer class is an advanced topic, most users will simply use a FrameIterator to access Frame and Buffer data. The Buffer class is not available in Python.

Public Types

typedef uint8_t *iterator

Alias for using uint8_t * as Buffer::iterator.

Public Functions

uint32_t getMeta()

Get meta data.

The meta data field is used by the Pool class or sub-class to track the allocated data.

Returns:

Meta data value

void setMeta(uint32_t meta)

Set meta data.

The meta data field is used by the Pool class or sub-class to track the allocated data.

Parameters:

meta – Meta data value

void adjustHeader(int32_t value)

Adjust header by passed value.

Parameters:

value – Head adjustment amount

void zeroHeader()

Clear the header reservation.

void adjustTail(int32_t value)

Adjust tail reservation by passed value.

Parameters:

value – Tail adjustment amount

void zeroTail()

Clear the tail reservation.

uint8_t *begin()

Get beginning buffer iterator.

Get an iterator which indicates the start of the buffer space, not including the header reservation.

Returns:

Begin buffer iterator

uint8_t *end()

Get end buffer iterator.

Get an iterator which indicates the end of the the buffer minus the tail reservation.

Returns:

End buffer iterator

uint8_t *endPayload()

Get end payload iterator.

Get an iterator which indicates the end of the the payload space.

Returns:

End payload iterator

uint32_t getSize()

Get Buffer size.

Get size of buffer that can hold payload data. This function returns the full buffer size minus the head and tail reservation.

Returns:

Buffer size in bytes

uint32_t getAvailable()

Get the available space for payload.

Get the remaining data available for payload.

Returns:

The amount of available space for payload in bytes.

uint32_t getPayload()

Get the payload size.

This method will return the amount of payload data in the buffer.

Returns:

Payload size in bytes

void setPayload(uint32_t size)

Set the payload size.

Set the payload size to the passed value.

Parameters:

size – New payload size in bytes

void minPayload(uint32_t size)

Set minimum payload size.

This method sets the payload size to be at least the passed value. If the current payload size exceeds the passed value, the size is unchanged.

Parameters:

size – Min payload size in bytes

void adjustPayload(int32_t value)

Adjust the payload size.

This method adjusts the payload size by the passed positive or negative value.

Parameters:

value – Value to adjust payload by in bytes

void setPayloadFull()

Set the payload size to fill the buffer.

This method sets the buffer payload size to fill the buffer, minus the header and tail reservation.

void setPayloadEmpty()

Set the buffer as empty.

This method sets the buffer payload size as empty.

void debug(uint32_t idx)

Debug Buffer.