8 #ifndef RBTREE_ITER_MAX_HEIGHT
10 #define RBTREE_ITER_MAX_HEIGHT 64
int rbtree_tree_remove(rbtree_t *tree, void *value)
Removes the value from the given tree.
Definition: rbtree.c:409
void * rbtree_tree_find(rbtree_t *tree, void *value)
Searches the node inside the tree with the given value.
Definition: rbtree.c:197
rbtree_iter_t * rbtree_iter_create(void)
Allocate the memory for the iterator and initializes it.
Definition: rbtree.c:445
void rbtree_tree_print(rbtree_t *tree, rbtree_tree_node_f fun)
Prints the tree using the provided callback.
Definition: rbtree.c:593
void * rbtree_node_get_value(rbtree_node_t *node)
Provides access to the value associated to a node.
Definition: rbtree.c:64
rbtree_node_t * rbtree_node_init(rbtree_node_t *node, void *value)
Initializes the already allocated node.
Definition: rbtree.c:49
void(* rbtree_tree_node_f)(rbtree_t *tree, rbtree_node_t *node)
Callback to call on elements of the tree.
Definition: rbtree.h:30
void * rbtree_tree_find_by_value(rbtree_t *tree, rbtree_tree_cmp_f cmp_fun, void *value)
Searches the node inside the tree with the given value.
Definition: rbtree.c:218
rbtree_t * rbtree_tree_init(rbtree_t *tree, rbtree_tree_node_cmp_f cmp)
Initializes the tree.
Definition: rbtree.c:153
rbtree_t * rbtree_tree_alloc(void)
Allocate memory for a tree.
Definition: rbtree.c:148
rbtree_node_t * rbtree_node_alloc(void)
Allocate memory for a node.
Definition: rbtree.c:44
int(* rbtree_tree_node_cmp_f)(rbtree_t *tree, rbtree_node_t *a, rbtree_node_t *b)
Function for comparing elements in the tree.
Definition: rbtree.h:28
int rbtree_tree_remove_with_cb(rbtree_t *tree, void *value, rbtree_tree_node_f node_cb)
Removes the value from the tree.
Definition: rbtree.c:319
void rbtree_iter_dealloc(rbtree_iter_t *iter)
Deallocate the memory for the iterator.
Definition: rbtree.c:450
unsigned int rbtree_tree_size(rbtree_t *tree)
Returns the size of the tree.
Definition: rbtree.c:419
void rbtree_node_dealloc(rbtree_node_t *node)
Deallocate a node.
Definition: rbtree.c:72
void * rbtree_iter_first(rbtree_iter_t *iter, rbtree_t *tree)
Initializes the iterator the the first element of the tree.
Definition: rbtree.c:513
void rbtree_tree_dealloc(rbtree_t *tree, rbtree_tree_node_f node_cb)
Deallocate a node.
Definition: rbtree.c:168
rbtree_node_t * rbtree_node_create(void *value)
Allocate memory for a node and sets its value.
Definition: rbtree.c:59
rbtree_t * rbtree_tree_create(rbtree_tree_node_cmp_f cmp)
Allocate memory for a tree and sets the function used to compare nodes.
Definition: rbtree.c:163
int rbtree_tree_insert_node(rbtree_t *tree, rbtree_node_t *node)
Interts the value inside the tree.
Definition: rbtree.c:247
rbtree_iter_t * rbtree_iter_init(rbtree_iter_t *iter)
Deallocate the memory for the iterator.
Definition: rbtree.c:435
int(* rbtree_tree_cmp_f)(rbtree_t *tree, rbtree_node_t *a, void *arg)
Function for comparing elements in the tree.
Definition: rbtree.h:26
int rbtree_tree_insert(rbtree_t *tree, void *value)
Interts the value inside the tree.
Definition: rbtree.c:241
int rbtree_tree_test(rbtree_t *tree, rbtree_node_t *root)
Checks the tree.
Definition: rbtree.c:533
rbtree_iter_t * rbtree_iter_alloc(void)
Allocate the memory for the iterator.
Definition: rbtree.c:430
void * rbtree_iter_last(rbtree_iter_t *iter, rbtree_t *tree)
Initializes the iterator the the last element of the tree.
Definition: rbtree.c:518
void * rbtree_iter_next(rbtree_iter_t *iter)
Moves the iterator to the next element.
Definition: rbtree.c:523
void * rbtree_iter_prev(rbtree_iter_t *iter)
Moves the iterator to the previous element.
Definition: rbtree.c:528
Stores information for iterating a rbtree.
Definition: rbtree.c:33
rbtree_t * tree
Pointer to the tree itself.
Definition: rbtree.c:35
rbtree_node_t * node
Current node.
Definition: rbtree.c:37
Stores information of a node.
Definition: rbtree.c:13
Stores information of a rbtree.
Definition: rbtree.c:23