![]() |
This is Unofficial EPICS BASE Doxygen Site
|
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. More... | |
#define | ELLLIST_INIT {ELLNODE_INIT, 0} |
Value of an empty list. More... | |
#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 struct ELLNODE | ELLNODE |
List node type. More... | |
typedef struct ELLLIST | ELLLIST |
List header type. More... | |
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... | |
A doubly-linked list library.
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 ellCount | ( | PLIST | ) | ((PLIST)->count) |
#define ellFirst | ( | PLIST | ) | ((PLIST)->node.next) |
#define ellFree | ( | PLIST | ) | ellFree2(PLIST, free) |
#define ellInit | ( | PLIST | ) |
Initialize a list type.
PLIST | Pointer to list header to be initialized |
#define ellLast | ( | PLIST | ) | ((PLIST)->node.previous) |
#define ELLLIST_INIT {ELLNODE_INIT, 0} |
#define ellNext | ( | PNODE | ) | ((PNODE)->next) |
#define ellPrevious | ( | PNODE | ) | ((PNODE)->previous) |
List node type.
A list node (an ELLNODE
) must be embedded in the structure to be placed on the list, ideally as the first member of that structure.
If the node is elsewhere in the structure, care must be taken to convert between the structure pointer and the node pointer and back every time when calling routines in the ellLib API. The ellFree() and ellFree2() routines cannot be used with such a list.
typedef void(* FREEFUNC) (void *) |
Pointer to free() for use by ellFree() macro.
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.
LIBCOM_API void ellExtract | ( | ELLLIST * | pSrcList, |
ELLNODE * | pStartNode, | ||
ELLNODE * | pEndNode, | ||
ELLLIST * | pDstList | ||
) |
Free all the nodes in a list.
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 |
Definition at line 282 of file ellLib.c.
Deletes and returns the first node from a list.
pList | Pointer to list from which to get node |
Definition at line 147 of file ellLib.c.
Inserts a node into a list immediately after a specific 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 Definition at line 178 of file ellLib.c.
Deletes and returns the last node from a list.
pList | Pointer to list from which to get node |
Definition at line 162 of file ellLib.c.
Stable (MergeSort) of a given list.
pList | Pointer to list to be sorted |
pListCmp | Compare function to be used |
Definition at line 30 of file ellSort.c.