Main Page | Modules | File List | Globals

gdsl_bstree.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Generic Data Structures Library (GDSL).
00003  * Copyright (C) 1998-2004 Nicolas Darnis <ndarnis@free.fr>.
00004  *
00005  * The GDSL library is free software; you can redistribute it and/or 
00006  * modify it under the terms of the GNU General Public License as 
00007  * published by the Free Software Foundation; either version 2 of
00008  * the License, or (at your option) any later version.
00009  *
00010  * The GDSL library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with the GDSL library; see the file COPYING.
00017  * If not, write to the Free Software Foundation, Inc., 
00018  * 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
00019  *
00020  * $RCSfile: gdsl__bstree_8h-source.html,v $
00021  * $Revision: 1.4 $
00022  * $Date: 2004/10/03 14:35:38 $
00023  */
00024 
00025 #ifndef _GDSL_BSTREE_H_
00026 #define _GDSL_BSTREE_H_
00027 
00028 
00029 #include <stdio.h>
00030 
00031 
00032 #include "gdsl_types.h"
00033 
00034 
00035 #ifdef __cplusplus
00036 extern "C" 
00037 {
00038 #endif /* __cplusplus */
00039 
00040 
00052 typedef struct gdsl_bstree* gdsl_bstree_t;
00053 
00054 /******************************************************************************/
00055 /* Management functions of binary search trees                                */
00056 /******************************************************************************/
00057 
00084 extern gdsl_bstree_t
00085 gdsl_bstree_alloc (const char* NAME,
00086            gdsl_alloc_func_t ALLOC_F,
00087            gdsl_free_func_t FREE_F,
00088            gdsl_compare_func_t COMP_F
00089            );
00090 
00104 extern void
00105 gdsl_bstree_free (gdsl_bstree_t T
00106           );
00107 
00122 extern void
00123 gdsl_bstree_flush (gdsl_bstree_t T
00124            );
00125 
00126 /******************************************************************************/
00127 /* Consultation functions of binary search trees                              */
00128 /******************************************************************************/
00129 
00139 extern const char*
00140 gdsl_bstree_get_name (const gdsl_bstree_t T
00141               );
00142 
00151 extern bool
00152 gdsl_bstree_is_empty (const gdsl_bstree_t T
00153               );
00154 
00162 extern gdsl_element_t
00163 gdsl_bstree_get_root (const gdsl_bstree_t T
00164               );
00165 
00174 extern ulong
00175 gdsl_bstree_get_size (const gdsl_bstree_t T
00176               );
00177 
00186 extern ulong
00187 gdsl_bstree_get_height (const gdsl_bstree_t T
00188             );
00189 
00190 /******************************************************************************/
00191 /* Modification functions of binary search trees                              */
00192 /******************************************************************************/
00193 
00207 extern gdsl_bstree_t
00208 gdsl_bstree_set_name (gdsl_bstree_t T,
00209               const char* NEW_NAME
00210               );
00211 
00234 extern gdsl_element_t
00235 gdsl_bstree_insert (gdsl_bstree_t T,
00236             void* VALUE,
00237             int* RESULT
00238             );
00239 
00258 extern gdsl_element_t
00259 gdsl_bstree_remove (gdsl_bstree_t T,
00260             void* VALUE
00261             );
00262 
00282 extern gdsl_bstree_t
00283 gdsl_bstree_delete (gdsl_bstree_t T,
00284             void* VALUE
00285             );
00286   
00287 /******************************************************************************/
00288 /* Search functions of binary search trees                                    */
00289 /******************************************************************************/
00290 
00310 extern gdsl_element_t
00311 gdsl_bstree_search (const gdsl_bstree_t T,
00312             gdsl_compare_func_t COMP_F,
00313             void* VALUE
00314             );
00315 
00316 /******************************************************************************/
00317 /* Parse functions of binary search trees                                     */
00318 /******************************************************************************/
00319 
00338 extern gdsl_element_t
00339 gdsl_bstree_map_prefix (const gdsl_bstree_t T,
00340             gdsl_map_func_t MAP_F,
00341             void* USER_DATA
00342             );
00343 
00362 extern gdsl_element_t
00363 gdsl_bstree_map_infix (const gdsl_bstree_t T,
00364                gdsl_map_func_t MAP_F,
00365                void* USER_DATA
00366                );
00367 
00386 extern gdsl_element_t
00387 gdsl_bstree_map_postfix (const gdsl_bstree_t T,
00388              gdsl_map_func_t MAP_F,
00389              void* USER_DATA
00390              );
00391 
00392 /******************************************************************************/
00393 /* Input/output functions of binary search trees                              */
00394 /******************************************************************************/
00395 
00412 extern void
00413 gdsl_bstree_write (const gdsl_bstree_t T,
00414            gdsl_write_func_t WRITE_F,
00415            FILE* OUTPUT_FILE,
00416            void* USER_DATA
00417            );
00418 
00437 extern void
00438 gdsl_bstree_write_xml (const gdsl_bstree_t T,
00439                gdsl_write_func_t WRITE_F,
00440                FILE* OUTPUT_FILE,
00441                void* USER_DATA
00442                );
00443 
00461 extern void
00462 gdsl_bstree_dump (const gdsl_bstree_t T,
00463           gdsl_write_func_t WRITE_F,
00464           FILE* OUTPUT_FILE,
00465           void* USER_DATA
00466           );
00467 
00468 /*
00469  * @}
00470  */
00471 
00472 
00473 #ifdef __cplusplus
00474 }
00475 #endif /* __cplusplus */
00476 
00477 
00478 #endif /* _GDSL_BSTREE_H_ */
00479 

Generated on Sun Oct 3 16:15:50 2004 for GDSL by doxygen 1.3.5