00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef CX_TREE_H
00029 #define CX_TREE_H
00030
00031 #include <cxmemory.h>
00032
00033 CX_BEGIN_DECLS
00034
00035 typedef struct _cx_tnode_ *cx_tree_iterator;
00036 typedef const struct _cx_tnode_ *cx_tree_const_iterator;
00037
00038 typedef struct _cx_tree_ cx_tree;
00039
00075 typedef cxbool (*cx_tree_compare_func)(cxcptr, cxcptr);
00076
00077
00078
00079
00080
00081 cx_tree *cx_tree_new(cx_tree_compare_func, cx_free_func, cx_free_func);
00082 void cx_tree_delete(cx_tree *);
00083
00084
00085
00086
00087
00088 cxsize cx_tree_size(const cx_tree *);
00089 cxbool cx_tree_empty(const cx_tree *);
00090 cxsize cx_tree_max_size(const cx_tree *);
00091 cx_tree_compare_func cx_tree_key_comp(const cx_tree *);
00092
00093
00094
00095
00096
00097 cxsize cx_tree_count(const cx_tree *, cxcptr);
00098 cx_tree_iterator cx_tree_find(const cx_tree *, cxcptr);
00099 cx_tree_iterator cx_tree_lower_bound(const cx_tree *, cxcptr);
00100 cx_tree_iterator cx_tree_upper_bound(const cx_tree *, cxcptr);
00101 void cx_tree_equal_range(const cx_tree *, cxcptr, cx_tree_iterator *,
00102 cx_tree_iterator *);
00103
00104
00105
00106
00107
00108 void cx_tree_swap(cx_tree *, cx_tree *);
00109 cxptr cx_tree_assign(cx_tree *, cx_tree_iterator, cxcptr);
00110
00111
00112
00113
00114
00115 cxptr cx_tree_get_key(const cx_tree *, cx_tree_const_iterator);
00116 cxptr cx_tree_get_value(const cx_tree *, cx_tree_const_iterator);
00117
00118
00119
00120
00121
00122 cx_tree_iterator cx_tree_begin(const cx_tree *);
00123 cx_tree_iterator cx_tree_end(const cx_tree *);
00124 cx_tree_iterator cx_tree_next(const cx_tree *, cx_tree_const_iterator);
00125 cx_tree_iterator cx_tree_previous(const cx_tree *, cx_tree_const_iterator);
00126
00127
00128
00129
00130
00131
00132 cx_tree_iterator cx_tree_insert_unique(cx_tree *, cxcptr, cxcptr);
00133 cx_tree_iterator cx_tree_insert_equal(cx_tree *, cxcptr, cxcptr);
00134 void cx_tree_erase_position(cx_tree *, cx_tree_iterator);
00135 void cx_tree_erase_range(cx_tree *, cx_tree_iterator, cx_tree_iterator);
00136 cxsize cx_tree_erase(cx_tree *, cxcptr);
00137 void cx_tree_clear(cx_tree *);
00138
00139
00140
00141
00142
00143 cxbool cx_tree_verify(const cx_tree *);
00144
00145 CX_END_DECLS
00146
00147 #endif