173 #define ucx_avl_default_new() \ 174 ucx_avl_new_a(ucx_cmp_ptr, ucx_default_allocator()) 196 #define UCX_AVL_FIND_EXACT 0 201 #define UCX_AVL_FIND_LOWER_BOUNDED 1 206 #define UCX_AVL_FIND_UPPER_BOUNDED 2 213 #define UCX_AVL_FIND_CLOSEST 3 323 intptr_t *oldkey,
void **oldvalue);
UcxAVLTree * ucx_avl_new(cmp_func cmpfunc)
Initializes a new UcxAVLTree with a default allocator.
Definition: avl.c:109
+
int ucx_avl_remove(UcxAVLTree *tree, intptr_t key)
Removes an element from the AVL tree.
Definition: avl.c:266
+
UCX AVL Node.
Definition: avl.h:63
+
int(* cmp_func)(const void *, const void *, void *)
Function pointer to a compare function.
Definition: ucx.h:84
+
UcxAVLNode * parent
Parent node.
Definition: avl.h:79
+
UcxAVLNode * ucx_avl_pred(UcxAVLNode *node)
Finds the in-order predecessor of the given node.
Definition: avl.c:335
+
int ucx_avl_put(UcxAVLTree *tree, intptr_t key, void *value)
Puts a key/value pair into the tree.
Definition: avl.c:211
+
Main UCX Header providing most common definitions.
+
UCX AVL Tree.
Definition: avl.h:93
+
size_t ucx_avl_count(UcxAVLTree *tree)
Counts the nodes in the specified UcxAVLTree.
Definition: avl.c:331
+
UcxAVLTree * ucx_avl_new_a(cmp_func cmpfunc, UcxAllocator *allocator)
Initializes a new UcxAVLTree with the specified allocator.
Definition: avl.c:113
+
void * userdata
Custom user data.
Definition: avl.h:111
+
int ucx_avl_remove_node(UcxAVLTree *tree, UcxAVLNode *node)
Removes a node from the AVL tree.
Definition: avl.c:270
+
cmp_func cmpfunc
Compare function that shall be used to compare the UcxAVLNode keys.
Definition: avl.h:106
+
UcxAVLNode * ucx_avl_succ(UcxAVLNode *node)
Finds the in-order successor of the given node.
Definition: avl.c:355
+
void ucx_avl_free_content(UcxAVLTree *tree, ucx_destructor destr)
Frees the contents of a UcxAVLTree.
Definition: avl.c:152
+
UcxAllocator * allocator
The UcxAllocator that shall be used to manage the memory for node data.
Definition: avl.h:97
+
int ucx_avl_remove_s(UcxAVLTree *tree, intptr_t key, intptr_t *oldkey, void **oldvalue)
Removes an element from the AVL tree.
Definition: avl.c:274
+
void * ucx_avl_find(UcxAVLTree *tree, intptr_t key, distance_func dfnc, int mode)
Finds a value within the tree.
Definition: avl.c:205
+
UCX allocator data structure containing memory management functions.
Definition: allocator.h:88
+
int ucx_avl_put_s(UcxAVLTree *tree, intptr_t key, void *value, void **oldvalue)
Puts a key/value pair into the tree.
Definition: avl.c:215
+
UcxAVLNode * root
Root node of the tree.
Definition: avl.h:101
+
intmax_t(* distance_func)(const void *, const void *, void *)
Function pointer to a distance function.
Definition: ucx.h:93
+
Allocator for custom memory management.
+
void * ucx_avl_get(UcxAVLTree *tree, intptr_t key)
Gets the value from the tree, that is associated with the specified key.
Definition: avl.c:166
+
UcxAVLNode * left
Root node of left subtree.
Definition: avl.h:83
+
void ucx_avl_free(UcxAVLTree *tree)
Destroys a UcxAVLTree.
Definition: avl.c:133
+
void * value
Data contained by this node.
Definition: avl.h:71
+
UcxAVLNode * ucx_avl_find_node(UcxAVLTree *tree, intptr_t key, distance_func dfnc, int mode)
Finds a node within the tree.
Definition: avl.c:171
+
intptr_t key
The key for this node.
Definition: avl.h:67
+
UcxAVLNode * right
Root node of right subtree.
Definition: avl.h:87
+
UcxAVLNode * ucx_avl_get_node(UcxAVLTree *tree, intptr_t key)
Gets the node from the tree, that is associated with the specified key.
Definition: avl.c:156
+
size_t height
The height of this (sub)-tree.
Definition: avl.h:75
+
void(* ucx_destructor)(void *)
A function pointer to a destructor function.
Definition: ucx.h:72
+