![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
Simple first in, first out queue for data storage. More...
#include <Queue.hpp>

Public Member Functions | |
| Queue () | |
| int16 | write (const T &instance) |
| Write a single data item into the queue. | |
| int16 | writeBuffer (const T *buffer, uint32 size) |
| Write a buffer of data items into the queue. | |
| int16 | read (T &instance) |
| Read item from the queue and increment the read pointer. | |
| int16 | readBuffer (T *buffer, uint32 max_vals, uint32 &num_vals_read) |
| Read items from the queue into buffer and increment read pointer. | |
| int16 | pop () |
| Function to pop one value from the queue and discard it. | |
| int16 | popBuffer (uint32 max_vals, uint32 &num_vals_popped) |
| Function to pop a specified number of values from the queue. | |
| int16 | peek (T &instance) |
| Read item from the queue without incrementing the read pointer. | |
| int16 | peekIndex (uint32 index, T &instance) |
| Peek index relative to the read pointer without incrementing the read pointer. | |
| int16 | peekBuffer (T *buffer, uint32 max_vals, uint32 &num_vals_read) |
| Read items from the queue without incrementing the read pointer. | |
| void | clear () |
| Clear the queue entirely. | |
| uint32 | valsAvailable () |
| Get number of spaces in queue. | |
| uint32 | valsHeld () |
| Get the number of values held by the queue. | |
Protected Attributes | |
| uint32 | _write_idx = 0 |
| Index to which new data should write. | |
| uint32 | _read_idx = 0 |
| Index from which data should be read. | |
| uint32 | _vals_available = L |
| Number of values available in the queue. | |
| T | _buffer [L] |
| Data buffer to hold everything stored in the Queue. | |
Simple first in, first out queue for data storage.
The Queue class is a simple, templated, first in first out (FIFO) queue with modifiable type and size.
|
inline |
| void clockwerk::Queue< T, L >::clear | ( | ) |
Clear the queue entirely.
| int16 clockwerk::Queue< T, L >::peek | ( | T & | instance | ) |
Read item from the queue without incrementing the read pointer.
| instance | Implicit return of the value read from the queue |
| int16 clockwerk::Queue< T, L >::peekBuffer | ( | T * | buffer, |
| uint32 | max_vals, | ||
| uint32 & | num_vals_read ) |
Read items from the queue without incrementing the read pointer.
| buffer | The buffer to read items into |
| max_vals | The maximum number of values to read |
| num_vals_read | The number of values read out of the buffer |
| int16 clockwerk::Queue< T, L >::peekIndex | ( | uint32 | index, |
| T & | instance ) |
Peek index relative to the read pointer without incrementing the read pointer.
| index | Index to peek relative to read index |
| instance | Implicit return of the value read from the queue |
| int16 clockwerk::Queue< T, L >::pop | ( | ) |
Function to pop one value from the queue and discard it.
| int16 clockwerk::Queue< T, L >::popBuffer | ( | uint32 | max_vals, |
| uint32 & | num_vals_popped ) |
Function to pop a specified number of values from the queue.
| max_vals | The requested amount of values to pop |
| num_vals_popped | The actual amount of values popped |
| int16 clockwerk::Queue< T, L >::read | ( | T & | instance | ) |
Read item from the queue and increment the read pointer.
| instance | Implicit return of the value read from the queue |
| int16 clockwerk::Queue< T, L >::readBuffer | ( | T * | buffer, |
| uint32 | max_vals, | ||
| uint32 & | num_vals_read ) |
Read items from the queue into buffer and increment read pointer.
| buffer | The buffer to read items into |
| max_vals | The maximum number of values to read |
| num_vals_read | The number of values read out of the buffer |
|
inline |
Get number of spaces in queue.
|
inline |
Get the number of values held by the queue.
| int16 clockwerk::Queue< T, L >::write | ( | const T & | instance | ) |
Write a single data item into the queue.
| instance | The instance to write into the queue |
| int16 clockwerk::Queue< T, L >::writeBuffer | ( | const T * | buffer, |
| uint32 | size ) |
Write a buffer of data items into the queue.
| buffer | The buffer of data to write into the queue |
| size | The number of items to write into the queue |
|
protected |
Data buffer to hold everything stored in the Queue.
|
protected |
Index from which data should be read.
|
protected |
Number of values available in the queue.
|
protected |
Index to which new data should write.