Top |
raptor_avltree * | raptor_new_avltree () |
void | raptor_free_avltree () |
int | raptor_avltree_add () |
int | raptor_avltree_delete () |
int | raptor_avltree_print () |
void * | raptor_avltree_remove () |
void * | raptor_avltree_search () |
void | raptor_avltree_set_print_handler () |
int | raptor_avltree_size () |
void | raptor_avltree_trim () |
int | raptor_avltree_visit () |
raptor_avltree_iterator * | raptor_new_avltree_iterator () |
void | raptor_free_avltree_iterator () |
void * | raptor_avltree_iterator_get () |
int | raptor_avltree_iterator_is_end () |
int | raptor_avltree_iterator_next () |
int | (*raptor_avltree_visit_handler) () |
typedef | raptor_avltree |
enum | raptor_avltree_bitflags |
typedef | raptor_avltree_iterator |
raptor_avltree * raptor_new_avltree (raptor_data_compare_handler compare_handler
,raptor_data_free_handler free_handler
,unsigned int flags
);
AVL Tree Constructor
compare_handler |
item comparison handler for ordering |
|
free_handler |
item free handler (or NULL) |
|
flags |
AVLTree flags - bitmask of raptor_avltree_bitflags flags. |
int raptor_avltree_add (raptor_avltree *tree
,void *p_data
);
add an item to an AVL Tree
The item added becomes owned by the AVL Tree, and will be freed by
the free_handler argument given to raptor_new_avltree()
.
int raptor_avltree_delete (raptor_avltree *tree
,void *p_data
);
Remove an item from an AVL Tree and free it
int raptor_avltree_print (raptor_avltree *tree
,FILE *stream
);
Print the items in the tree in order to a stream (for debugging)
void * raptor_avltree_remove (raptor_avltree *tree
,void *p_data
);
Remove an item from an AVL Tree and return it
The item removed is no longer owned by the AVL Tree and is owned by the caller.
void * raptor_avltree_search (raptor_avltree *tree
,const void *p_data
);
Find an item in an AVL Tree
void raptor_avltree_set_print_handler (raptor_avltree *tree
,raptor_data_print_handler print_handler
);
Set the handler for printing an item in a tree
int
raptor_avltree_size (raptor_avltree *tree
);
Get the number of items in the AVL Tree
void
raptor_avltree_trim (raptor_avltree *tree
);
Delete all nodes from an AVL tree but keep the shell.
int raptor_avltree_visit (raptor_avltree *tree
,raptor_avltree_visit_handler visit_handler
,void *user_data
);
Perform an in-order visit of the items in the AVL Tree
raptor_avltree_iterator * raptor_new_avltree_iterator (raptor_avltree *tree
,void *range
,raptor_data_free_handler range_free_handler
,int direction
);
Get an in-order iterator for the start of a range, or the entire contents
If range is NULL, the entire tree is walked in order. If range specifies a range (i.e. the tree comparison function will 'match' (return 0 for) range and /several/ nodes), the iterator will be placed at the leftmost child matching range, and raptor_avltree_iterator_next will iterate over all nodes (and only nodes) that match range.
tree |
raptor_avltree object |
|
range |
range |
|
range_free_handler |
function to free |
|
direction |
<0 to go 'backwards' otherwise 'forwards' |
void
raptor_free_avltree_iterator (raptor_avltree_iterator *iterator
);
AVL Tree Iterator destructor
void *
raptor_avltree_iterator_get (raptor_avltree_iterator *iterator
);
Get current iteration object
int
raptor_avltree_iterator_is_end (raptor_avltree_iterator *iterator
);
Test if an iteration is finished
int
raptor_avltree_iterator_next (raptor_avltree_iterator *iterator
);
Move iteration to next/prev object
int (*raptor_avltree_visit_handler) (int depth
,void *data
,void *user_data
);
AVL Tree visitor function as given to raptor_avltree_visit()
depth |
depth of object in tree |
|
data |
data object being visited |
|
user_data |
user data arg to |
Bit flags for AVL Tree class constructor raptor_new_avltree()
If set |
typedef struct raptor_avltree_iterator_s raptor_avltree_iterator;
AVL Tree Iterator as created by raptor_new_avltree_iterator()