Woolz Image Processing
Version 1.8.3
|
Files | |
file | AlcDLPList.c |
A general purpose doubly linked circular list of pointers. | |
Data Structures | |
struct | _AlcDLPItem |
A doubly linked list item. Typedef: AlcDLPItem. More... | |
struct | _AlcDLPList |
A doubly linked list of pointers. Typedef: AlcDLPList. More... | |
Functions | |
AlcDLPList * | AlcDLPListNew (AlcErrno *dstErr) |
Creates a list data structure which is required by all the other AlcDLPList functions. More... | |
AlcDLPItem * | AlcDLPItemNew (void *entry, void(*freeFn)(void *), AlcErrno *dstErr) |
Creates a list item data structure for building into a AlcDLPList list. More... | |
AlcErrno | AlcDLPListFree (AlcDLPList *list) |
Free's the given list data structure and any list items. More... | |
AlcErrno | AlcDLPListEntryInsert (AlcDLPList *list, AlcDLPItem *insBefore, void *entry, void(*freeFn)(void *)) |
Inserts the given entry into the list before the given item. More... | |
AlcErrno | AlcDLPListEntryAppend (AlcDLPList *list, AlcDLPItem *appAfter, void *entry, void(*freeFn)(void *)) |
Appends the given entry into the list after the given item. More... | |
AlcDLPItem * | AlcDLPItemUnlink (AlcDLPList *list, AlcDLPItem *item, int freeItem, AlcErrno *dstErr) |
Removes the item from the list, but does not free the item unless the freeItem flag is set. More... | |
AlcErrno | AlcDLPItemInsert (AlcDLPList *list, AlcDLPItem *insBefore, AlcDLPItem *newItem) |
Inserts a new item into the list before the given item. More... | |
AlcErrno | AlcDLPItemAppend (AlcDLPList *list, AlcDLPItem *appAfter, AlcDLPItem *newItem) |
Appends a new item into the list after the given item. More... | |
AlcErrno | AlcDLPItemFree (AlcDLPItem *item) |
Free's the list item which has already been removed from the list. More... | |
AlcErrno | AlcDLPListSort (AlcDLPList *list, int(*entryCompFn)(void *, void *)) |
Sorts the entire list using the given entry comparison function. More... | |
int | AlcDLPListCount (AlcDLPList *list, AlcErrno *dstErr) |
Returns the number of items in the list. More... | |
AlcDLPItem * | AlcDLPListIterate (AlcDLPList *list, AlcDLPItem *item, AlcDirection dir, int(*iterFn)(AlcDLPList *, AlcDLPItem *, void *), void *iterData, AlcErrno *dstErr) |
Iterates the given function through the list, starting with the given item. The iteration may proceed towards either the head or tail of the list. The iterated function must take the form. More... | |
AlcDLPList* AlcDLPListNew | ( | AlcErrno * | dstErr | ) |
Creates a list data structure which is required by all the other AlcDLPList functions.
dstErr | Destination pointer for error code, may be NULL. |
References ALC_ER_ALLOC, ALC_ER_NONE, and AlcCalloc().
Referenced by WlzMakePropertyList().
AlcDLPItem* AlcDLPItemNew | ( | void * | entry, |
void(*)(void *) | freeFn, | ||
AlcErrno * | dstErr | ||
) |
Creates a list item data structure for building into a AlcDLPList list.
entry | New list entry. |
freeFn | Function that will be called (if not NULL) to free the entry. |
dstErr | Destination pointer for error code, may be NULL. |
References ALC_ER_ALLOC, ALC_ER_NONE, AlcCalloc(), _AlcDLPItem::entry, and _AlcDLPItem::freeFn.
Referenced by AlcDLPListEntryAppend(), and AlcDLPListEntryInsert().
AlcErrno AlcDLPListFree | ( | AlcDLPList * | list | ) |
Free's the given list data structure and any list items.
list | The list data structure. |
References ALC_ER_NONE, ALC_ER_NULLPTR, AlcFree(), _AlcDLPItem::entry, _AlcDLPItem::freeFn, _AlcDLPList::head, and _AlcDLPItem::next.
Referenced by WlzFreePropertyList().
AlcErrno AlcDLPListEntryInsert | ( | AlcDLPList * | list, |
AlcDLPItem * | insBefore, | ||
void * | entry, | ||
void(*)(void *) | freeFn | ||
) |
Inserts the given entry into the list before the given item.
list | The list data structure. |
insBefore | Given item that entry is to be inserted before, if NULL then the item is inserted at the head of the list. |
entry | New list entry. |
freeFn | Function that will be called (if not NULL) to free the entry should the item be deleted. |
References ALC_ER_NONE, ALC_ER_NULLPTR, AlcDLPItemNew(), _AlcDLPList::head, _AlcDLPItem::next, and _AlcDLPItem::prev.
AlcErrno AlcDLPListEntryAppend | ( | AlcDLPList * | list, |
AlcDLPItem * | appAfter, | ||
void * | entry, | ||
void(*)(void *) | freeFn | ||
) |
Appends the given entry into the list after the given item.
list | The list data structure. |
appAfter | Given item that entry is to be inserted after, if NULL then the item is appended at the tail of the list. |
entry | New list entry. |
freeFn | Function that will be called (if not NULL) to free the entry should the item be deleted. |
References ALC_ER_NONE, ALC_ER_NULLPTR, AlcDLPItemNew(), _AlcDLPList::head, _AlcDLPItem::next, and _AlcDLPItem::prev.
AlcDLPItem* AlcDLPItemUnlink | ( | AlcDLPList * | list, |
AlcDLPItem * | item, | ||
int | freeItem, | ||
AlcErrno * | dstErr | ||
) |
Removes the item from the list, but does not free the item unless the freeItem flag is set.
list | The list data structure. |
item | Item to be removed. |
freeItem | Free item if non-zero. |
dstErr | Destination pointer for error code, may be NULL. |
References ALC_ER_NONE, ALC_ER_NULLPTR, AlcDLPItemFree(), _AlcDLPList::head, _AlcDLPItem::next, and _AlcDLPItem::prev.
Referenced by WlzRemoveProperty().
AlcErrno AlcDLPItemInsert | ( | AlcDLPList * | list, |
AlcDLPItem * | insBefore, | ||
AlcDLPItem * | newItem | ||
) |
Inserts a new item into the list before the given item.
list | The list data structure. |
insBefore | Given item that entry is to be inserted before, if NULL then the item is inserted at the head of the list. |
newItem | New item to insert. |
References ALC_ER_NONE, ALC_ER_NULLPTR, _AlcDLPList::head, _AlcDLPItem::next, and _AlcDLPItem::prev.
AlcErrno AlcDLPItemAppend | ( | AlcDLPList * | list, |
AlcDLPItem * | appAfter, | ||
AlcDLPItem * | newItem | ||
) |
Appends a new item into the list after the given item.
list | The list data structure. |
appAfter | Given item that entry is to be inserted after, if NULL then the item is appended at the tail of the list. |
newItem | New item to insert. |
References ALC_ER_NONE, ALC_ER_NULLPTR, _AlcDLPList::head, _AlcDLPItem::next, and _AlcDLPItem::prev.
AlcErrno AlcDLPItemFree | ( | AlcDLPItem * | item | ) |
Free's the list item which has already been removed from the list.
item | Item to be deleted. |
References ALC_ER_NONE, ALC_ER_NULLPTR, AlcFree(), _AlcDLPItem::entry, and _AlcDLPItem::freeFn.
Referenced by AlcDLPItemUnlink().
AlcErrno AlcDLPListSort | ( | AlcDLPList * | list, |
int(*)(void *, void *) | entryCompFn | ||
) |
Sorts the entire list using the given entry comparison function.
list | The list data structure. |
entryCompFn | Given entry comparison function which must return an integer less than, equal to, or greater than zero to indicate if the first entry is to be considered less than, equal to, or greater than the second. |
References ALC_ER_NONE, ALC_ER_NULLPTR, AlcDLPListCount(), and _AlcDLPList::head.
int AlcDLPListCount | ( | AlcDLPList * | list, |
AlcErrno * | dstErr | ||
) |
Returns the number of items in the list.
list | The list data structure. |
dstErr | Destination pointer for error code, may be NULL. |
References ALC_ER_NONE, ALC_ER_NULLPTR, _AlcDLPList::head, and _AlcDLPItem::next.
Referenced by AlcDLPListSort().
AlcDLPItem* AlcDLPListIterate | ( | AlcDLPList * | list, |
AlcDLPItem * | item, | ||
AlcDirection | dir, | ||
int(*)(AlcDLPList *, AlcDLPItem *, void *) | iterFn, | ||
void * | iterData, | ||
AlcErrno * | dstErr | ||
) |
Iterates the given function through the list, starting with the given item. The iteration may proceed towards either the head or tail of the list. The iterated function must take the form.
* int MyItemCount(AlcDLPList *list, * AlcDLPItem *item, * void *myData) * { * int *count; * * if(list && item) * { * count = (int *)myData; * ++*count; * } * return(list->head != item->next); * } *
Where the data parameter is the data supplied to this (AlcDLPListIterate) function. The iteration continues until the itterated function returns zero.
list | The list data structure. |
item | First item of iteration which may be NULL to indicate list head (dir == _TO_TAIL) or tail (dir == _TO_HEAD). |
dir | Iteration direction, either towards the head or the tail. |
iterFn | Function to be iterated, see example above. |
iterData | Data supplied to the iterated function. |
dstErr | Destination pointer for error code, may be NULL. |
References ALC_DIRECTION_FWD, ALC_DIRECTION_REV, ALC_ER_NONE, ALC_ER_NULLPTR, ALC_ER_PARAM, _AlcDLPList::head, _AlcDLPItem::next, and _AlcDLPItem::prev.