GRU - Generic Reusable Utilities
|
#include "gru_list.h"
Functions | |
gru_list_t * | gru_list_new (gru_status_t *status) |
Creates a new list. More... | |
void | gru_list_destroy (gru_list_t **list) |
Ensures that the list is properly destroyed. More... | |
uint32_t | gru_list_count (const gru_list_t *list) |
Returns the number of items in a list. More... | |
const gru_node_t * | gru_list_append (gru_list_t *list, const void *data) |
Appends an item in the list. More... | |
gru_node_t * | gru_list_insert (gru_list_t *list, const void *data, uint32_t position) |
Inserts an item in the list. More... | |
gru_node_t * | gru_list_remove (gru_list_t *list, uint32_t position) |
Removes an item from a list. More... | |
bool | gru_list_remove_item (gru_list_t *list, compare_function_t comparable, const void *other) |
Removes a node that matches a given data as returned by comparable. More... | |
const gru_node_t * | gru_list_get (const gru_list_t *list, uint32_t position) |
Gets a node from the list at the given position. More... | |
void | gru_list_for_each_compare (const gru_list_t *list, bool uniqueness, compare_function_t comparable, const void *other, void *result) |
Traverses the list comparing the data. More... | |
void | gru_list_for_each (const gru_list_t *list, handle_function_t handle, void *data) |
Traverses the list executing a set of operations. More... | |
void | gru_list_for_each_ex (const gru_list_t *list, handle_function_info_t handle, void *data) |
Traverses the list executing a set of operations and passes through node information (ie. More... | |
const void * | gru_list_get_item (const gru_list_t *list, compare_function_t comparable, const void *other) |
Traverses the list comparing the data. More... | |
const gru_node_t* gru_list_append | ( | gru_list_t * | list, |
const void * | data | ||
) |
Appends an item in the list.
list | The list to receive the new item |
data | The data for the new node |
uint32_t gru_list_count | ( | const gru_list_t * | list | ) |
Returns the number of items in a list.
list | A given list to check the number of items |
void gru_list_destroy | ( | gru_list_t ** | list | ) |
Ensures that the list is properly destroyed.
list | the list to destroy |
void gru_list_for_each | ( | const gru_list_t * | list, |
handle_function_t | handle, | ||
void * | data | ||
) |
Traverses the list executing a set of operations.
list | The list to be traversed |
handle | A pointer to a function of type handle_function_t |
data | Payload data for the true_handle and false_handle functions |
void gru_list_for_each_compare | ( | const gru_list_t * | list, |
bool | uniqueness, | ||
compare_function_t | comparable, | ||
const void * | compare, | ||
void * | result | ||
) |
Traverses the list comparing the data.
It aborts if the uniqueness is true and the comparison returns true
list | |
comparable | |
other | |
result |
void gru_list_for_each_ex | ( | const gru_list_t * | list, |
handle_function_info_t | handle, | ||
void * | data | ||
) |
Traverses the list executing a set of operations and passes through node information (ie.
: its position)
list | The list to be traversed |
handle | A pointer to a function of type handle_function_info_t |
data | Payload data for the true_handle and false_handle functions |
const gru_node_t* gru_list_get | ( | const gru_list_t * | list, |
uint32_t | position | ||
) |
Gets a node from the list at the given position.
list | the list |
position | the position |
const void* gru_list_get_item | ( | const gru_list_t * | list, |
compare_function_t | comparable, | ||
const void * | other | ||
) |
Traverses the list comparing the data.
It aborts if the uniqueness is true and the comparison returns true
list | |
comparable | |
other | |
result |
gru_node_t* gru_list_insert | ( | gru_list_t * | list, |
const void * | data, | ||
uint32_t | position | ||
) |
Inserts an item in the list.
list | The list to receive the new item |
data | The data for the new node |
position | The position to insert the data |
gru_list_t* gru_list_new | ( | gru_status_t * | status | ) |
Creates a new list.
gru_node_t* gru_list_remove | ( | gru_list_t * | list, |
uint32_t | position | ||
) |
Removes an item from a list.
list | The list to remove the item |
position | The position of the item to be removed |
bool gru_list_remove_item | ( | gru_list_t * | list, |
compare_function_t | comparable, | ||
const void * | other | ||
) |
Removes a node that matches a given data as returned by comparable.
list | The list to remove the node from |
comparable | The comparison function (void *result will be NULL) |
other | The data to compare the node with |