|
bmv2
Designing your own switch target with bmv2
|
Public Types | |
| enum | WriteBehavior { WriteBlock, WriteReturn } |
| Implementation behavior when an item is pushed to a full queue. More... | |
| enum | ReadBehavior { ReadBlock, ReadReturn } |
| Implementation behavior when an element is popped from an empty queue. More... | |
Public Member Functions | |
| Queue (size_t capacity, WriteBehavior wb=WriteBlock, ReadBehavior rb=ReadBlock) | |
Constructs a queue with specified capacity and read / write behaviors. More... | |
| void | push_front (const T &item) |
Makes a copy of item and pushes it to the front of the queue. More... | |
| void | push_front (T &&item) |
Moves item to the front of the queue. More... | |
| void | pop_back (T *pItem) |
Pops an element from the back of the queue: moves the element to *pItem. More... | |
| size_t | size () const |
| Get queue occupancy. More... | |
| void | set_capacity (const size_t c) |
| Change the capacity of the queue. More... | |
| Queue (const Queue &)=delete | |
| Deleted copy constructor. More... | |
| Queue & | operator= (const Queue &)=delete |
| Deleted copy assignment operator. More... | |
| Queue (Queue &&)=delete | |
| Deleted move constructor (class includes mutex) More... | |
| Queue && | operator= (Queue &&)=delete |
| Deleted move assignment operator (class includes mutex) More... | |
A utility queueing class made available to all targets. It could be used -for example- to queue packets between an ingress thread and an egress thread. This is a very simple class, which does not implement anything fancy (e.g. rate limiting, priority queueing, fair scheduling, ...) but can be used as a base class to build something more advanced. Queue includes a mutex and is thread-safe.
| enum bm::Queue::ReadBehavior |
| enum bm::Queue::WriteBehavior |
|
inline |
Constructs a queue with specified capacity and read / write behaviors.
Deleted move constructor (class includes mutex)
Deleted copy assignment operator.
Deleted move assignment operator (class includes mutex)
|
inline |
Pops an element from the back of the queue: moves the element to *pItem.
|
inline |
Makes a copy of item and pushes it to the front of the queue.
|
inline |
Moves item to the front of the queue.
|
inline |
Change the capacity of the queue.
|
inline |
Get queue occupancy.
1.8.17