|
MGE General C Library - API Documentation
Library of general C functions.
|
Go to the documentation of this file.
49 #define BST_NODES_UNIQUE 1
50 #define BST_NODES_DUPLICATES 0
74 int (*
comp)(
const void *,
const void *);
int count
The node counter.
Definition: bstree.h:63
int unique
Uniqueness of nodes.
Definition: bstree.h:71
int count
The node counter.
Definition: bstree.h:55
Header file to ease portability.
int get_counter_bst_node(const struct bstree *tree, const void *searchobj)
Get the counter for a node.
Definition: bstree.c:348
struct bstobjcoord * find_next_bst_node_trace(const struct bstree *tree, struct bstobjcoord *searchobj)
Find and return the next object and it's coordinates in the bst 'tree'.
Definition: bstree.c:789
Binary search tree.
Definition: bstree.h:69
int count_total
Sum of all node counters.
Definition: bstree.h:72
int ydir
The y coordinate.
Definition: bstree.h:57
struct bstree * cre_bst(int unique, int(*comp)(const void *, const void *))
Create a binary search tree.
Definition: bstree.c:117
void * find_bst_node(const struct bstree *tree, const void *searchobj)
Find an exact object match.
Definition: bstree.c:288
Node coordinates for test tracing.
Definition: bstree.h:53
void * find_next_bst_node(const struct bstree *tree, const void *searchobj)
Find the next node.
Definition: bstree.c:409
void * upd_bst_node(const struct bstree *tree, const void *updobj, size_t objsize)
Update a node's object.
Definition: bstree.c:539
void * object
The object attached to the node.
Definition: bstree.h:62
Binary search tree node.
Definition: bstree.h:61
#define BEGIN_C_DECLS
BEGIN_C_DECLS should be used at the beginning of declarations so that C++ compilers don't mangle thei...
Definition: portability.h:46
int(* comp)(const void *, const void *)
Comparison function.
Definition: bstree.h:74
struct bstree * add_bst_node(struct bstree *tree, const void *object, size_t objsize)
Add a node to a binary search tree.
Definition: bstree.c:166
void * object
The object.
Definition: bstree.h:54
int node_total
Number of nodes in the tree.
Definition: bstree.h:73
#define END_C_DECLS
Use END_C_DECLS at the end of C declarations.
Definition: portability.h:50
struct bstreenode * childgreater
Child node greater than this.
Definition: bstree.h:65
struct bstreenode * childless
Child node less than this.
Definition: bstree.h:64
struct bstreenode * root
The root node of the tree.
Definition: bstree.h:70
void * find_prev_bst_node(const struct bstree *tree, const void *searchobj)
Find the previous node.
Definition: bstree.c:474
struct bstree * del_bst(struct bstree *tree)
Delete a bst.
Definition: bstree.c:731
struct bstree * del_bst_node(struct bstree *tree, const void *searchobj)
Delete a node.
Definition: bstree.c:608
int xdir
The x coordinate.
Definition: bstree.h:56