|
CAEN Utility
2.0.2
Utilities for CAEN projects
|
Utilities to implement linked list. More...
Data Structures | |
| struct | c_listnode_t |
| struct | c_linkedlist_t |
Typedefs | |
| typedef struct c_listnode_t | c_listnode_t |
| typedef int(* | c_listdata_comparator_t) (const void *, const void *) |
Functions | |
| c_linkedlist_t | c_linkedlist_create () |
| c_listnode_t * | c_linkedlist_insert_after (c_listnode_t *node, void *newElement) |
| c_listnode_t * | c_linkedlist_insert_before (c_listnode_t *node, void *newElement) |
| c_Utility_ErrorCode_t | c_linkedlist_insert_last (c_linkedlist_t *list, void *newElement) |
| c_Utility_ErrorCode_t | c_linkedlist_insert_first (c_linkedlist_t *list, void *newElement) |
| void * | c_linkedlist_delete (c_linkedlist_t *list, c_listnode_t *node) |
| void * | c_linkedlist_delete_data_compare (c_linkedlist_t *list, void *data, c_listdata_comparator_t cmp) |
| void * | c_linkedlist_delete_data (c_linkedlist_t *list, void *data) |
| void * | c_linkedlist_delete_last (c_linkedlist_t *list) |
| void * | c_linkedlist_delete_first (c_linkedlist_t *list) |
Utilities to implement linked list.
| typedef struct c_listnode_t c_listnode_t |
| typedef int(* c_listdata_comparator_t) (const void *, const void *) |
Definition at line 63 of file CAENLinkedListTypes.h.
| c_linkedlist_t c_linkedlist_create | ( | ) |
Creates a new empty c_linkedlist_t
Definition at line 41 of file CAENLinkedList.c.
| c_listnode_t* c_linkedlist_insert_after | ( | c_listnode_t * | node, |
| void * | newElement | ||
| ) |
Inserts the given newElement AFTER the given node
| [in] | node | the node after which insert the new element |
| [in] | newElement | the data of the new element to be added |
Definition at line 46 of file CAENLinkedList.c.
| c_listnode_t* c_linkedlist_insert_before | ( | c_listnode_t * | node, |
| void * | newElement | ||
| ) |
Inserts the given newElement BEFORE the given node
| [in] | node | the node before which insert the new element |
| [in] | newElement | the data of the new element to be added |
Definition at line 64 of file CAENLinkedList.c.
| c_Utility_ErrorCode_t c_linkedlist_insert_last | ( | c_linkedlist_t * | list, |
| void * | newElement | ||
| ) |
Inserts the given newHead to the end of the list
| [in] | link | the linked list |
| [in] | newElement | the data of the new element to be added |
Definition at line 82 of file CAENLinkedList.c.
| c_Utility_ErrorCode_t c_linkedlist_insert_first | ( | c_linkedlist_t * | list, |
| void * | newElement | ||
| ) |
Inserts the given newHead to the begin of the list
| [in] | link | the linked list |
| [in] | newElement | the data of the new element to be added |
Definition at line 100 of file CAENLinkedList.c.
| void* c_linkedlist_delete | ( | c_linkedlist_t * | list, |
| c_listnode_t * | node | ||
| ) |
Deletes the given node, setting the references of previous and next elements and updating head and tail of linkedlist if necessary. NOTE: the data pointer is never free-ed.
| [in] | list | the linked list |
| [in] | node | the node to be deleted |
Definition at line 118 of file CAENLinkedList.c.
| void* c_linkedlist_delete_data_compare | ( | c_linkedlist_t * | list, |
| void * | data, | ||
| c_listdata_comparator_t | cmp | ||
| ) |
Deletes the first node starting from head whose 'data' field equals the given data. 'data' equality is evaluated using the given comparator. NOTE: references to head and tails are automatically updated. NOT automatically updated! NOTE: the data pointer is never free-ed.
| [in] | list | the linked list |
| [in] | data | the data to be found and removed from list |
| [in] | cmp | the data comparator. Should return non-zero when its two arguments are considered equal. NOTE: i-th element of list is passed to cmp as first argument, given 'data' as second. |
Definition at line 143 of file CAENLinkedList.c.
| void* c_linkedlist_delete_data | ( | c_linkedlist_t * | list, |
| void * | data | ||
| ) |
Deletes the first node starting from head whose 'data' field equals the given data. NOTE: references to head and tails are automatically updated. NOT automatically updated! NOTE: the data pointer is never free-ed.
| [in] | list | the linked list |
| [in] | data | the data to be found and removed from list |
Definition at line 155 of file CAENLinkedList.c.
| void* c_linkedlist_delete_last | ( | c_linkedlist_t * | list | ) |
Deletes the last element of the given c_linkedlist_t. NOTE: the data pointer is never free-ed.
| [in] | list | the linked list |
Definition at line 159 of file CAENLinkedList.c.
| void* c_linkedlist_delete_first | ( | c_linkedlist_t * | list | ) |
Deletes the first element of the given c_linkedlist_t. NOTE: the data pointer is never free-ed.
| [in] | list | the linked list |
Definition at line 174 of file CAENLinkedList.c.