cQueue 2.0
Queue handling library (written in plain c)
|
Queue handling library (written in plain c) More...
Macros | |
#define | QUEUE_INITIALIZED 0x5AA5U |
Initialized queue control value. | |
Functions | |
void * | q_init (Queue_t *const pQ, const size_t size_rec, const uint16_t nb_recs, const QueueType type, const bool overwrite) |
Queue initialization (using dynamic queue allocation) | |
void * | q_init_static (Queue_t *const pQ, const size_t size_rec, const uint16_t nb_recs, const QueueType type, const bool overwrite, void *const pQDat, const size_t lenQDat) |
Queue initialization (using static queue) | |
void | q_kill (Queue_t *const pQ) |
Queue destructor: release dynamically allocated queue. | |
void | q_flush (Queue_t *const pQ) |
Flush queue, restarting from empty queue. | |
bool | q_push (Queue_t *const pQ, const void *const record) |
Push record to queue. | |
bool | q_pop (Queue_t *const pQ, void *const record) |
Pop record from queue. | |
bool | q_peek (const Queue_t *const pQ, void *const record) |
Peek record from queue. | |
bool | q_drop (Queue_t *const pQ) |
Drop current record from queue. | |
bool | q_peekIdx (const Queue_t *const pQ, void *const record, const uint16_t idx) |
Peek record at index from queue. | |
bool | q_peekPrevious (const Queue_t *const pQ, void *const record) |
Peek previous record from queue. | |
bool | q_isInitialized (const Queue_t *const pQ) |
get initialization state of the queue | |
uint32_t | q_sizeof (const Queue_t *const pQ) |
get size of queue | |
bool | q_isEmpty (const Queue_t *const pQ) |
get emptiness state of the queue | |
bool | q_isFull (const Queue_t *const pQ) |
get fullness state of the queue | |
uint16_t | q_getCount (const Queue_t *const pQ) |
get number of records in the queue | |
uint16_t | q_getRemainingCount (const Queue_t *const pQ) |
get number of records left in the queue | |
Queue handling library (written in plain c)
Queue handling library (written in plain c)
#define QUEUE_INITIALIZED 0x5AA5U |
Initialized queue control value.
bool q_drop | ( | Queue_t *const | pQ | ) |
Drop current record from queue.
[in,out] | pQ | - pointer of queue to handle |
true | if successfully dropped from queue |
false | if queue is empty |
void q_flush | ( | Queue_t *const | pQ | ) |
Flush queue, restarting from empty queue.
[in,out] | pQ | - pointer of queue to handle |
uint16_t q_getCount | ( | const Queue_t *const | pQ | ) |
get number of records in the queue
[in] | pQ | - pointer of queue to handle |
uint16_t q_getRemainingCount | ( | const Queue_t *const | pQ | ) |
get number of records left in the queue
[in] | pQ | - pointer of queue to handle |
void * q_init | ( | Queue_t *const | pQ, |
const size_t | size_rec, | ||
const uint16_t | nb_recs, | ||
const QueueType | type, | ||
const bool | overwrite ) |
Queue initialization (using dynamic queue allocation)
[in,out] | pQ | - pointer of queue to handle |
[in] | size_rec | - size of a record in the queue (in bytes) |
[in] | nb_recs | - number of records in the queue |
[in] | type | - Queue implementation type: FIFO, LIFO |
[in] | overwrite | - Overwrite previous records when queue is full |
void * q_init_static | ( | Queue_t *const | pQ, |
const size_t | size_rec, | ||
const uint16_t | nb_recs, | ||
const QueueType | type, | ||
const bool | overwrite, | ||
void *const | pQDat, | ||
const size_t | lenQDat ) |
Queue initialization (using static queue)
[in,out] | pQ | - pointer of queue to handle |
[in] | size_rec | - size of a record in the queue (in bytes) |
[in] | nb_recs | - number of records in the queue |
[in] | type | - Queue 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 |
bool q_isEmpty | ( | const Queue_t *const | pQ | ) |
get emptiness state of the queue
[in] | pQ | - pointer of queue to handle |
true | if queue is empty |
false | is not empty |
bool q_isFull | ( | const Queue_t *const | pQ | ) |
get fullness state of the queue
[in] | pQ | - pointer of queue to handle |
true | if queue is full |
false | is not full |
bool q_isInitialized | ( | const Queue_t *const | pQ | ) |
get initialization state of the queue
[in] | pQ | - pointer of queue to handle |
true | if queue is allocated |
false | is queue is not allocated |
void q_kill | ( | Queue_t *const | pQ | ) |
Queue destructor: release dynamically allocated queue.
[in,out] | pQ | - pointer of queue to handle |
bool q_peek | ( | const Queue_t *const | pQ, |
void *const | record ) |
Peek record from queue.
[in] | pQ | - pointer of queue to handle |
[in,out] | record | - pointer to record to be peeked from queue |
true | if successfully peeked from queue |
false | if queue is empty |
bool q_peekIdx | ( | const Queue_t *const | pQ, |
void *const | record, | ||
const uint16_t | idx ) |
Peek record at index from queue.
[in] | pQ | - pointer of queue to handle |
[in,out] | record | - pointer to record to be peeked from queue |
[in] | idx | - index of the record to pick |
true | if successfully peeked from queue |
false | if index is out of range |
bool q_peekPrevious | ( | const Queue_t *const | pQ, |
void *const | record ) |
Peek previous record from queue.
[in] | pQ | - pointer of queue to handle |
[in,out] | record | - pointer to record to be peeked from queue |
true | if successfully peeked from queue |
false | if queue is empty |
bool q_pop | ( | Queue_t *const | pQ, |
void *const | record ) |
Pop record from queue.
[in] | pQ | - pointer of queue to handle |
[in,out] | record | - pointer to record to be popped from queue |
true | if successfully pulled from queue |
false | if queue is empty |
bool q_push | ( | Queue_t *const | pQ, |
const void *const | record ) |
Push record to queue.
[in,out] | pQ | - pointer of queue to handle |
[in] | record | - pointer to record to be pushed into queue |
true | if successfully pushed into queue |
false | if queue is full |
uint32_t q_sizeof | ( | const Queue_t *const | pQ | ) |
get size of queue
[in] | pQ | - pointer of queue to handle |