Typedefs | |
typedef cxbool(* | cx_tree_compare_func )(cxcptr, cxcptr) |
The tree's key comparison operator function. | |
Functions | |
cx_tree_iterator | cx_tree_begin (const cx_tree *tree) |
Get an iterator to the first pair in the tree. | |
cx_tree_iterator | cx_tree_end (const cx_tree *tree) |
Get an iterator for the position after the last pair in the tree. | |
cx_tree_iterator | cx_tree_next (const cx_tree *tree, cx_tree_const_iterator position) |
Get an iterator for the next pair in the tree. | |
cx_tree_iterator | cx_tree_previous (const cx_tree *tree, cx_tree_const_iterator position) |
Get an iterator for the previous pair in the tree. | |
void | cx_tree_clear (cx_tree *tree) |
Remove all pairs from a tree. | |
cxbool | cx_tree_empty (const cx_tree *tree) |
Check whether a tree is empty. | |
cx_tree * | cx_tree_new (cx_tree_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy) |
Create a new tree without any elements. | |
void | cx_tree_delete (cx_tree *tree) |
Destroy a tree and all its elements. | |
cxsize | cx_tree_size (const cx_tree *tree) |
Get the actual number of pairs in the tree. | |
cxsize | cx_tree_max_size (const cx_tree *tree) |
Get the maximum number of pairs possible. | |
cx_tree_compare_func | cx_tree_key_comp (const cx_tree *tree) |
Get the key comparison function. | |
void | cx_tree_swap (cx_tree *tree1, cx_tree *tree2) |
Swap the contents of two trees. | |
cxptr | cx_tree_assign (cx_tree *tree, cx_tree_iterator position, cxcptr data) |
Assign data to an iterator position. | |
cxptr | cx_tree_get_key (const cx_tree *tree, cx_tree_const_iterator position) |
Get the key from a given iterator position. | |
cxptr | cx_tree_get_value (const cx_tree *tree, cx_tree_const_iterator position) |
Get the data from a given iterator position. | |
cx_tree_iterator | cx_tree_find (const cx_tree *tree, cxcptr key) |
Locate an element in the tree. | |
cx_tree_iterator | cx_tree_lower_bound (const cx_tree *tree, cxcptr key) |
Find the beginning of a subsequence. | |
cx_tree_iterator | cx_tree_upper_bound (const cx_tree *tree, cxcptr key) |
Find the end of a subsequence. | |
void | cx_tree_equal_range (const cx_tree *tree, cxcptr key, cx_tree_iterator *begin, cx_tree_iterator *end) |
Find a subsequence matching a given key. | |
cxsize | cx_tree_count (const cx_tree *tree, cxcptr key) |
Get the number of elements matching a key. | |
cx_tree_iterator | cx_tree_insert_unique (cx_tree *tree, cxcptr key, cxcptr data) |
Attempt to insert data into a tree. | |
cx_tree_iterator | cx_tree_insert_equal (cx_tree *tree, cxcptr key, cxcptr data) |
Insert data into a tree. | |
void | cx_tree_erase_position (cx_tree *tree, cx_tree_iterator position) |
Erase an element from a tree. | |
void | cx_tree_erase_range (cx_tree *tree, cx_tree_iterator begin, cx_tree_iterator end) |
Erase a range of elements from a tree. | |
cxsize | cx_tree_erase (cx_tree *tree, cxcptr key) |
Erase all elements from a tree matching the provided key. | |
cxbool | cx_tree_verify (const cx_tree *tree) |
Validate a tree. |
#include <cxtree.h>
|
The tree's key comparison operator function.
This type of function is used by a tree internally to compare the keys of its elements. A key comparison operator returns Examples:
|
|
Assign data to an iterator position.
|
|
Get an iterator to the first pair in the tree.
|
|
Remove all pairs from a tree.
|
|
Get the number of elements matching a key.
|
|
Destroy a tree and all its elements.
|
|
Check whether a tree is empty.
return (cx_tree_size(tree) == 0); |
|
Get an iterator for the position after the last pair in the tree.
|
|
Find a subsequence matching a given key.
|
|
Erase all elements from a tree matching the provided key.
|
|
Erase an element from a tree.
|
|
Erase a range of elements from a tree.
|
|
Locate an element in the tree.
|
|
Get the key from a given iterator position.
|
|
Get the data from a given iterator position.
|
|
Insert data into a tree.
|
|
Attempt to insert data into a tree.
|
|
Get the key comparison function.
|
|
Find the beginning of a subsequence.
|
|
Get the maximum number of pairs possible.
|
|
Create a new tree without any elements.
The tree's key comparison function is set to compare. It must return
The destructors for a tree node's key and value field are set to key_destroy and value_destroy. Whenever a tree node is destroyed these functions are used to deallocate the memory used by the key and the value. Each of the destructors might be
|
|
Get an iterator for the next pair in the tree.
|
|
Get an iterator for the previous pair in the tree.
|
|
Get the actual number of pairs in the tree.
|
|
Swap the contents of two trees.
|
|
Find the end of a subsequence.
|
|
Validate a tree.
|