yumapro  24.10-3
YumaPro SDK
Loading...
Searching...
No Matches
Double Linked Queues

Linear queues used throughout the system (dlq_hdr_t). More...

Collaboration diagram for Double Linked Queues:

Data Structures

struct  dlq_hdrT
 dlq header used for both the control block for a queue and also a queue header node within another structure More...
 

Macros

#define dlq_nextEntry(nodeP)
 get the next queue entry after the current entry More...
 
#define dlq_prevEntry(nodeP)
 get the previous queue entry before the current entry More...
 
#define dlq_firstEntry(listP)
 get the first entry in the queue list More...
 
#define dlq_lastEntry(listP)
 get the last entry in the queue list More...
 
#define dlq_empty(listP)   (boolean)((listP)==((const dlq_hdrT *)(listP))->next)
 check if queue list is empty More...
 

Functions

dlq_hdrTdlq_createQue (void)
 create a dynamic queue header More...
 
void dlq_createSQue (dlq_hdrT *queAddr)
 create a static queue header More...
 
void dlq_destroyQue (dlq_hdrT *listP)
 free a dynamic queue header previously allocated with dlq_createQue More...
 
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 More...
 
void * dlq_deque (dlq_hdrT *listP)
 remove the first queue node from the queue list More...
 
void dlq_insertAhead (void *newP, void *nodeP)
 insert the new queue entry before the current entry More...
 
void dlq_insertAfter (void *newP, void *nodeP)
 insert the new queue entry after the current entry More...
 
void dlq_remove (void *nodeP)
 remove the queue entry from its queue list entry MUST have been enqueued somehow before this function is called More...
 
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 More...
 
void dlq_block_enque (dlq_hdrT *srcP, dlq_hdrT *dstP)
 add all the queue entries in the srcP queue list to the end of the dstP queue list More...
 
void dlq_block_insertAhead (dlq_hdrT *srcP, void *dstP)
 insert all the entries in the srcP queue list before the dstP queue entry More...
 
void dlq_block_insertAfter (dlq_hdrT *srcP, void *dstP)
 insert all the entries in the srcP queue list after the dstP queue entry More...
 
unsigned int dlq_count (const dlq_hdrT *listP)
 get the number of queue entries in the listP queue list More...
 
boolean dlq_onQueue (const dlq_hdrT *nodeP)
 Determine where a data node header is on a queue or not. More...
 
void dlq_reverse_que (dlq_hdr_t *que)
 Reverse the order of all the entries in a Q. More...
 

Detailed Description

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

Macro Definition Documentation

◆ dlq_empty

#define dlq_empty (   listP)    (boolean)((listP)==((const dlq_hdrT *)(listP))->next)

check if queue list is empty

Parameters
listPpointer 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
listPpointer 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
listPpointer 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
nodePpointer 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
nodePpointer to current queue entry to use
Returns
pointer to previous queue entry
NULL if the no previous entry was found

Function Documentation

◆ dlq_block_enque()

void dlq_block_enque ( dlq_hdrT srcP,
dlq_hdrT dstP 
)

add all the queue entries in the srcP queue list to the end of the dstP queue list

Parameters
srcPpointer to queue list entry to add end of dstP list
dstPpointer to queue list to add all newP entries
Here is the caller graph for this function:

◆ 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
srcPpointer to new queue list to insert all entries after dstP
dstPpointer to current queue entry to insert after
Here is the caller graph for this function:

◆ 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
srcPpointer to new queue list to insert all entries ahead of dstP
dstPpointer 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
listPpointer to queue list to check
Returns
number of queue entries found in listP queue

◆ dlq_createQue()

dlq_hdrT * dlq_createQue ( void  )

create a dynamic queue header

Returns
pointer to malloced queue header
NULL if memory error
Here is the caller graph for this function:

◆ dlq_createSQue()

void dlq_createSQue ( dlq_hdrT queAddr)

create a static queue header

Parameters
queAddrpointer to malloced queue header to initialize

◆ dlq_deque()

void * dlq_deque ( dlq_hdrT listP)

remove the first queue node from the queue list

Parameters
listPpointer to queue list remove the first entry
Returns
pointer to removed first entry
NULL if the queue was empty

◆ dlq_destroyQue()

void dlq_destroyQue ( dlq_hdrT listP)

free a dynamic queue header previously allocated with dlq_createQue

Parameters
listPpointer to malloced queue header to free
Here is the caller graph for this function:

◆ 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
newPpointer to queue entry to add
listPpointer 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
newPpointer to new queue entry to insert after nodeP
nodePpointer to current queue entry to insert after
Here is the caller graph for this function:

◆ dlq_insertAhead()

void dlq_insertAhead ( void *  newP,
void *  nodeP 
)

insert the new queue entry before the current entry

Parameters
newPpointer to new queue entry to insert ahead of nodeP
nodePpointer to current queue entry to insert ahead
Here is the caller graph for this function:

◆ dlq_onQueue()

boolean dlq_onQueue ( const dlq_hdrT nodeP)

Determine where a data node header is on a queue or not.

Parameters
nodePpointer 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
nodePpointer 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
queQ to reverse
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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_nodepointer to new queue entry to put into queue
cur_nodepointer to current queue entry to remove from queue
Here is the caller graph for this function: