Queue 2.0
Queue handling library
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
cppQueue Class Reference

Class containing the required methods for handling the queue. More...

#include <src/cppQueue.h>

Public Member Functions

 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.
 

Public Attributes

bool always_inline
 

Detailed Description

Class containing the required methods for handling the queue.

Constructor & Destructor Documentation

◆ 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::~cppQueue ( )

cppQueue destructor: release dynamically allocated queue

Member Function Documentation

◆ 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
Here is the call graph for this function:

◆ 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
trueif successfully dropped from queue
falseif queue is empty

◆ flush()

void cppQueue::flush ( void )

Flush queue, restarting from empty queue.

Here is the caller graph for this function:

◆ getCount()

uint16_t cppQueue::getCount ( void )

get number of records in the queue

Returns
Number of records stored in the queue
Here is the caller graph for this function:

◆ getRemainingCount()

uint16_t cppQueue::getRemainingCount ( void )

get number of records left in the queue

Returns
Number of records left in the queue
Here is the caller graph for this function:

◆ isEmpty()

bool cppQueue::isEmpty ( void )

get emptiness state of the queue

Returns
cppQueue emptiness status
Return values
trueif queue is empty
falseis not empty
Here is the caller graph for this function:

◆ isFull()

bool cppQueue::isFull ( void )

get fullness state of the queue

Returns
cppQueue fullness status
Return values
trueif queue is full
falseis not full
Here is the caller graph for this function:

◆ isInitialized()

bool cppQueue::isInitialized ( void )

get initialization state of the queue

Returns
cppQueue initialization status
Return values
trueif queue is allocated
falseis 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
Here is the call graph for this function:

◆ 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
trueif successfully peeked from queue
falseif queue is empty
Here is the caller graph for this function:

◆ 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
trueif successfully peeked from queue
falseif index is out of range
Here is the caller graph for this function:

◆ 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
trueif successfully peeked from queue
falseif queue is empty
Here is the caller graph for this function:

◆ 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
trueif successfully popped from queue
falseif queue is empty
Here is the caller graph for this function:

◆ 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
trueif successfully pulled from queue
falseif 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
trueif successfully pushed into queue
falseif queue is full
Here is the caller graph for this function:

◆ sizeOf()

uint32_t cppQueue::sizeOf ( void )

get size of queue

Remarks
Size in bytes (like sizeof)
Returns
Size of queue in bytes
Here is the caller graph for this function:

Member Data Documentation

◆ always_inline

bool cppQueue::always_inline
Initial value:
{
return pop(record)
bool pop(void *const record) __attribute__((nonnull))
Pop record from queue.

The documentation for this class was generated from the following file: