simple Buffer backed queue implementation More...
#include <queue.h>
Inherits Sink< T >, and Source< T >.
Public Member Functions | |
| Queue (const Buffer< T > &buf) | |
| create Queue directly from filled Buffer | |
| Queue (size_t size=30) | |
| create Queue with constant size | |
| void | push (T &&val) override |
| move element into queue | |
| T & | front () |
| return reference to first element in queue | |
| T | pop () override |
| remove front of queue and return it | |
| void | drop () |
| shift head of queue without touching underlying memory | |
| size_t | size () |
| return number of elements in queue | |
| bool | empty () override |
| check if queue is empty | |
| bool | full () override |
| return true if queue is full | |
| T | getAt (size_t idx) |
| return element at idx | |
| virtual void | push (const T &t) |
| copy semantics does not check for space. guard by using 'if (!full) { ... }' | |
| void | trypush (T &&t) |
| use this if you don't care if it's going to be successful. data gets discarded if sink is full. | |
simple Buffer backed queue implementation
|
inlineoverridevirtual |
|
inlineoverridevirtual |
remove front of queue and return it
does not check that there's something in the queue guard with if (size()) ... or if (! empty()) ...
Implements Source< T >.