1.2.12.4.4 SRV_QUEUE_Insert_Before Function
C
void SRV_QUEUE_Insert_Before(
SRV_QUEUE *queue,
SRV_QUEUE_ELEMENT *currentElement,
SRV_QUEUE_ELEMENT *element
);
Summary
Inserts an element into a queue before a given element.
Description
This function inserts an element into a queue before a given element.
Precondition
The queue must have been initialized previously with function SRV_QUEUE_Init.
Parameters
Param | Description |
---|---|
queue | Pointer to the queue where to insert the element |
currentElement | Pointer to an element in the queue |
element | Pointer to the element to be inserted |
Returns
None.
Example
#define NUM_MAX_NODES 750 typedef struct _node_info_tag { struct _node_info_tag *prev; struct _node_info_tag *next; uint8_t macAddress[8] } NODE_INFO; static SRV_QUEUE nodeQueue; static NODE_INFO nodeInfo1; static NODE_INFO nodeInfo2; SRV_QUEUE_Init(&nodeQueue, NUM_MAX_NODES, SRV_QUEUE_TYPE_SINGLE); memset(nodeInfo1.macAddress, 0xFF, 8); SRV_QUEUE_Append(&nodeQueue, (SRV_QUEUE_ELEMENT *)&nodeInfo1); memset(nodeInfo2.macAddress, 0xEE, 8); SRV_QUEUE_Insert_Before(&nodeQueue, (SRV_QUEUE_ELEMENT *)&nodeInfo1, (SRV_QUEUE_ELEMENT *)&nodeInfo2);
Remarks
None.