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
universe@390:
int ucx_avl_remove(UcxAVLTree *tree, intptr_t key)
Removes an element from the AVL tree.
Definition: avl.c:266
universe@390:
UCX AVL Node.
Definition: avl.h:63
universe@390:
int(* cmp_func)(const void *, const void *, void *)
Function pointer to a compare function.
Definition: ucx.h:84
universe@390:
UcxAVLNode * parent
Parent node.
Definition: avl.h:79
universe@390:
UcxAVLNode * ucx_avl_pred(UcxAVLNode *node)
Finds the in-order predecessor of the given node.
Definition: avl.c:335
universe@390:
int ucx_avl_put(UcxAVLTree *tree, intptr_t key, void *value)
Puts a key/value pair into the tree.
Definition: avl.c:211
universe@390:
Main UCX Header providing most common definitions.
universe@390:
UCX AVL Tree.
Definition: avl.h:93
universe@390:
size_t ucx_avl_count(UcxAVLTree *tree)
Counts the nodes in the specified UcxAVLTree.
Definition: avl.c:331
universe@390:
UcxAVLTree * ucx_avl_new_a(cmp_func cmpfunc, UcxAllocator *allocator)
Initializes a new UcxAVLTree with the specified allocator.
Definition: avl.c:113
universe@390:
void * userdata
Custom user data.
Definition: avl.h:111
universe@390:
int ucx_avl_remove_node(UcxAVLTree *tree, UcxAVLNode *node)
Removes a node from the AVL tree.
Definition: avl.c:270
universe@390:
cmp_func cmpfunc
Compare function that shall be used to compare the UcxAVLNode keys.
Definition: avl.h:106
universe@390:
UcxAVLNode * ucx_avl_succ(UcxAVLNode *node)
Finds the in-order successor of the given node.
Definition: avl.c:355
universe@390:
void ucx_avl_free_content(UcxAVLTree *tree, ucx_destructor destr)
Frees the contents of a UcxAVLTree.
Definition: avl.c:152
universe@390:
UcxAllocator * allocator
The UcxAllocator that shall be used to manage the memory for node data.
Definition: avl.h:97
universe@390:
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
universe@390:
void * ucx_avl_find(UcxAVLTree *tree, intptr_t key, distance_func dfnc, int mode)
Finds a value within the tree.
Definition: avl.c:205
universe@390:
UCX allocator data structure containing memory management functions.
Definition: allocator.h:88
universe@390:
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
universe@390:
UcxAVLNode * root
Root node of the tree.
Definition: avl.h:101
universe@390:
intmax_t(* distance_func)(const void *, const void *, void *)
Function pointer to a distance function.
Definition: ucx.h:93
universe@390:
Allocator for custom memory management.
universe@390:
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
universe@390:
UcxAVLNode * left
Root node of left subtree.
Definition: avl.h:83
universe@390:
void ucx_avl_free(UcxAVLTree *tree)
Destroys a UcxAVLTree.
Definition: avl.c:133
universe@390:
void * value
Data contained by this node.
Definition: avl.h:71
universe@390:
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
universe@390:
intptr_t key
The key for this node.
Definition: avl.h:67
universe@390:
UcxAVLNode * right
Root node of right subtree.
Definition: avl.h:87
universe@390:
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
universe@390:
size_t height
The height of this (sub)-tree.
Definition: avl.h:75
universe@390:
void(* ucx_destructor)(void *)
A function pointer to a destructor function.
Definition: ucx.h:72
universe@390: