Represents a ring buffer that automatically grows to be able to store the data and provides O(1) operations. The buffer uses a buffer pool from which it gets an initial memory chunk that it will keep big enough to store the data.
More...
#include <circularbuffer.hh>
|
| | CircularBuffer (BufferPool *bufferPool) |
| | Construct a CircularBuffer.
|
| |
| | ~CircularBuffer () |
| | Destruct a CircularBuffer Put the buffer back into the BufferPool.
|
| |
| uint32_t | getSize () |
| | Return the size of the circular buffer (the size of the data in it)
|
| |
| uint32_t | getCapacity () |
| | Return the capacity of the circular buffer (the size of the memory chunk it uses)
|
| |
| uint32_t | getStartOffset () |
| | Return the start offset. Offset of the first byte in the buffer. Used to be able to manipulate sequence numbers. This offset is substracted from the requested data's position in order to obtain a position in the buffer.
|
| |
| void | setStartOffset (uint32_t startOffset) |
| | Set the start offset. Offset of the first byte in the buffer. Used to be able to manipulate sequence numbers. This offset is substracted from the requested data's position in order to obtain a position in the buffer.
|
| |
| bool | isBlank () |
| | Indicate whether the buffer is blank.
|
| |
| void | removeDataAtBeginning (uint32_t newStart) |
| | Remove data at the beginning of the buffer.
|
| |
| void | addDataAtEnd (const unsigned char *data, uint32_t length) |
| | Add data at the end of the buffer.
|
| |
| void | getData (uint32_t start, uint32_t length, Vector< unsigned char > &getBuffer) |
| | Retrieve data from the buffer.
|
| |
Represents a ring buffer that automatically grows to be able to store the data and provides O(1) operations. The buffer uses a buffer pool from which it gets an initial memory chunk that it will keep big enough to store the data.
◆ CircularBuffer()
| CircularBuffer::CircularBuffer |
( |
BufferPool * |
bufferPool | ) |
|
◆ ~CircularBuffer()
| CircularBuffer::~CircularBuffer |
( |
| ) |
|
◆ getSize()
| uint32_t CircularBuffer::getSize |
( |
| ) |
|
Return the size of the circular buffer (the size of the data in it)
- Returns
- Size of the circular buffer
◆ getCapacity()
| uint32_t CircularBuffer::getCapacity |
( |
| ) |
|
Return the capacity of the circular buffer (the size of the memory chunk it uses)
- Returns
- Capacity of the circular buffer
◆ getStartOffset()
| uint32_t CircularBuffer::getStartOffset |
( |
| ) |
|
Return the start offset. Offset of the first byte in the buffer. Used to be able to manipulate sequence numbers. This offset is substracted from the requested data's position in order to obtain a position in the buffer.
- Returns
- The start offset
◆ setStartOffset()
| void CircularBuffer::setStartOffset |
( |
uint32_t |
startOffset | ) |
|
Set the start offset. Offset of the first byte in the buffer. Used to be able to manipulate sequence numbers. This offset is substracted from the requested data's position in order to obtain a position in the buffer.
- Parameters
-
| startOffset | The start offset |
◆ isBlank()
| bool CircularBuffer::isBlank |
( |
| ) |
|
Indicate whether the buffer is blank.
- Returns
- True if the buffer is blank
◆ removeDataAtBeginning()
| void CircularBuffer::removeDataAtBeginning |
( |
uint32_t |
newStart | ) |
|
Remove data at the beginning of the buffer.
- Parameters
-
| newStart | Position of the new first byte in the buffer (takes into account the start offset) |
◆ addDataAtEnd()
| void CircularBuffer::addDataAtEnd |
( |
const unsigned char * |
data, |
|
|
uint32_t |
length |
|
) |
| |
Add data at the end of the buffer.
- Parameters
-
| data | The data to add |
| length | The length of the data to add |
◆ getData()
| void CircularBuffer::getData |
( |
uint32_t |
start, |
|
|
uint32_t |
length, |
|
|
Vector< unsigned char > & |
getBuffer |
|
) |
| |
Retrieve data from the buffer.
- Parameters
-
| start | Position of the first byte (takes into account the start offset) |
| length | The length of the data to retrieve |
| getBuffer | Buffer in which the data will be returned. Its size will be updated |
The documentation for this class was generated from the following files: