Skyward boardcore
|
#include <contiguous_queue.h>
Public Member Functions | |
ContiguousQueue () | |
T * | addEnd () |
T * | removeEnd () |
const T * | removeEnd () const |
unsigned int | availableToAdd () const |
unsigned int | availableToRemove () const |
void | added (unsigned int n) |
void | removed (unsigned int n) |
A fixed size FIFO queue whose elements are stored in a contiguous array, which allows direct access to the array in order to add/remove multiple elements.
NOTE: This queue is most efficent if the data is removed form the queue in large chunks. Removing one element at a time is most inefficient since shifting all the other elements in the queue is needed. There are no performance constraints on inserting.
The queue is not synchronized.
T | type of the element |
N | maximum number of elements (fixed size queue) |
Definition at line 46 of file contiguous_queue.h.
|
inline |
Constructor
Definition at line 52 of file contiguous_queue.h.
|
inline |
After having added elements to the pointer obtained through addEnd(), call this function to let the queue know how many elements have been added
n | elements added |
range_error | if too many elements were addded. Memory corruption has already occurred at this point, though |
Definition at line 104 of file contiguous_queue.h.
|
inline |
NOTE: if availableToAdd() returns 0 the pointer is past the end of the array and should not be dereferenced
Definition at line 62 of file contiguous_queue.h.
|
inline |
Definition at line 89 of file contiguous_queue.h.
|
inline |
Definition at line 94 of file contiguous_queue.h.
|
inline |
After having removed elements to the pointer obtained through removeEnd(), call this function to let the queue know how many elements have been added removed
n | elements removed |
range_error | if too many elements were removed. Memory corruption has already occurred at this point, though |
Definition at line 119 of file contiguous_queue.h.
|
inline |
NOTE: if availableToRemove() returns 0 the pointer should not be dereferenced
Definition at line 73 of file contiguous_queue.h.
|
inline |
NOTE: if availableToRemove() returns 0 the pointer should not be dereferenced
Definition at line 84 of file contiguous_queue.h.