GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LDT / V0-5-0 > encdec / linux-gcc
Classes | |
struct | _BTREE_node |
Definition of a node in a binary tree. More... | |
struct | _BTREE |
Context structure for a binary tree. More... | |
Typedefs | |
typedef struct _BTREE_node | BTREE_node |
Typedef for struct _BTREE_node. | |
typedef int(* | BTREE_compare )(const void *key1, const void *key2) |
Comparison function used to sort the tree. | |
typedef void(* | BTREE_destroy )(void *data) |
Call back function to destroy (freed) the data. | |
typedef struct _BTREE | BTREE |
Typedef for struct _BTREE. | |
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. | |
static __inline int | BTREE__size (BTREE *tree) |
Returns the size (number of nodes) in the tree. | |
static __inline BTREE_node * | BTREE__root (BTREE *tree) |
Returns the root of the tree. | |
static __inline void * | BTREE__data (BTREE_node *node) |
Returns the data associated with the specified node. | |
static __inline BTREE_node * | BTREE__left (BTREE_node *node) |
Return the left node of the specified node. | |
static __inline BTREE_node * | BTREE__right (BTREE_node *node) |
Return the right node of the specified node. | |
static __inline int | BTREE__is_eob (BTREE_node *node) |
Tests if this node is a terminal node. | |
static __inline int | BTREE__is_leaf (BTREE_node *node) |
Tests if this node is a leaf node. |
CVS $Id
int BTREE_compare |
Comparison function used to sort the tree.
<0 | if key1 < key2 | |
=0 | if key1 = key2 | |
>0 | if key1 > key2 |
key1 | Pointer to the first data structure to be sorted | |
key2 | Pointer to the second data structure to be sorted |
Call back function to destroy (freed) the data.
data | The data to be destroyed (freed) |
void * BTREE__data | ( | BTREE_node * | node | ) | [static] |
Returns the data associated with the specified node.
node | The parent node. |
int BTREE__is_eob | ( | BTREE_node * | node | ) | [static] |
Tests if this node is a terminal node.
==0,not | a terminal node | |
!=0,is | a terminal node |
node | The node to test. |
int BTREE__is_leaf | ( | BTREE_node * | node | ) | [static] |
Tests if this node is a leaf node.
==0,not | a leaf node | |
!=0,is | a leaf node |
node | The node to test. |
BTREE_node * BTREE__left | ( | BTREE_node * | node | ) | [static] |
Return the left node of the specified node.
node | The parent node. |
BTREE_node * BTREE__right | ( | BTREE_node * | node | ) | [static] |
Return the right node of the specified node.
node | The parent node. |
BTREE_node * BTREE__root | ( | BTREE * | tree | ) | [static] |
Returns the root of the tree.
tree | The binary tree |
int BTREE__size | ( | BTREE * | tree | ) | [static] |
Returns the size (number of nodes) in the tree.
tree | The binary tree |
void BTREE_free | ( | BTREE * | tree | ) |
Frees all the data associated with the specified tree.
tree | The root of the tree to free |
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. |
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 |
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 |
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 |
void BTREE_removeL | ( | BTREE * | tree, | |
BTREE_node * | node | |||
) |
Removes the left node and all its branches.
tree | The binary tree | |
node | The parent node |
void BTREE_removeR | ( | BTREE * | tree, | |
BTREE_node * | node | |||
) |
Removes the right node and all its branches.
tree | The binary tree | |
node | The parent node |