GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LDT / dev > encdec / rhel6-32
#include <LDT/BTREE.h>
#include <stdlib.h>
Functions | |
void | BTREE_init (BTREE *tree, BTREE_destroy destroy) |
Initializes the context control structure. | |
void | BTREE_free (BTREE *tree) |
Frees all the data associated with the specified tree. | |
int | BTREE_insertL (BTREE *tree, BTREE_node *node, const void *data) |
Inserts the data as the left node of the specified node. | |
int | BTREE_insertR (BTREE *tree, BTREE_node *node, const void *data) |
Inserts the data as the right node of the specified node. | |
void | BTREE_removeL (BTREE *tree, BTREE_node *node) |
Removes the left node and all its branches. | |
void | BTREE_removeR (BTREE *tree, BTREE_node *node) |
Removes the right node and all its branches. | |
int | BTREE_merge (BTREE *merge, BTREE *left, BTREE *right, const void *data) |
Merges two trees into a single parent tree, adding the data of the merged tree. |
CVS $Id
void BTREE_free | ( | BTREE * | tree | ) |
Frees all the data associated with the specified tree.
tree | The root of the tree to free |
References BTREE_removeL().
Referenced by BTREE_merge().
void BTREE_init | ( | BTREE * | tree, | |
BTREE_destroy | destroy | |||
) |
Initializes the context control structure.
tree | The binary tree context to initialize | |
destroy | Callback function to free the nodes in a binary tree, may be NULL. |
References _BTREE::destroy, _BTREE::root, and _BTREE::size.
Referenced by BTREE_merge().
int BTREE_insertL | ( | BTREE * | tree, | |
BTREE_node * | node, | |||
const void * | data | |||
) |
Inserts the data as the left node of the specified node.
0,if | successful | |
-1,if | failure |
tree | The binary tree | |
node | The parent node, may be NULL if this is the first node | |
data | Pointer to the data to be inserted |
References BTREE__left(), BTREE__size(), _BTREE_node::data, _BTREE_node::left, _BTREE_node::right, _BTREE::root, and _BTREE::size.
Referenced by BTREE_merge().
int BTREE_insertR | ( | BTREE * | tree, | |
BTREE_node * | node, | |||
const void * | data | |||
) |
Inserts the data as the right node of the specified node.
0,if | successful | |
-1,if | failure |
tree | The binary tree | |
node | The parent node, may be NULL if this is the first node | |
data | Pointer to the data to be inserted |
References BTREE__right(), BTREE__size(), _BTREE_node::data, _BTREE_node::left, _BTREE_node::right, _BTREE::root, and _BTREE::size.
Merges two trees into a single parent tree, adding the data of the merged tree.
merge | The merged tree | |
left | The left tree to merge | |
right | The right tree to merge | |
data | The data to add |
References BTREE__root(), BTREE__size(), BTREE_free(), BTREE_init(), BTREE_insertL(), _BTREE::destroy, _BTREE_node::left, _BTREE_node::right, _BTREE::root, and _BTREE::size.
void BTREE_removeL | ( | BTREE * | tree, | |
BTREE_node * | node | |||
) |
Removes the left node and all its branches.
tree | The binary tree | |
node | The parent node |
References BTREE__size(), BTREE_removeL(), BTREE_removeR(), _BTREE::destroy, _BTREE_node::left, _BTREE::root, and _BTREE::size.
Referenced by BTREE_free(), BTREE_removeL(), and BTREE_removeR().
void BTREE_removeR | ( | BTREE * | tree, | |
BTREE_node * | node | |||
) |
Removes the right node and all its branches.
tree | The binary tree | |
node | The parent node |
References BTREE__size(), BTREE_removeL(), BTREE_removeR(), _BTREE::destroy, _BTREE_node::right, _BTREE::root, and _BTREE::size.
Referenced by BTREE_removeL(), and BTREE_removeR().