Aviate Audio Multiverse Library
Public Member Functions | List of all members
Aviate::RingBuffer< T > Class Template Reference

Customer RingBuffer with random access. More...

#include <AviateTypes.h>

Public Member Functions

 RingBuffer (const size_t maxSize)
 Construct a RingBuffer of specified max size. More...
 
virtual ~RingBuffer ()
 Destructor.
 
int push_back (T element)
 Add an element to the back of the queue. More...
 
int pop_front ()
 Remove the element at teh front of the queue. More...
 
front () const
 Get the element at the front of the queue. More...
 
back () const
 get the element at the back of the queue More...
 
size_t get_index_from_back (size_t offset=0) const
 Get a previously pushed elememt. More...
 
size_t size () const
 get the current size of the queue More...
 
size_t max_size () const
 get the maximum size the queue can hold More...
 
T & operator[] (size_t index)
 get the element at the specified absolute index More...
 
at (size_t index) const
 get the element at the specified absolute index More...
 

Detailed Description

template<class T>
class Aviate::RingBuffer< T >

Customer RingBuffer with random access.

Constructor & Destructor Documentation

◆ RingBuffer()

template<class T >
Aviate::RingBuffer< T >::RingBuffer ( const size_t  maxSize)
inline

Construct a RingBuffer of specified max size.

Parameters
maxSizenumber of entries in ring buffer

Member Function Documentation

◆ at()

template<class T >
T Aviate::RingBuffer< T >::at ( size_t  index) const
inline

get the element at the specified absolute index

Parameters
indexelement to retrieve from absolute queue position
Returns
the request element

◆ back()

template<class T >
T Aviate::RingBuffer< T >::back ( ) const
inline

get the element at the back of the queue

Returns
element at the back of the queue

◆ front()

template<class T >
T Aviate::RingBuffer< T >::front ( ) const
inline

Get the element at the front of the queue.

Returns
element at front of queue

◆ get_index_from_back()

template<class T >
size_t Aviate::RingBuffer< T >::get_index_from_back ( size_t  offset = 0) const
inline

Get a previously pushed elememt.

Parameters
offsetzero is last pushed, 1 is second last, etc.
Returns
the absolute index corresponding to the requested offset.

◆ max_size()

template<class T >
size_t Aviate::RingBuffer< T >::max_size ( ) const
inline

get the maximum size the queue can hold

Returns
maximum size of the queue

◆ operator[]()

template<class T >
T& Aviate::RingBuffer< T >::operator[] ( size_t  index)
inline

get the element at the specified absolute index

Parameters
indexelement to retrieve from absolute queue position
Returns
the request element

◆ pop_front()

template<class T >
int Aviate::RingBuffer< T >::pop_front ( )
inline

Remove the element at teh front of the queue.

Returns
0 if success, otherwise error

◆ push_back()

template<class T >
int Aviate::RingBuffer< T >::push_back ( element)
inline

Add an element to the back of the queue.

Parameters
elementelement to add to queue
Returns
0 if success, otherwise error

◆ size()

template<class T >
size_t Aviate::RingBuffer< T >::size ( ) const
inline

get the current size of the queue

Returns
size of the queue

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