Loading...
Searching...
No Matches
Public Member Functions | List of all members
switchboard::RingBuffer< T > Class Template Reference

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.
 

Detailed Description

template<typename T>
class switchboard::RingBuffer< T >

Class providing ring buffer functionality.

RingBuffer class.

Constructor & Destructor Documentation

◆ RingBuffer()

template<typename T >
switchboard::RingBuffer< T >::RingBuffer ( uint  numberOfItems)

Creates a RingBuffer instance.

Parameters
numberOfItemsThe number of items that the ring buffer can hold.

Member Function Documentation

◆ consume()

template<typename T >
void switchboard::RingBuffer< T >::consume ( T *  destBuffer,
uint  numberOfItems 
)

Reads items from the ring buffer.

Parameters
destBuffer[inout] The buffer where the read items will be copied to.
numberOfItemsThe number of items that should be consumed.

◆ getAvailableItemsToConsume()

template<typename T >
uint switchboard::RingBuffer< T >::getAvailableItemsToConsume

Returns the maximum number of items that can be read from the ring buffer.

Returns
The number items that can be consumed.

◆ getAvailableItemsToProduce()

template<typename T >
uint switchboard::RingBuffer< T >::getAvailableItemsToProduce

Returns the maximum number of items that can be added to the ring buffer.

Returns
The number of items that can be produced.

◆ produce()

template<typename T >
void switchboard::RingBuffer< T >::produce ( const T *  sourceBuffer,
uint  numberOfItems 
)

Adds items to the ring buffer.

Parameters
sourceBufferThe buffer where the items are copied from.
numberOfItemsThe number of items that should be added to the ring buffer.

The documentation for this class was generated from the following files: