21#ifndef DATA_MANAGEMENT_QUEUE_HPP
22#define DATA_MANAGEMENT_QUEUE_HPP
37template <
typename T, u
int32 L>
65 int16
readBuffer(T* buffer, uint32 max_vals, uint32& num_vals_read);
74 int16
popBuffer(uint32 max_vals, uint32& num_vals_popped);
91 int16
peekBuffer(T* buffer, uint32 max_vals, uint32& num_vals_read);
117template <
typename T, u
int32 L>
137template <
typename T, u
int32 L>
139 if(buffer ==
nullptr) {
149 for(uint32 i = 0; i < size; i++) {
163template <
typename T, u
int32 L>
183template <
typename T, u
int32 L>
188 if(buffer ==
nullptr) {
198 if(num_vals_read > max_vals) {
199 num_vals_read = max_vals;
203 for(uint32 i = 0; i < num_vals_read; i++) {
219template <
typename T, u
int32 L>
237template <
typename T, u
int32 L>
248 if(num_vals_popped > max_vals) {
249 num_vals_popped = max_vals;
253 for(uint32 i = 0; i < num_vals_popped; i++) {
266template <
typename T, u
int32 L>
278template <
typename T, u
int32 L>
301template <
typename T, u
int32 L>
306 if(buffer ==
nullptr) {
316 if(num_vals_read > max_vals) {
317 num_vals_read = max_vals;
322 for(uint32 i = 0; i < num_vals_read; i++) {
337template <
typename T, u
int32 L>
uint32 valsHeld()
Get the number of values held by the queue.
Definition Queue.hpp:102
int16 peekBuffer(T *buffer, uint32 max_vals, uint32 &num_vals_read)
Read items from the queue without incrementing the read pointer.
Definition Queue.hpp:302
int16 peekIndex(uint32 index, T &instance)
Peek index relative to the read pointer without incrementing the read pointer.
Definition Queue.hpp:279
int16 peek(T &instance)
Read item from the queue without incrementing the read pointer.
Definition Queue.hpp:267
int16 read(T &instance)
Read item from the queue and increment the read pointer.
Definition Queue.hpp:164
int16 readBuffer(T *buffer, uint32 max_vals, uint32 &num_vals_read)
Read items from the queue into buffer and increment read pointer.
Definition Queue.hpp:184
int16 pop()
Function to pop one value from the queue and discard it.
Definition Queue.hpp:220
uint32 _read_idx
Index from which data should be read.
Definition Queue.hpp:108
int16 write(const T &instance)
Write a single data item into the queue.
Definition Queue.hpp:118
void clear()
Clear the queue entirely.
Definition Queue.hpp:338
uint32 _vals_available
Number of values available in the queue.
Definition Queue.hpp:111
int16 popBuffer(uint32 max_vals, uint32 &num_vals_popped)
Function to pop a specified number of values from the queue.
Definition Queue.hpp:238
Queue()
Definition Queue.hpp:41
int16 writeBuffer(const T *buffer, uint32 size)
Write a buffer of data items into the queue.
Definition Queue.hpp:138
T _buffer[L]
Data buffer to hold everything stored in the Queue.
Definition Queue.hpp:114
uint32 valsAvailable()
Get number of spaces in queue.
Definition Queue.hpp:98
uint32 _write_idx
Index to which new data should write.
Definition Queue.hpp:105
#define NO_ERROR
Error code in the case where matrix math executed successfully.
Definition clockwerkerrors.h:34
#define ERROR_NULLPTR
Error code in case of a null pointer.
Definition clockwerkerrors.h:60
#define ERROR_QUEUE_EMPTY
Error in case the queue is empty.
Definition clockwerkerrors.h:198
#define ERROR_QUEUE_FULL
Error in case the queue is full.
Definition clockwerkerrors.h:195
#define ERROR_INVALID_RANGE
Definition clockwerkerrors.h:53
Definition CircularBuffer.hpp:28