Class providing ring buffer functionality. More...
#include <RingBuffer.hpp>
Public Member Functions | |
RingBuffer (uint numberOfItems) | |
Creates a RingBuffer instance. | |
~RingBuffer () | |
RingBuffer destructor. | |
void | clear () |
Clears all data in the ring buffer. | |
uint | getAvailableItemsToProduce () |
Returns the maximum number of items that can be added to the ring buffer. | |
void | produce (const T *sourceBuffer, uint numberOfItems) |
Adds items to the ring buffer. | |
uint | getAvailableItemsToConsume () |
Returns the maximum number of items that can be read from the ring buffer. | |
void | consume (T *destBuffer, uint numberOfItems) |
Reads items from the ring buffer. | |
Class providing ring buffer functionality.
RingBuffer class.
switchboard::RingBuffer< T >::RingBuffer | ( | uint | numberOfItems | ) |
Creates a RingBuffer instance.
numberOfItems | The number of items that the ring buffer can hold. |
void switchboard::RingBuffer< T >::consume | ( | T * | destBuffer, |
uint | numberOfItems | ||
) |
Reads items from the ring buffer.
destBuffer | [inout] The buffer where the read items will be copied to. |
numberOfItems | The number of items that should be consumed. |
uint switchboard::RingBuffer< T >::getAvailableItemsToConsume |
Returns the maximum number of items that can be read from the ring buffer.
uint switchboard::RingBuffer< T >::getAvailableItemsToProduce |
Returns the maximum number of items that can be added to the ring buffer.
void switchboard::RingBuffer< T >::produce | ( | const T * | sourceBuffer, |
uint | numberOfItems | ||
) |
Adds items to the ring buffer.
sourceBuffer | The buffer where the items are copied from. |
numberOfItems | The number of items that should be added to the ring buffer. |