GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LDT / V0-0-0

Constituent: encdec     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

BTREE.c File Reference

Binary Tree, implementation file. More...

#include <stdlib.h>
#include "LDT/BTREE.h"

Include dependency graph for BTREE.c:

Include dependency graph

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.


Detailed Description

Binary Tree, implementation file.

Author:
JJRussell - russell@slac.stanford.edu

CVS $Id

Warning:
In their current state, these routines are not fit for Flight use. They can be used in studies. However they malloc all over the place and involve recursive calling techniques, neither of is appropriate for Flight code.

Function Documentation

void BTREE_free BTREE tree  ) 
 

Frees all the data associated with the specified tree.

Parameters:
tree The root of the tree to free

Here is the call graph for this function:

void BTREE_init BTREE tree,
BTREE_destroy  destroy
 

Initializes the context control structure.

Parameters:
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.

Return values:
0,if successful
-1,if failure
Parameters:
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
Failure can occur if
  • node is specified as NULL, but the tree is not empty
  • the left node of node is already filled
  • allocation of a new node fails

Here is the call graph for this function:

int BTREE_insertR BTREE tree,
BTREE_node node,
const void *  data
 

Inserts the data as the right node of the specified node.

Return values:
0,if successful
-1,if failure
Parameters:
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
Failure can occur if
  • node is specified as NULL, but the tree is not empty
  • the right node of node is already filled
  • allocation of a new node fails

Here is the call graph for this function:

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.

Returns:
Status
Parameters:
merge The merged tree
left The left tree to merge
right The right tree to merge
data The data to add

Here is the call graph for this function:

void BTREE_removeL BTREE tree,
BTREE_node node
 

Removes the left node and all its branches.

Parameters:
tree The binary tree
node The parent node

Here is the call graph for this function:

void BTREE_removeR BTREE tree,
BTREE_node node
 

Removes the right node and all its branches.

Parameters:
tree The binary tree
node The parent node

Here is the call graph for this function:


Generated on Sat Sep 24 20:30:56 2005 by doxygen 1.3.3