|
iPlug2 - C++ Audio Plug-in Framework
|
A lock-free SPSC queue used to transfer data between threads based on MLQueue.h by Randy Jones based on https://kjellkod.wordpress.com/2012/11/28/c-debt-paid-in-full-wait-free-lock-free-queue/. More...
#include <IPlugQueue.h>
Public Member Functions | |
| IPlugQueue (int size) | |
| IPlugQueue constructor. More... | |
| IPlugQueue (const IPlugQueue &)=delete | |
| IPlugQueue & | operator= (const IPlugQueue &)=delete |
| void | Resize (int size) |
| Changes the queue capacity. More... | |
| bool | Push (const T &item) |
| Adds an item to the queue. More... | |
| bool | Pop (T &item) |
| Removes and retrieves an item from the queue. More... | |
| template<typename... Args> | |
| bool | PushFromArgs (Args ...args) |
| Constructs and adds an item to the queue in-place from arguments. More... | |
| size_t | ElementsAvailable () const |
| Returns the number of elements currently in the queue. More... | |
| const T & | Peek () |
| Returns a const reference to the next item without removing it Useful for reading elements while a criterion is met. More... | |
| bool | WasEmpty () const |
| Checks if the queue is currently empty. More... | |
| bool | WasFull () const |
| Checks if the queue is currently full. More... | |
A lock-free SPSC queue used to transfer data between threads based on MLQueue.h by Randy Jones based on https://kjellkod.wordpress.com/2012/11/28/c-debt-paid-in-full-wait-free-lock-free-queue/.
Definition at line 31 of file IPlugQueue.h.
|
inline |
IPlugQueue constructor.
| size | The queue capacity (number of elements) |
Definition at line 36 of file IPlugQueue.h.
References IPlugQueue< T >::Resize().
|
inline |
Definition at line 41 of file IPlugQueue.h.
|
inline |
Returns the number of elements currently in the queue.
Definition at line 106 of file IPlugQueue.h.
Referenced by VoiceAllocator::ProcessEvents().
|
inline |
Returns a const reference to the next item without removing it Useful for reading elements while a criterion is met.
Can be used like: while (q.ElementsAvailable() && q.Peek().mTime < 100) { T elem; q.Pop(elem); ... }
Definition at line 118 of file IPlugQueue.h.
|
inline |
Removes and retrieves an item from the queue.
| item | Reference to store the retrieved item |
Definition at line 74 of file IPlugQueue.h.
Referenced by VoiceAllocator::ProcessEvents().
|
inline |
Adds an item to the queue.
| item | The item to add to the queue |
Definition at line 57 of file IPlugQueue.h.
Referenced by VoiceAllocator::AddEvent().
|
inline |
Constructs and adds an item to the queue in-place from arguments.
| args... | Arguments to forward to the item's constructor |
Definition at line 91 of file IPlugQueue.h.
Referenced by IPlugCLAP::BeginInformHostOfParamChange(), IPlugCLAP::EndInformHostOfParamChange(), IPlugCLAP::InformHostOfParamChange(), and IPlugAPIBase::SendParameterValueFromAPI().
|
inline |
Changes the queue capacity.
| size | The new queue capacity (number of elements) |
Definition at line 48 of file IPlugQueue.h.
Referenced by IPlugQueue< T >::IPlugQueue().
|
inline |
Checks if the queue is currently empty.
Definition at line 127 of file IPlugQueue.h.
|
inline |
Checks if the queue is currently full.
Definition at line 135 of file IPlugQueue.h.