libamxc
1.10.3
C Generic Data Containers
|
Data Structures | |
struct | _amxc_llist_it |
The linked list iterator structure. More... | |
Macros | |
#define | amxc_llist_it_get_data(it, type, member) amxc_container_of(it, type, member) |
Gets the data pointer from a linked list iterator. More... | |
Typedefs | |
typedef struct _amxc_llist_it | amxc_llist_it_t |
The linked list iterator structure. More... | |
typedef int(* | amxc_llist_it_cmp_t) (amxc_llist_it_t *it1, amxc_llist_it_t *it2) |
Type definition of a linked list iterator compare callback function. More... | |
Functions | |
int | amxc_llist_it_init (amxc_llist_it_t *const it) |
Initializes a linked list iterator. More... | |
void | amxc_llist_it_clean (amxc_llist_it_t *const it, amxc_llist_it_delete_t func) |
Removes the iterator from the list and frees allocated memory. More... | |
void | amxc_llist_it_take (amxc_llist_it_t *const it) |
Removes the iterator from the list. More... | |
int | amxc_llist_it_insert_before (amxc_llist_it_t *const reference, amxc_llist_it_t *const it) |
Inserts an iterator before a reference interator in the list. More... | |
int | amxc_llist_it_insert_after (amxc_llist_it_t *const reference, amxc_llist_it_t *const it) |
Inserts an iterator after another reference interator in the list. More... | |
unsigned int | amxc_llist_it_index_of (const amxc_llist_it_t *const it) |
Gets the index of an iterator in the list. More... | |
int | amxc_llist_it_swap (amxc_llist_it_t *it1, amxc_llist_it_t *it2) |
Swaps two linked list iterators. More... | |
AMXC_INLINE amxc_llist_it_t * | amxc_llist_it_get_next (const amxc_llist_it_t *const reference) |
Gets the next iterator in the list. More... | |
AMXC_INLINE amxc_llist_it_t * | amxc_llist_it_get_previous (const amxc_llist_it_t *const reference) |
Gets the previous iterator in the list. More... | |
AMXC_INLINE bool | amxc_llist_it_is_in_list (const amxc_llist_it_t *const it) |
Checks that an iterator is in a list. More... | |
#define amxc_llist_it_get_data | ( | it, | |
type, | |||
member | |||
) | amxc_container_of(it, type, member) |
Gets the data pointer from a linked list iterator.
Definition at line 238 of file amxc_llist.h.
typedef int(* amxc_llist_it_cmp_t) (amxc_llist_it_t *it1, amxc_llist_it_t *it2) |
Type definition of a linked list iterator compare callback function.
When sorting a linked list, the items in the list (iterators) must be compared. When calling amxc_llist_sort a compare function must be provided using this signature.
it1 | the first linked list iterator |
it2 | the second linked list iterator |
Definition at line 336 of file amxc_llist.h.
typedef struct _amxc_llist_it amxc_llist_it_t |
The linked list iterator structure.
void amxc_llist_it_clean | ( | amxc_llist_it_t *const | it, |
amxc_llist_it_delete_t | func | ||
) |
Removes the iterator from the list and frees allocated memory.
If the iterator is in a list, it is removed from the list, when a delete function is provided, it is called to free up the memory.
it | a pointer to the linked list iterator structure |
func | a pointer to a function that is called to free the linked list item |
Definition at line 103 of file amxc_llist_it.c.
AMXC_INLINE amxc_llist_it_t* amxc_llist_it_get_next | ( | const amxc_llist_it_t *const | reference | ) |
Gets the next iterator in the list.
This function does not remove the item from the linked list.
reference | a pointer to the linked list structure used as reference |
Definition at line 824 of file amxc_llist.h.
AMXC_INLINE amxc_llist_it_t* amxc_llist_it_get_previous | ( | const amxc_llist_it_t *const | reference | ) |
Gets the previous iterator in the list.
This function does not remove the item from the linked list.
reference | a pointer to the linked list structure used as reference |
Definition at line 842 of file amxc_llist.h.
unsigned int amxc_llist_it_index_of | ( | const amxc_llist_it_t *const | it | ) |
Gets the index of an iterator in the list.
it | a pointer to the linked list iterator structure for which the index needs to be calculated |
Definition at line 182 of file amxc_llist_it.c.
int amxc_llist_it_init | ( | amxc_llist_it_t *const | it | ) |
Initializes a linked list iterator.
Initializes the linked list iterator structure. All pointers are reset to NULL.
it | a pointer to the linked list iterator structure. |
Definition at line 89 of file amxc_llist_it.c.
int amxc_llist_it_insert_after | ( | amxc_llist_it_t *const | reference, |
amxc_llist_it_t *const | it | ||
) |
Inserts an iterator after another reference interator in the list.
If the iterator(it) is already in the list, it is first removed from the list before it is inserted at the correct position.
reference | a pointer to the linked list iterator structure that is used as reference |
it | a pointer to the linked list iterator structure that needs to be inserted |
Definition at line 157 of file amxc_llist_it.c.
int amxc_llist_it_insert_before | ( | amxc_llist_it_t *const | reference, |
amxc_llist_it_t *const | it | ||
) |
Inserts an iterator before a reference interator in the list.
If the iterator is already in a list, it is first removed from the list.
reference | a pointer to the linked list iterator structure that is used as reference |
it | a pointer to the linked list iterator structure that needs to be inserted |
Definition at line 132 of file amxc_llist_it.c.
AMXC_INLINE bool amxc_llist_it_is_in_list | ( | const amxc_llist_it_t *const | it | ) |
Checks that an iterator is in a list.
it | a pointer to the linked list structure. |
Definition at line 857 of file amxc_llist.h.
int amxc_llist_it_swap | ( | amxc_llist_it_t * | it1, |
amxc_llist_it_t * | it2 | ||
) |
Swaps two linked list iterators.
The iterators being swapped can be in the same linked list or in different linked lists.
it1 | a pointer to the linked list iterator |
it2 | a pointer to the linked list iterator |
Definition at line 200 of file amxc_llist_it.c.
void amxc_llist_it_take | ( | amxc_llist_it_t *const | it | ) |
Removes the iterator from the list.
it | a pointer to the linked list iterator structure |
Definition at line 110 of file amxc_llist_it.c.