Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

binaryTree.h: binary tree routines
[platform independant portions of code]


Typedefs

typedef _BinaryTree * BinaryTree
typedef _BinaryTreeIterator * BinaryTreeIterator
typedef int32(* BinaryTreeComparator )(Boolean keyComparison, void *data1, void *data2)

Functions

ErrorCode binaryTreeCreate (BinaryTree *bTree, BinaryTreeComparator comparator)
ErrorCode binaryTreeDestroy (BinaryTree *bTree)
ErrorCode binaryTreeAdd (BinaryTree bTree, void *data)
ErrorCode binaryTreeRemove (BinaryTree bTree, void *data)
ErrorCode binaryTreeRemoveByKey (BinaryTree bTree, void *key)
ErrorCode binaryTreeFind (BinaryTree bTree, void *key, void **data)
ErrorCode binaryTreeGetLength (BinaryTree bTree, uint32 *length)
ErrorCode binaryTreeGetFirst (BinaryTree bTree, void **data)
ErrorCode binaryTreeGetLast (BinaryTree bTree, void **data)
ErrorCode binaryTreeIteratorCreate (BinaryTreeIterator *bti, BinaryTree bTree)
ErrorCode binaryTreeIteratorReset (BinaryTreeIterator bti)
ErrorCode binaryTreeIteratorGetNext (BinaryTreeIterator bti, void **data)
ErrorCode binaryTreeIteratorGetPrevious (BinaryTreeIterator bti, void **data)
ErrorCode binaryTreeIteratorDestroy (BinaryTreeIterator *bti)

Detailed Description

 *  *  * Defines interfaces for working with weight balanced trees of data

Typedef Documentation

typedef struct _BinaryTree* BinaryTree
 

Definition at line 23 of file binaryTree.h.

typedef int32(* BinaryTreeComparator)(Boolean keyComparison, void *data1, void *data2)
 

Parameters:
keyComparison if true, data1 contains a key value, and not an actual node otherwise, both data1 and data2 are nodes in the tree
Returns: +1 if data1 > data2 -1 if data1 < data2 0 if data1 = data2 (this shouldn't happen in a bTree)

Definition at line 35 of file binaryTree.h.

typedef struct _BinaryTreeIterator* BinaryTreeIterator
 

Definition at line 24 of file binaryTree.h.


Function Documentation

ErrorCode binaryTreeAdd BinaryTree  bTree,
void *  data
 

Add an item to the binary tree

ErrorCode binaryTreeCreate BinaryTree bTree,
BinaryTreeComparator  comparator
 

Creates an empty binary tree

ErrorCode binaryTreeDestroy BinaryTree bTree  ) 
 

Delete a binary tree

ErrorCode binaryTreeFind BinaryTree  bTree,
void *  key,
void **  data
 

Find a specific item in the tree

ErrorCode binaryTreeGetFirst BinaryTree  bTree,
void **  data
 

Get the first/lowest node in the tree

ErrorCode binaryTreeGetLast BinaryTree  bTree,
void **  data
 

Get the last/highest node in the list

ErrorCode binaryTreeGetLength BinaryTree  bTree,
uint32 length
 

Get the total number of items in this btree

ErrorCode binaryTreeIteratorCreate BinaryTreeIterator bti,
BinaryTree  bTree
 

Create an iterator for a list

ErrorCode binaryTreeIteratorDestroy BinaryTreeIterator bti  ) 
 

Destroy a list iterator

ErrorCode binaryTreeIteratorGetNext BinaryTreeIterator  bti,
void **  data
 

Get the next node in the list

ErrorCode binaryTreeIteratorGetPrevious BinaryTreeIterator  bti,
void **  data
 

Get the previous node in the list

ErrorCode binaryTreeIteratorReset BinaryTreeIterator  bti  ) 
 

Reset the iterator to point to the beginning on the list. Can be called at any time, even if the list has changed after the iterator was created

ErrorCode binaryTreeRemove BinaryTree  bTree,
void *  data
 

Remove an item from the bTree

ErrorCode binaryTreeRemoveByKey BinaryTree  bTree,
void *  key
 

Remove an item from the bTree, using a key, not a data pointer


Generated on Wed Mar 22 20:36:34 2006 for ndk by  doxygen 1.4.4