Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Queue on continuous memory buffer. More...
#include <ring_queue.h>
Public Member Functions | |
RingQueue (core::IArena &arena, size_t max_len) | |
Initialize. More... | |
bool | is_valid () const |
Check that initial allocation succeeded. More... | |
size_t | capacity () const |
Get maximum number of elements in queue/. More... | |
size_t | size () const |
Get current number of elements in the queue. More... | |
bool | is_empty () |
Is the queue empty. More... | |
bool | is_full () |
Is the queue full. More... | |
T & | front () |
Get reference of the front element. More... | |
const T & | front () const |
Get reference of the front element. More... | |
T & | back () |
Get reference of the back element. More... | |
const T & | back () const |
Get reference of the back element. More... | |
void | push_front (const T &x) |
Push an element to the front of the queue. More... | |
void | pop_front () |
Remove the first element from the front. More... | |
void | push_back (const T &x) |
Push an element to the backside of the queue. More... | |
void | pop_back () |
Remove the first element from the back. More... | |
Queue on continuous memory buffer.
Elements are stored continuously in a memory chunk allocated using IArena, or directly in Array object when number of elements is small.
RingQueue supports inserting and removing elements to the beginning and to the end with O(1) complexity.
T | defines array element type. It should have default constructor and copy constructor. |
EmbeddedCapacity | defines number of elements in the fixed-size chunk embedded directly into RingQueue object. |
Definition at line 37 of file ring_queue.h.
|
inline |
Initialize.
arena
with max_len
number of elements. Definition at line 42 of file ring_queue.h.
|
inline |
Get reference of the back element.
Definition at line 109 of file ring_queue.h.
|
inline |
Get reference of the back element.
Definition at line 119 of file ring_queue.h.
|
inline |
Get maximum number of elements in queue/.
Definition at line 67 of file ring_queue.h.
|
inline |
Get reference of the front element.
Definition at line 89 of file ring_queue.h.
|
inline |
Get reference of the front element.
Definition at line 99 of file ring_queue.h.
|
inline |
Is the queue empty.
Definition at line 77 of file ring_queue.h.
|
inline |
Is the queue full.
Definition at line 82 of file ring_queue.h.
|
inline |
Check that initial allocation succeeded.
Definition at line 62 of file ring_queue.h.
|
inline |
Remove the first element from the back.
Definition at line 162 of file ring_queue.h.
|
inline |
Remove the first element from the front.
Definition at line 140 of file ring_queue.h.
|
inline |
Push an element to the backside of the queue.
Definition at line 151 of file ring_queue.h.
|
inline |
Push an element to the front of the queue.
Definition at line 129 of file ring_queue.h.
|
inline |
Get current number of elements in the queue.
Definition at line 72 of file ring_queue.h.