Main Page | Class List | File List | Class Members | File Members | Related Pages

tree.h

Go to the documentation of this file.
00001 /* 00002 * $Id: tree.h,v 1.8 2003/10/16 18:50:55 jasta Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __TREE_H 00018 #define __TREE_H 00019 00020 /*****************************************************************************/ 00021 00028 /*****************************************************************************/ 00029 00033 typedef struct _tree_node 00034 { 00035 struct _tree_node *parent; 00036 struct _tree_node *child; 00038 struct _tree_node *prev; 00039 struct _tree_node *next; 00041 void *data; 00042 } TreeNode; 00043 00047 typedef struct 00048 { 00049 TreeNode *root; 00050 } Tree; 00051 00052 /*****************************************************************************/ 00053 00057 typedef int (*TreeNodeCompare) (void *a, void *b); 00058 00066 typedef void (*TreeForeach) (TreeNode *node, void *udata, 00067 int depth); 00068 00069 /*****************************************************************************/ 00070 00071 EXTERN_C_BEGIN 00072 00073 /*****************************************************************************/ 00074 00085 LIBGIFT_EXPORT 00086 TreeNode *tree_insert (Tree **tree, TreeNode *parent, TreeNode *sibling, 00087 void *data); 00088 00092 LIBGIFT_EXPORT 00093 void tree_remove (Tree **tree, TreeNode *node); 00094 00098 LIBGIFT_EXPORT 00099 void tree_destroy (Tree **tree); 00100 00105 LIBGIFT_EXPORT 00106 void tree_destroy_free (Tree **tree); 00107 00111 LIBGIFT_EXPORT 00112 TreeNode *tree_find (Tree **tree, TreeNode *start, int recurse, 00113 TreeNodeCompare func, void *data); 00114 00118 LIBGIFT_EXPORT 00119 void tree_foreach (Tree **tree, TreeNode *start, int depth, int recurse, 00120 TreeForeach func, void *data); 00121 00122 /*****************************************************************************/ 00123 00124 EXTERN_C_END 00125 00126 /*****************************************************************************/ 00127 00128 #endif /* __TREE_H */

Generated on Sun Aug 22 08:07:10 2004 by doxygen 1.3.7