diff options
Diffstat (limited to 'source3/include/adt_tree.h')
-rw-r--r-- | source3/include/adt_tree.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source3/include/adt_tree.h b/source3/include/adt_tree.h index 12e2ea5cc5..2fbfb55e88 100644 --- a/source3/include/adt_tree.h +++ b/source3/include/adt_tree.h @@ -21,6 +21,14 @@ #ifndef ADT_TREE_H #define ADT_TREE_H +#ifndef _BOOL +typedef int BOOL; +#define _BOOL +#endif + + +/* data structure used to build the tree */ + typedef struct _tree_node { struct _tree_node *parent; struct _tree_node **children; @@ -35,4 +43,25 @@ typedef struct _tree_root { void (*free_func)(void *p); } SORTED_TREE; +/* + * API + */ + +/* initializer and desctrutor */ +SORTED_TREE* pathtree_init( void *data_p, int (cmp_fn)(void*, void*), void (free_fn)(void*) ); +void pathtree_destroy( SORTED_TREE *tree ); + +/* add a new path component */ + +BOOL pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ); + +/* search path */ + +void* pathtree_find( SORTED_TREE *tree, char *key ); + +/* debug (print) functions */ + +void pathtree_print_keys( SORTED_TREE *tree, int debug ); + + #endif |