Class containing the required methods for handling the queue.
More...
#include <src/cppQueue.h>
|
| cppQueue (const size_t size_rec, const uint16_t nb_recs=20, const cppQueueType type=FIFO, const bool overwrite=false, void *const pQDat=NULL, const size_t lenQDat=0) |
| cppQueue constructor
|
|
| ~cppQueue () |
| cppQueue destructor: release dynamically allocated queue
|
|
void | flush (void) |
| Flush queue, restarting from empty queue.
|
|
void | clean (void) __attribute__((always_inline)) |
| Clean queue, restarting from empty queue.
|
|
bool | isInitialized (void) |
| get initialization state of the queue
|
|
bool | isEmpty (void) |
| get emptiness state of the queue
|
|
bool | isFull (void) |
| get fullness state of the queue
|
|
uint32_t | sizeOf (void) |
| get size of queue
|
|
uint16_t | getCount (void) |
| get number of records in the queue
|
|
uint16_t | nbRecs (void) __attribute__((always_inline)) |
| get number of records in the queue (same as getCount)
|
|
uint16_t | getRemainingCount (void) |
| get number of records left in the queue
|
|
bool | push (const void *const record) __attribute__((nonnull)) |
| Push record to queue.
|
|
bool | pop (void *const record) __attribute__((nonnull)) |
| Pop record from queue.
|
|
bool | pull (void *const record) __attribute__((nonnull |
| Pull record from queue (same as pop)
|
|
bool | peek (void *const record) __attribute__((nonnull)) |
| Peek record from queue.
|
|
bool | drop (void) |
| Drop current record from queue.
|
|
bool | peekIdx (void *const record, const uint16_t idx) __attribute__((nonnull)) |
| Peek record at index from queue.
|
|
bool | peekPrevious (void *const record) __attribute__((nonnull)) |
| Peek previous record from queue.
|
|
Class containing the required methods for handling the queue.
◆ cppQueue()
cppQueue::cppQueue |
( |
const size_t | size_rec, |
|
|
const uint16_t | nb_recs = 20, |
|
|
const cppQueueType | type = FIFO, |
|
|
const bool | overwrite = false, |
|
|
void *const | pQDat = NULL, |
|
|
const size_t | lenQDat = 0 ) |
cppQueue constructor
- Parameters
-
[in] | size_rec | - size of a record in the queue |
[in] | nb_recs | - number of records in the queue |
[in] | type | - cppQueue implementation type: FIFO, LIFO |
[in] | overwrite | - Overwrite previous records when queue is full |
[in] | pQDat | - Pointer to static data queue |
[in] | lenQDat | - Length of static data queue (in bytes) for static array size check against required size for queue |
- Returns
- nothing
◆ ~cppQueue()
cppQueue destructor: release dynamically allocated queue
◆ clean()
void cppQueue::clean |
( |
void | | ) |
|
|
inline |
Clean queue, restarting from empty queue.
- Deprecated
- clean was already used in cppQueue lib, alias is made to keep compatibility with earlier versions
◆ drop()
bool cppQueue::drop |
( |
void | | ) |
|
Drop current record from queue.
- Warning
- If using push, pop, peek, drop, peekItem and/or peekPrevious in both interrupts and main application, you shall disable interrupts in main application when using these functions
- Note
- This method is most likely to be used in conjunction with peek
- Returns
- drop status
- Return values
-
true | if successfully dropped from queue |
false | if queue is empty |
◆ flush()
void cppQueue::flush |
( |
void | | ) |
|
Flush queue, restarting from empty queue.
◆ getCount()
uint16_t cppQueue::getCount |
( |
void | | ) |
|
get number of records in the queue
- Returns
- Number of records stored in the queue
◆ getRemainingCount()
uint16_t cppQueue::getRemainingCount |
( |
void | | ) |
|
get number of records left in the queue
- Returns
- Number of records left in the queue
◆ isEmpty()
bool cppQueue::isEmpty |
( |
void | | ) |
|
get emptiness state of the queue
- Returns
- cppQueue emptiness status
- Return values
-
true | if queue is empty |
false | is not empty |
◆ isFull()
bool cppQueue::isFull |
( |
void | | ) |
|
get fullness state of the queue
- Returns
- cppQueue fullness status
- Return values
-
true | if queue is full |
false | is not full |
◆ isInitialized()
bool cppQueue::isInitialized |
( |
void | | ) |
|
get initialization state of the queue
- Returns
- cppQueue initialization status
- Return values
-
true | if queue is allocated |
false | is queue is not allocated |
◆ nbRecs()
uint16_t cppQueue::nbRecs |
( |
void | | ) |
|
|
inline |
get number of records in the queue (same as getCount)
- Deprecated
- nbRecs was already used in cppQueue lib, alias is made to keep compatibility with earlier versions
- Returns
- Number of records stored in the queue
◆ peek()
bool cppQueue::peek |
( |
void *const | record | ) |
|
Peek record from queue.
- Warning
- If using push, pop, peek, drop, peekItem and/or peekPrevious in both interrupts and main application, you shall disable interrupts in main application when using these functions
- Note
- This function is most likely to be used in conjunction with drop
- Parameters
-
[in,out] | record | - pointer to record to be peeked from queue |
- Returns
- Peek status
- Return values
-
true | if successfully peeked from queue |
false | if queue is empty |
◆ peekIdx()
bool cppQueue::peekIdx |
( |
void *const | record, |
|
|
const uint16_t | idx ) |
Peek record at index from queue.
- Warning
- If using push, pop, peek, drop, peekItem and/or peekPrevious in both interrupts and main application, you shall disable interrupts in main application when using these functions
- Note
- This function is only useful if searching for a duplicate record and shouldn't be used in conjunction with drop
- Parameters
-
[in,out] | record | - pointer to record to be peeked from queue |
[in] | idx | - index of the record to pick |
- Returns
- Peek status
- Return values
-
true | if successfully peeked from queue |
false | if index is out of range |
◆ peekPrevious()
bool cppQueue::peekPrevious |
( |
void *const | record | ) |
|
Peek previous record from queue.
- Warning
- If using push, pop, peek, drop, peekItem and/or peekPrevious in both interrupts and main application, you shall disable interrupts in main application when using these functions
- Note
- This inline is only useful with FIFO implementation, use peek instead with a LIFO (will lead to the same result)
- Parameters
-
[in,out] | record | - pointer to record to be peeked from queue |
- Returns
- Peek status
- Return values
-
true | if successfully peeked from queue |
false | if queue is empty |
◆ pop()
bool cppQueue::pop |
( |
void *const | record | ) |
|
Pop record from queue.
- Warning
- If using push, pop, peek, drop, peekItem and/or peekPrevious in both interrupts and main application, you shall disable interrupts in main application when using these functions
- Parameters
-
[in,out] | record | - pointer to record to be popped from queue |
- Returns
- Pop status
- Return values
-
true | if successfully popped from queue |
false | if queue is empty |
◆ pull()
bool cppQueue::pull |
( |
void *const | record | ) |
|
|
inline |
Pull record from queue (same as pop)
- Warning
- If using push, pop, peek, drop, peekItem and/or peekPrevious in both interrupts and main application, you shall disable interrupts in main application when using these functions
- Deprecated
- pull was already used in cppQueue lib, alias is made to keep compatibility with earlier versions
- Parameters
-
[in,out] | record | - pointer to record to be pulled from queue |
- Returns
- Pull status
- Return values
-
true | if successfully pulled from queue |
false | if queue is empty |
◆ push()
bool cppQueue::push |
( |
const void *const | record | ) |
|
Push record to queue.
- Parameters
-
[in] | record | - pointer to record to be pushed into queue |
- Returns
- Push status
- Return values
-
true | if successfully pushed into queue |
false | if queue is full |
◆ sizeOf()
uint32_t cppQueue::sizeOf |
( |
void | | ) |
|
get size of queue
- Returns
- Size of queue in bytes
◆ always_inline
bool cppQueue::always_inline |
Initial value:{
bool pop(void *const record) __attribute__((nonnull))
Pop record from queue.
The documentation for this class was generated from the following file: