Btree Functions
Function prototypes.
More...
Typedefs |
| typedef int(* | BTreeDumpFunc )(void *data, INT32 *tagnum, void *userdata) |
| typedef int(* | BTreeTestFunc )(const void *, const void *, void *) |
Functions |
| GEOMLIBEXPORT void * | BTreeAlloc (int numitems, int datasize, BTreeTestFunc testfunc, void *userdata) |
| GEOMLIBEXPORT int | BTreeClear (void *tree) |
| GEOMLIBEXPORT int | BTreeDumpT (void *tree, BTreeDumpFunc, void *userdata) |
| GEOMLIBEXPORT INT32 | BTreeFindKey (void *tree, void *data, INT32 tagnum, int *add) |
| GEOMLIBEXPORT int | BTreeFree (void *tree) |
| GEOMLIBEXPORT void * | BTreeGetUserData (void *tree) |
| GEOMLIBEXPORT INT32 | BTreeSearchKey (void *tree, void *data) |
Detailed Description
Function prototypes.
Typedef Documentation
Callback used to return data.
Tree comparison function used in searching/adding.
- Returns:
- >, ==, < 0. Must NOT modify the data.
Function Documentation
| GEOMLIBEXPORT void* BTreeAlloc |
( |
int |
numitems, |
|
|
int |
datasize, |
|
|
BTreeTestFunc |
testfunc, |
|
|
void * |
userdata | |
|
) |
| | |
Allocate a "balanced tree".
- Returns:
- Handle to tree instance.
- Parameters:
-
| numitems | Number of items to store per node |
| datasize | Size of data to tree in bytes |
| testfunc | Comparison function used in searching/adding, MUST NOT MODIFY DATA |
| userdata | Data passed to comparison function |
| GEOMLIBEXPORT int BTreeClear |
( |
void * |
tree |
) |
|
Clear "balanced tree".
- Parameters:
-
| tree | Handle to tree instance |
| GEOMLIBEXPORT int BTreeDumpT |
( |
void * |
tree, |
|
|
BTreeDumpFunc |
, |
|
|
void * |
userdata | |
|
) |
| | |
Dump a "balanced tree" in "traversal" order.
NOTE: This function transverses the tree and dumps the data in the order that the comparison function determined.
- Parameters:
-
| tree | Handle to tree instance |
| userdata | User data passed to Dump() |
| GEOMLIBEXPORT INT32 BTreeFindKey |
( |
void * |
tree, |
|
|
void * |
data, |
|
|
INT32 |
tagnum, |
|
|
int * |
add | |
|
) |
| | |
Search "balanced tree" for a specified key, add if no match found.
- Returns:
- tag number assigned to the data if (>=0), else error
- Parameters:
-
| tree | Handle to tree instance |
| data | Data to find and add if necessary |
| tagnum | Number to tag data with |
| add | Set if data was added to tree |
| GEOMLIBEXPORT int BTreeFree |
( |
void * |
tree |
) |
|
Free a "balanced tree".
- Parameters:
-
| tree | Handle to tree instance |
| GEOMLIBEXPORT void* BTreeGetUserData |
( |
void * |
tree |
) |
|
Get the userdata associated with 'tree'.
- Parameters:
-
| tree | Handle to tree instance |
| GEOMLIBEXPORT INT32 BTreeSearchKey |
( |
void * |
tree, |
|
|
void * |
data | |
|
) |
| | |
Search "balanced tree" for a specified key.
- Returns:
- -1 = Not found, < -1 Error, else the tag number associated with the data. See BTreeFindKey().
- Parameters:
-
| tree | Handle to tree instance |
| data | Data to find if exists |