11 #ifndef AVIATE_AVIATETYPES_H_
12 #define AVIATE_AVIATETYPES_H_
14 #include "Aviate/Aviate.h"
29 m_buffer =
new T[maxSize]();
33 if (m_buffer)
delete [] m_buffer;
41 if ( (m_head == m_tail) && (m_size > 0) ) {
46 m_buffer[m_head] = element;
47 if (m_head < (m_maxSize-1) ) {
65 if (m_tail < m_maxSize-1) {
77 return m_buffer[m_tail];
83 return m_buffer[m_head-1];
91 size_t idx = (m_maxSize + m_head -1 - offset);
93 if ( idx >= m_maxSize) {
115 T& operator[] (
size_t index) {
116 return m_buffer[index];
122 T
at(
size_t index)
const {
123 return m_buffer[index];
130 T *m_buffer =
nullptr;
131 const size_t m_maxSize;
#define AVIATE_API
enable default visibility. This is used for public API functions and classes.
Definition: Aviate.h:19
Customer RingBuffer with random access.
Definition: AviateTypes.h:22
T at(size_t index) const
get the element at the specified absolute index
Definition: AviateTypes.h:122
virtual ~RingBuffer()
Destructor.
Definition: AviateTypes.h:32
T front() const
Get the element at the front of the queue.
Definition: AviateTypes.h:76
size_t max_size() const
get the maximum size the queue can hold
Definition: AviateTypes.h:108
size_t size() const
get the current size of the queue
Definition: AviateTypes.h:102
T back() const
get the element at the back of the queue
Definition: AviateTypes.h:82
size_t get_index_from_back(size_t offset=0) const
Get a previously pushed elememt.
Definition: AviateTypes.h:89
int push_back(T element)
Add an element to the back of the queue.
Definition: AviateTypes.h:39
int pop_front()
Remove the element at teh front of the queue.
Definition: AviateTypes.h:59
RingBuffer(const size_t maxSize)
Construct a RingBuffer of specified max size.
Definition: AviateTypes.h:28
The Aviate library/namespace provides the primary API for working with Multiverse.
Definition: AudioEffectWrapper.h:24