|
uvco 0.1
|
#include <bounded_queue.h>
Public Member Functions | |
| BoundedQueue (size_t capacity) | |
| template<typename U> requires std::convertible_to<U, T> | |
| void | put (U &&elem) |
| Push an item to the queue. | |
| T | get () |
| Pop an item from the queue. | |
| unsigned | size () const |
| Current number of contained items. | |
| unsigned | capacity () const |
| Maximum number of contained items. | |
| bool | empty () const |
| size() == 0 | |
| bool | hasSpace () const |
| size() < capacity() | |
| void | forEach (std::function< void(T &)> function) |
Private Attributes | |
| std::vector< T > | queue_ {} |
| unsigned | head_ = 0 |
| unsigned | tail_ = 0 |
| unsigned | size_ = 0 |
A bounded FIFO queue based on a contiguous array.
Warning: only for internal use. The put()/get() interface is not safe in Release mode binaries; BoundedQueue is only intended to be used as part of Channel<T>.
|
inlineexplicit |
|
inlinenodiscard |
Maximum number of contained items.
|
inlinenodiscard |
size() == 0
| void uvco::BoundedQueue< T >::forEach | ( | std::function< void(T &)> | function | ) |
|
inline |
Pop an item from the queue.
|
inlinenodiscard |
|
inline |
Push an item to the queue.
|
inlinenodiscard |
Current number of contained items.
|
private |
|
private |
|
private |
|
private |