|
Evo C++ Library v0.5.1
|
#include <evo/atomic_buffer_queue.h>
Fast buffer-based queue, implemented with a ring-buffer.
| T | Item type to use, copied with assignment operator |
| TSize | Size type to use for queue size (must be unsigned integer) – default: SizeT |
Note that this is not a full EvoContainer and doesn't have iterators.
Public Types | |
| typedef T | Item |
| Item type. More... | |
| typedef TSize | Size |
| Queue size integer type (always unsigned) More... | |
| typedef AtomicBufferQueue< T, TSize > | This |
| This type More... | |
Public Member Functions | |
| AtomicBufferQueue (Size size=DEFAULT_SIZE) | |
| Constructor, sets buffer size. More... | |
| ~AtomicBufferQueue () | |
| Destructor. More... | |
| void | add (typename DataCopy< Item >::PassType item) |
| Add item to queue. More... | |
| void | add_commit (uint64 seq) |
| Commit adding an item. More... | |
| Item & | add_start (uint64 &seq) |
| Start adding item to queue directly. More... | |
| void | clear () |
| Clear all items from queue, making it empty. More... | |
| bool | empty () const |
| Get whether queue is empty. More... | |
| bool | full () const |
| Get whether queue is full. More... | |
| bool | pop (Item &item) |
| Pop oldest item from queue. More... | |
| Size | size () const |
| Get buffer size. More... | |
| Size | used () const |
| Get used item count. More... | |
Static Public Attributes | |
| static const Size | DEFAULT_SIZE = 128 |
| Default size to use. More... | |
| typedef T Item |
Item type.
| typedef TSize Size |
Queue size integer type (always unsigned)
| typedef AtomicBufferQueue<T,TSize> This |
This type
|
inline |
Constructor, sets buffer size.
| size | Buffer size to use as item count, rouned to next power of 2 if needed |
|
inline |
Destructor.
Add item to queue.
memcpy() and/or swap pointers) – adding further items will block (semi-busy wait) while this is copying| item | Item to add, copied with assignment operator |
|
inline |
Commit adding an item.
| seq | Item sequence number from add_start() |
|
inline |
Start adding item to queue directly.
memcpy() and/or swap pointers) – adding further items will block (semi-busy wait) until add_commit() is called with the same sequence number| seq | Stores sequence number for added item, pass this to add_commit() [out] |
|
inline |
Clear all items from queue, making it empty.
add*() method is being called by another thread, otherwise thread safe
|
inline |
|
inline |
|
inline |
Pop oldest item from queue.
memcpy() and/or swap pointers) – adding further items will block (semi-busy wait) while the queue is full| item | Stores popped item, copied with assignment operator [out] |
|
inline |
|
inline |
|
static |
Default size to use.
1.8.13