Kaa client C SDK
|
Go to the source code of this file.
Typedefs | |
typedef struct kaa_list_node_t | kaa_list_node_t |
typedef struct kaa_list_t | kaa_list_t |
typedef bool(* | match_predicate )(void *data, void *context) |
Return false if data doesn't match search criteria. More... | |
typedef void(* | deallocate_list_data )(void *) |
Use to deallocate list node data. More... | |
typedef uint64_t | list_node_hash (void *item) |
Returns list node hash. More... | |
typedef void(* | process_data )(void *data, void *context) |
Use to process element data. More... | |
Functions | |
kaa_list_t * | kaa_list_create (void) |
Creates empty list. More... | |
void | kaa_list_destroy (kaa_list_t *list, deallocate_list_data deallocator) |
Destroys list and all elements. More... | |
void | kaa_list_clear (kaa_list_t *list, deallocate_list_data deallocator) |
Removes all elements from the list (which are destroyed), and leaving the list with a size of 0. More... | |
size_t | kaa_list_get_size (kaa_list_t *list) |
Returns the number of elements in the list. More... | |
kaa_list_node_t * | kaa_list_push_front (kaa_list_t *list, void *data) |
Inserts a new element at the beginning of the list, right before its current first element. More... | |
kaa_list_node_t * | kaa_list_push_back (kaa_list_t *list, void *data) |
Inserts a new element at the end of the list, after its current last element. More... | |
kaa_list_node_t * | kaa_list_begin (kaa_list_t *list) |
Returns an iterator pointing to the first element in the list. More... | |
kaa_list_node_t * | kaa_list_back (kaa_list_t *list) |
Returns an iterator pointing to the last element in the list. More... | |
kaa_list_node_t * | kaa_list_next (kaa_list_node_t *it) |
Gets iterator to the next element. More... | |
kaa_list_node_t * | kaa_list_prev (kaa_list_node_t *it) |
Gets iterator to the previous element. More... | |
void * | kaa_list_get_data (kaa_list_node_t *it) |
Gets data from the iterator. More... | |
void | kaa_list_set_data_at (kaa_list_node_t *it, void *data, deallocate_list_data deallocator) |
Sets new data to the element. More... | |
kaa_list_node_t * | kaa_list_find_next (kaa_list_node_t *from, match_predicate pred, void *context) |
Returns an iterator to the first element in the list that matches by the predicate. More... | |
kaa_list_t * | kaa_lists_merge (kaa_list_t *destination, kaa_list_t *source) |
Merges the source list into the destination list by transferring all of its elements at their respective ordered positions at the end of the source list. More... | |
kaa_list_node_t * | kaa_list_remove_at (kaa_list_t *list, kaa_list_node_t *it, deallocate_list_data deallocator) |
Removes from the list a single element. More... | |
kaa_error_t | kaa_list_remove_first (kaa_list_t *list, match_predicate pred, void *context, deallocate_list_data deallocator) |
Removes from the list the first element for which the predicate returns true. More... | |
void | kaa_list_for_each (kaa_list_node_t *first, kaa_list_node_t *last, process_data process, void *context) |
Applies the function process to each of the elements in the range [first,last]. More... | |
void | kaa_list_sort (kaa_list_t *list, match_predicate pred) |
Sorts list according to predicate condition. More... | |
int32_t | kaa_list_hash (kaa_list_t *list, list_node_hash pred) |
Estimate hash from sorted array. More... | |
typedef void(* deallocate_list_data)(void *) |
Use to deallocate list node data.
typedef struct kaa_list_node_t kaa_list_node_t |
typedef struct kaa_list_t kaa_list_t |
typedef uint64_t list_node_hash(void *item) |
Returns list node hash.
typedef bool(* match_predicate)(void *data, void *context) |
Return false if data doesn't match search criteria.
typedef void(* process_data)(void *data, void *context) |
Use to process element data.
kaa_list_node_t* kaa_list_back | ( | kaa_list_t * | list | ) |
Returns an iterator pointing to the last element in the list.
NULL | the list is NULL |
kaa_list_node_t* kaa_list_begin | ( | kaa_list_t * | list | ) |
Returns an iterator pointing to the first element in the list.
NULL | the list is NULL |
void kaa_list_clear | ( | kaa_list_t * | list, |
deallocate_list_data | deallocator | ||
) |
Removes all elements from the list (which are destroyed), and leaving the list with a size of 0.
kaa_list_t* kaa_list_create | ( | void | ) |
Creates empty list.
void kaa_list_destroy | ( | kaa_list_t * | list, |
deallocate_list_data | deallocator | ||
) |
Destroys list and all elements.
kaa_list_node_t* kaa_list_find_next | ( | kaa_list_node_t * | from, |
match_predicate | pred, | ||
void * | context | ||
) |
Returns an iterator to the first element in the list that matches by the predicate.
NULL | no such element is found |
void kaa_list_for_each | ( | kaa_list_node_t * | first, |
kaa_list_node_t * | last, | ||
process_data | process, | ||
void * | context | ||
) |
Applies the function process to each of the elements in the range [first,last].
void* kaa_list_get_data | ( | kaa_list_node_t * | it | ) |
Gets data from the iterator.
NULL | the iterator is NULL |
size_t kaa_list_get_size | ( | kaa_list_t * | list | ) |
Returns the number of elements in the list.
NULL | the list is NULL |
int32_t kaa_list_hash | ( | kaa_list_t * | list, |
list_node_hash | pred | ||
) |
Estimate hash from sorted array.
list | List to calculate hash from. |
pred | Predicate that is used to get list node's hash, id or other unique uint64_t value. |
kaa_list_node_t* kaa_list_next | ( | kaa_list_node_t * | it | ) |
Gets iterator to the next element.
NULL | the provided iterator is NULL |
kaa_list_node_t* kaa_list_prev | ( | kaa_list_node_t * | it | ) |
Gets iterator to the previous element.
NULL | the provided iterator is NULL |
kaa_list_node_t* kaa_list_push_back | ( | kaa_list_t * | list, |
void * | data | ||
) |
Inserts a new element at the end of the list, after its current last element.
NULL | the list or data are NULL |
kaa_list_node_t* kaa_list_push_front | ( | kaa_list_t * | list, |
void * | data | ||
) |
Inserts a new element at the beginning of the list, right before its current first element.
NULL | the list or data are NULL |
kaa_list_node_t* kaa_list_remove_at | ( | kaa_list_t * | list, |
kaa_list_node_t * | it, | ||
deallocate_list_data | deallocator | ||
) |
Removes from the list a single element.
kaa_error_t kaa_list_remove_first | ( | kaa_list_t * | list, |
match_predicate | pred, | ||
void * | context, | ||
deallocate_list_data | deallocator | ||
) |
Removes from the list the first element for which the predicate returns true.
KAA_ERR_NONE | element was found |
void kaa_list_set_data_at | ( | kaa_list_node_t * | it, |
void * | data, | ||
deallocate_list_data | deallocator | ||
) |
Sets new data to the element.
Old data will be destroyed.
void kaa_list_sort | ( | kaa_list_t * | list, |
match_predicate | pred | ||
) |
Sorts list according to predicate condition.
list | List to sort. |
pred | Predicate that is used to sort list. |
kaa_list_t* kaa_lists_merge | ( | kaa_list_t * | destination, |
kaa_list_t * | source | ||
) |
Merges the source list into the destination list by transferring all of its elements at their respective ordered positions at the end of the source list.