EPICS Base
7.0.6.1
|
A doubly-linked list library. More...
#include "libComAPI.h"
Go to the source code of this file.
Classes | |
struct | ELLNODE |
List node type. More... | |
struct | ELLLIST |
List header type. More... | |
Macros | |
#define | ELLNODE_INIT {NULL, NULL} |
Value of a terminal node. | |
#define | ELLLIST_INIT {ELLNODE_INIT, 0} |
Value of an empty list. | |
#define | ellInit(PLIST) |
Initialize a list type. More... | |
#define | ellCount(PLIST) ((PLIST)->count) |
Report the number of nodes in a list. More... | |
#define | ellFirst(PLIST) ((PLIST)->node.next) |
Find the first node in list. More... | |
#define | ellLast(PLIST) ((PLIST)->node.previous) |
Find the last node in list. More... | |
#define | ellNext(PNODE) ((PNODE)->next) |
Find the next node in list. More... | |
#define | ellPrevious(PNODE) ((PNODE)->previous) |
Find the previous node in list. More... | |
#define | ellFree(PLIST) ellFree2(PLIST, free) |
Free up the list. More... | |
Typedefs | |
typedef void(* | FREEFUNC )(void *) |
Pointer to free() for use by ellFree() macro. More... | |
typedef int(* | pListCmp )(const ELLNODE *A, const ELLNODE *B) |
Functions | |
LIBCOM_API void | ellAdd (ELLLIST *pList, ELLNODE *pNode) |
Adds a node to the end of a list. More... | |
LIBCOM_API void | ellConcat (ELLLIST *pDstList, ELLLIST *pAddList) |
Concatenates a list to the end of another list. The list to be added is left empty. Either list (or both) can be empty at the beginning of the operation. More... | |
LIBCOM_API void | ellDelete (ELLLIST *pList, ELLNODE *pNode) |
Deletes a node from a list. More... | |
LIBCOM_API void | ellExtract (ELLLIST *pSrcList, ELLNODE *pStartNode, ELLNODE *pEndNode, ELLLIST *pDstList) |
Extract a sublist from a list. More... | |
LIBCOM_API ELLNODE * | ellGet (ELLLIST *pList) |
Deletes and returns the first node from a list. More... | |
LIBCOM_API ELLNODE * | ellPop (ELLLIST *pList) |
Deletes and returns the last node from a list. More... | |
LIBCOM_API void | ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode) |
Inserts a node into a list immediately after a specific node. More... | |
LIBCOM_API ELLNODE * | ellNth (ELLLIST *pList, int nodeNum) |
Find the Nth node in a list. More... | |
LIBCOM_API ELLNODE * | ellNStep (ELLNODE *pNode, int nStep) |
Find the list node nStep steps away from a specified node. More... | |
LIBCOM_API int | ellFind (ELLLIST *pList, ELLNODE *pNode) |
Find the index of a specific node in a list. More... | |
LIBCOM_API void | ellSortStable (ELLLIST *pList, pListCmp pListCmp) |
Stable (MergeSort) of a given list. More... | |
LIBCOM_API void | ellFree2 (ELLLIST *pList, FREEFUNC freeFunc) |
Free all the nodes in a list. More... | |
LIBCOM_API void | ellVerify (ELLLIST *pList) |
Verifies that the list is consistent. More... | |
This provides similar functionality to the VxWorks lstLib library.
Supports the creation and maintenance of a doubly-linked list. The user supplies a list descriptor (type ELLLIST
) that will contain pointers to the first and last nodes in the list, and a count of the number of nodes in the list. The nodes in the list can be any user-defined structure, but they must reserve space for two pointers as their first elements. Both the forward and backward chains are terminated with a NULL pointer.
Definition in file ellLib.h.
#define ellInit | ( | PLIST | ) |
#define ellCount | ( | PLIST | ) | ((PLIST)->count) |
#define ellFirst | ( | PLIST | ) | ((PLIST)->node.next) |
#define ellLast | ( | PLIST | ) | ((PLIST)->node.previous) |
#define ellNext | ( | PNODE | ) | ((PNODE)->next) |
#define ellPrevious | ( | PNODE | ) | ((PNODE)->previous) |
#define ellFree | ( | PLIST | ) | ellFree2(PLIST, free) |
typedef void(* FREEFUNC)(void *) |
This is required for use on Windows, where each DLL has its own free() function. The ellFree() macro passes the application's version of free() to the ellFree2() function.
pList | Pointer to list descriptor |
pNode | Pointer to node to be added |
pDstList | Destination list |
pAddList | List to be added to pDstList |
pList | Pointer to list descriptor |
pNode | Pointer to node to be deleted |
LIBCOM_API void ellExtract | ( | ELLLIST * | pSrcList, |
ELLNODE * | pStartNode, | ||
ELLNODE * | pEndNode, | ||
ELLLIST * | pDstList | ||
) |
pSrcList | Pointer to source list |
pStartNode | First node in pSrcList to be extracted |
pEndNode | Last node in pSrcList to be extracted |
pDstList | Pointer to list where to put extracted list |
pList | Pointer to list from which to get node |
pList | Pointer to list from which to get node |
plist | Pointer to list into which to insert node |
pPrev | Pointer to the node after which to insert |
pNode | Pointer to the node to be inserted |
pPrev
is NULL pNode
will be inserted at the head of the list pList | Pointer to list from which to find node |
nodeNum | Index of the node to be found |
nodeNum
in pList, or NULL if there is no such node in the list. pNode | The known node |
nStep | How many steps to take, may be negative to step backwards |
nStep
nodes from pNode
, or NULL if there is no such node in the list. pList | Pointer to list to search |
pNode | Pointer to node to search for |
LIBCOM_API void ellSortStable | ( | ELLLIST * | pList, |
pListCmp | pListCmp | ||
) |
pList | Pointer to list to be sorted |
pListCmp | Compare function to be used |
This routine empties a list, calling freeFunc() for every node on it.
pList | List from which to free all nodes |
freeFunc | The free() routine to be called |
LIBCOM_API void ellVerify | ( | ELLLIST * | pList | ) |
pList | List to be verified |