HDK
|
#include <UT_RingBuffer.h>
Public Member Functions | |
UT_RingBuffer () | |
UT_RingBuffer (int capacity) | |
~UT_RingBuffer () | |
void | remove (int id) |
Remove item with id. More... | |
void | clear () |
Resets the buffer to an empty buffer with a 0 index. More... | |
SYS_NO_DISCARD_RESULT T | popFirst () |
void | pop () |
Pop a single element from the start of the buffer. More... | |
void | popBack () |
Pop a single element from the back of the buffer. More... | |
void | pop (int number) |
Pop the next "number" elements from the buffer. More... | |
int | size () const |
int | entries () const |
int | peakUsage () const |
T | operator[] (int id) const |
const T & | operator() (int id) const |
const T & | front () const |
int | frontId () const |
const T & | back () const |
int | backId () const |
void | display () const |
void | insert (int id, const T &data) |
void | insert (int id, T &&data) |
int | push (const T &data) |
int | push (T &&data) |
A UT_RingBuffer is an indexable queue. The buffer uses indices that represent the insertion order of items in the buffer. The buffer may contain "holes", which have no associated data but still have an order number.
Definition at line 25 of file UT_RingBuffer.h.
UT_RingBuffer< T >::UT_RingBuffer | ( | ) |
Definition at line 21 of file UT_RingBuffer.C.
UT_RingBuffer< T >::UT_RingBuffer | ( | int | capacity | ) |
Definition at line 27 of file UT_RingBuffer.C.
UT_RingBuffer< T >::~UT_RingBuffer | ( | ) |
Definition at line 34 of file UT_RingBuffer.C.
|
inline |
Definition at line 95 of file UT_RingBuffer.h.
|
inline |
Definition at line 96 of file UT_RingBuffer.h.
void UT_RingBuffer< T >::clear | ( | void | ) |
Resets the buffer to an empty buffer with a 0 index.
Definition at line 76 of file UT_RingBuffer.C.
void UT_RingBuffer< T >::display | ( | ) | const |
Definition at line 107 of file UT_RingBuffer.C.
|
inline |
Definition at line 77 of file UT_RingBuffer.h.
|
inline |
In order to iterate over the contents of the ring buffer for (i = rbuf.frontId(); i <= rbuf.backId(); i++) element = rbuf(i); The backId is inclusive!!! There shouldn't be holes in the array.
Definition at line 93 of file UT_RingBuffer.h.
|
inline |
Definition at line 94 of file UT_RingBuffer.h.
|
inline |
Null-padded insertion. If the id of the incoming object is greater than the next order number that would be assigned by push(), holes are created in the buffer.
Definition at line 38 of file UT_RingBuffer.h.
|
inline |
Null-padded insertion. If the id of the incoming object is greater than the next order number that would be assigned by push(), holes are created in the buffer.
Definition at line 40 of file UT_RingBuffer.h.
|
inline |
Definition at line 83 of file UT_RingBuffer.h.
T UT_RingBuffer< T >::operator[] | ( | int | id | ) | const |
operator [] is the bounds checked version of the operator. The id is the order number of the object being indexed.
Definition at line 98 of file UT_RingBuffer.C.
|
inline |
Definition at line 78 of file UT_RingBuffer.h.
|
inline |
Pop a single element from the start of the buffer.
Definition at line 145 of file UT_RingBuffer.h.
void UT_RingBuffer< T >::pop | ( | int | number | ) |
Pop the next "number" elements from the buffer.
Definition at line 87 of file UT_RingBuffer.C.
|
inline |
Pop a single element from the back of the buffer.
Definition at line 156 of file UT_RingBuffer.h.
|
inline |
Pop the first element off the head of the list, moving the first entry to the next element.
Definition at line 53 of file UT_RingBuffer.h.
|
inline |
Insert the data into the buffer, and return the order number that it is assigned.
Definition at line 63 of file UT_RingBuffer.h.
|
inline |
Insert the data into the buffer, and return the order number that it is assigned.
Definition at line 64 of file UT_RingBuffer.h.
void UT_RingBuffer< T >::remove | ( | int | id | ) |
Remove item with id.
Definition at line 61 of file UT_RingBuffer.C.
|
inline |
Definition at line 76 of file UT_RingBuffer.h.