|
GHS
Leader Election Based on GHS Minimum Spanning Tree
|
a static-sized single-ended queue for use in GhsState More...
#include <static_queue.h>
Public Member Functions | |
| StaticQueue () | |
| bool | is_full () const |
| bool | is_empty () const |
| unsigned int | size () const |
| le::Errno | front (T &out_item) const |
| le::Errno | pop () |
| le::Errno | pop (T &out_item) |
| le::Errno | push (const T item) |
| le::Errno | at (const unsigned int idx, T &out_item) const |
| le::Errno | clear () |
a static-sized single-ended queue for use in GhsState
The StaticQueue class is a statically-sized, single-ended queue based on a cirlce buffer that is used to present and queue messags for the GhsState class
| T | a typename of the object to store |
| N | the number of elements to allocat storage for |
| StaticQueue::StaticQueue | ( | ) |
Constructs with static-sizing a circle-buf-backed queue
| le::Errno StaticQueue::at | ( | const unsigned int | idx, |
| T & | out_item | ||
| ) | const |
| le::Errno StaticQueue::front | ( | T & | out_item | ) | const |
Sets the given reference to be identical to the front of the queue, but does not alter the elements of the queue in any way
In any error condition, out_item is not changed.
| bool StaticQueue::is_empty | ( | ) | const |
| bool StaticQueue::is_full | ( | ) | const |
| le::Errno StaticQueue::pop | ( | ) |
Removes the front of the queue, reducing size by 1. No memory is recovered, but the element is irretreivable after this operation.
| le::Errno StaticQueue::pop | ( | T & | out_item | ) |
| le::Errno StaticQueue::push | ( | const T | item | ) |
emplaces an element at the back of the queue. no memory is allocated.
Fails if size()==N (the static templated size)
| unsigned int StaticQueue::size | ( | ) | const |
Returns the current number of elements in the queue
1.8.17