client-c
0.8.1
|
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. Old data will be destroyed. 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.
Definition at line 40 of file kaa_list.h.
typedef struct kaa_list_node_t kaa_list_node_t |
Copyright 2014-2016 CyberVision, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition at line 29 of file kaa_list.h.
typedef struct kaa_list_t kaa_list_t |
Definition at line 30 of file kaa_list.h.
typedef uint64_t list_node_hash(void *item) |
Returns list node hash.
Definition at line 45 of file kaa_list.h.
typedef bool(* match_predicate)(void *data, void *context) |
Return false if data doesn't match search criteria.
Definition at line 35 of file kaa_list.h.
typedef void(* process_data)(void *data, void *context) |
Use to process element data.
Definition at line 50 of file kaa_list.h.
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.
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.
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.