Linear queues used throughout the system (dlq_hdr_t).
More...
|
struct | dlq_hdrT |
| dlq header used for both the control block for a queue and also a queue header node within another structure More...
|
|
Linear queues used throughout the system (dlq_hdr_t).
The same header is used for managing a queue as the embedded header in each struct in the queue.
The following list of functions summarizes this module.
API Functions
=============
QUEUE initialization/cleanup
dlq_createQue - create and initialize dynamic queue hdr
dlq_destroyQue - destroy previously created dynamic queue
dlq_createSQue - initialize static queue hdr, no destroy needed
FIFO queue operations
dlq_enque - add node to end of list
dlq_block_enque - add N nodes to end of list
dlq_deque - return first node, remove from list
TEST queue operations
dlq_empty - return TRUE if queue is empty, FALSE otherwise
LINEAR search (linked list)
dlq_nextEntry - return node AFTER param node - leave in list
dlq_prevEntry - return node BEFORE param node - leave in list
dlq_firstEntry - return first node in the Q
dlq_lastEntry - return last node in the Q
Q INSERTION operations
dlq_insertAhead - add node in list ahead of param node
dlq_insertAfter - add node in list after param node
dlq_block_insertAhead - add N nodes in list ahead of param node
dlq_block_insertAfter - add N nodes in list after param node
Q DELETION operations
dlq_remove - remove a node from a linked list
Q DEBUG operations
dlq_dumpHdr - printf Q header info (CPP_DEBUG required)
CPP Macros Used:
================
CPP_DEBUG - enables debug code
CPP_NO_MACROS - forces function calls instead of macros for
some functions. Should not be used except in some debug modes
CPP_ICHK - this will force function calls instead of macros and
enable lots of parameter checking (internal checks). Should
only be used for unit test debugging
ENTER_CRIT - this macro hook can be set to call an enter critical
section function for thread-safe queueing
EXIT_CRIT - this macro hook can be set to call an exit critical
section function for thread-safe queueing
◆ dlq_empty
#define dlq_empty |
( |
|
listP | ) |
(boolean)((listP)==((const dlq_hdrT *)(listP))->next) |
check if queue list is empty
- Parameters
-
listP | pointer to queue list to check |
- Returns
- TRUE if queue is empty
FALSE if queue is not empty
◆ dlq_firstEntry
#define dlq_firstEntry |
( |
|
listP | ) |
|
Value: ((listP) != ((
const dlq_hdrT *)(listP))->next ? \
((
const dlq_hdrT *)(listP))->next : NULL)
dlq header used for both the control block for a queue and also a queue header node within another st...
Definition: dlq.h:155
get the first entry in the queue list
- Parameters
-
listP | pointer to queue list to get the first entry from |
- Returns
- pointer to first queue entry
NULL if the queue is empty
◆ dlq_lastEntry
#define dlq_lastEntry |
( |
|
listP | ) |
|
Value: ((listP) != ((
const dlq_hdrT *)(listP))->next ? \
((
const dlq_hdrT *)(listP))->prev : NULL)
get the last entry in the queue list
- Parameters
-
listP | pointer to queue list to get the last entry from |
- Returns
- pointer to last queue entry
NULL if the queue is empty
◆ dlq_nextEntry
#define dlq_nextEntry |
( |
|
nodeP | ) |
|
Value: (_data_node(((
const dlq_hdrT *) (nodeP))->next) ? \
((
const dlq_hdrT *) (nodeP))->next : NULL)
get the next queue entry after the current entry
- Parameters
-
nodeP | pointer to current queue entry to use |
- Returns
- pointer to next queue entry
NULL if the no next entry was found
◆ dlq_prevEntry
#define dlq_prevEntry |
( |
|
nodeP | ) |
|
Value: (_data_node(((
const dlq_hdrT *) (nodeP))->prev ) ? \
((
const dlq_hdrT *) (nodeP))->prev : NULL)
get the previous queue entry before the current entry
- Parameters
-
nodeP | pointer to current queue entry to use |
- Returns
- pointer to previous queue entry
NULL if the no previous entry was found
◆ dlq_block_enque()
add all the queue entries in the srcP queue list to the end of the dstP queue list
- Parameters
-
srcP | pointer to queue list entry to add end of dstP list |
dstP | pointer to queue list to add all newP entries |
◆ dlq_block_insertAfter()
void dlq_block_insertAfter |
( |
dlq_hdrT * |
srcP, |
|
|
void * |
dstP |
|
) |
| |
insert all the entries in the srcP queue list after the dstP queue entry
- Parameters
-
srcP | pointer to new queue list to insert all entries after dstP |
dstP | pointer to current queue entry to insert after |
◆ dlq_block_insertAhead()
void dlq_block_insertAhead |
( |
dlq_hdrT * |
srcP, |
|
|
void * |
dstP |
|
) |
| |
insert all the entries in the srcP queue list before the dstP queue entry
- Parameters
-
srcP | pointer to new queue list to insert all entries ahead of dstP |
dstP | pointer to current queue entry to insert ahead |
◆ dlq_count()
unsigned int dlq_count |
( |
const dlq_hdrT * |
listP | ) |
|
get the number of queue entries in the listP queue list
- Parameters
-
listP | pointer to queue list to check |
- Returns
- number of queue entries found in listP queue
◆ dlq_createQue()
create a dynamic queue header
- Returns
- pointer to malloced queue header
NULL if memory error
◆ dlq_createSQue()
void dlq_createSQue |
( |
dlq_hdrT * |
queAddr | ) |
|
create a static queue header
- Parameters
-
queAddr | pointer to malloced queue header to initialize |
◆ dlq_deque()
remove the first queue node from the queue list
- Parameters
-
listP | pointer to queue list remove the first entry |
- Returns
- pointer to removed first entry
NULL if the queue was empty
◆ dlq_destroyQue()
free a dynamic queue header previously allocated with dlq_createQue
- Parameters
-
listP | pointer to malloced queue header to free |
◆ dlq_enque()
void dlq_enque |
( |
REG void * |
newP, |
|
|
REG dlq_hdrT * |
listP |
|
) |
| |
add a queue node to the end of a queue list Add newP to listP
- Parameters
-
newP | pointer to queue entry to add |
listP | pointer to queue list to put newP |
◆ dlq_insertAfter()
void dlq_insertAfter |
( |
void * |
newP, |
|
|
void * |
nodeP |
|
) |
| |
insert the new queue entry after the current entry
- Parameters
-
newP | pointer to new queue entry to insert after nodeP |
nodeP | pointer to current queue entry to insert after |
◆ dlq_insertAhead()
void dlq_insertAhead |
( |
void * |
newP, |
|
|
void * |
nodeP |
|
) |
| |
insert the new queue entry before the current entry
- Parameters
-
newP | pointer to new queue entry to insert ahead of nodeP |
nodeP | pointer to current queue entry to insert ahead |
◆ dlq_onQueue()
boolean dlq_onQueue |
( |
const dlq_hdrT * |
nodeP | ) |
|
Determine where a data node header is on a queue or not.
- Parameters
-
nodeP | pointer to data node to check |
- Returns
- TRUE: On a list
FALSE: Not on a list
◆ dlq_remove()
void dlq_remove |
( |
void * |
nodeP | ) |
|
remove the queue entry from its queue list entry MUST have been enqueued somehow before this function is called
- Parameters
-
nodeP | pointer to queue entry to remove from queue |
◆ dlq_reverse_que()
void dlq_reverse_que |
( |
dlq_hdr_t * |
que | ) |
|
Reverse the order of all the entries in a Q.
- Parameters
-
◆ dlq_swap()
void dlq_swap |
( |
void * |
new_node, |
|
|
void * |
cur_node |
|
) |
| |
remove the cur_node queue entry from its queue list and replace it with the new_node
cur_node entry MUST have been enqueued somehow before this function is called. new_node MUST NOT already be in a queue
- Parameters
-
new_node | pointer to new queue entry to put into queue |
cur_node | pointer to current queue entry to remove from queue |