57 */ |
57 */ |
58 CxList cxLinkedListCreate( |
58 CxList cxLinkedListCreate( |
59 CxAllocator allocator, |
59 CxAllocator allocator, |
60 CxListComparator comparator, |
60 CxListComparator comparator, |
61 size_t item_size |
61 size_t item_size |
62 ); |
62 ) __attribute__((__nonnull__)); |
63 |
63 |
64 /** |
64 /** |
65 * Allocates a linked list for storing pointers. |
65 * Allocates a linked list for storing pointers. |
66 * |
66 * |
67 * If you want to store the elements directly in this list, use cxLinkedListCreate(). |
67 * If you want to store the elements directly in this list, use cxLinkedListCreate(). |
71 * @return the created list |
71 * @return the created list |
72 */ |
72 */ |
73 CxList cxPointerLinkedListCreate( |
73 CxList cxPointerLinkedListCreate( |
74 CxAllocator allocator, |
74 CxAllocator allocator, |
75 CxListComparator comparator |
75 CxListComparator comparator |
76 ); |
76 ) __attribute__((__nonnull__)); |
|
77 |
|
78 /** |
|
79 * Creates a linked list using the data from an array. |
|
80 * |
|
81 * @param allocator the allocator for allocating the list nodes |
|
82 * @param comparator the comparator for the elements |
|
83 * @param item_size the size of one item in the array |
|
84 * @param num_items the number of items |
|
85 * @param array the array data |
|
86 * @return the created list |
|
87 */ |
|
88 CxList cxLinkedListFromArray( |
|
89 CxAllocator allocator, |
|
90 CxListComparator comparator, |
|
91 size_t item_size, |
|
92 size_t num_items, |
|
93 const void *array |
|
94 ) __attribute__((__nonnull__)); |
77 |
95 |
78 /** |
96 /** |
79 * Deallocates the memory of the entire list. |
97 * Deallocates the memory of the entire list. |
80 * |
98 * |
81 * \attention If this is a pointer list, the memory the pointers are referring to is \em not freed. |
99 * \attention If this is a pointer list, the memory the pointers are referring to is \em not freed. |
82 * |
100 * |
83 * @param list the list |
101 * @param list the list |
84 */ |
102 */ |
85 void cxLinkedListDestroy(CxList list); |
103 void cxLinkedListDestroy(CxList list) __attribute__((__nonnull__)); |
86 |
104 |
87 /** |
105 /** |
88 * Finds the node at a certain index. |
106 * Finds the node at a certain index. |
89 * |
107 * |
90 * This function can be used to start at an arbitrary position within the list. |
108 * This function can be used to start at an arbitrary position within the list. |
384 |
402 |
385 |
403 |
386 /** |
404 /** |
387 * Compares two lists element wise. |
405 * Compares two lists element wise. |
388 * |
406 * |
|
407 * \note Both list must have the same structure. |
|
408 * |
389 * @param begin_left the begin of the left list (\c NULL denotes an empty list) |
409 * @param begin_left the begin of the left list (\c NULL denotes an empty list) |
390 * @param begin_right the begin of the right list (\c NULL denotes an empty list) |
410 * @param begin_right the begin of the right list (\c NULL denotes an empty list) |
391 * @param loc_advance the location of the pointer to advance |
411 * @param loc_advance the location of the pointer to advance |
392 * @param loc_data the location of the \c data pointer within your node struct |
412 * @param loc_data the location of the \c data pointer within your node struct |
393 * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func. |
413 * @param follow_ptr \c false if the pointer denoted by \p loc_data shall be passed to the \p cmp_func. |