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-2006 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.10 $
00022  * $Date: 2006/06/22 09:16:01 $
00023  */
00024 
00025 
00026 #ifndef _GDSL_BSTREE_H_
00027 #define _GDSL_BSTREE_H_
00028 
00029 
00030 #include <stdio.h>
00031 
00032 
00033 #include "gdsl_types.h"
00034 
00035 
00036 #ifdef __cplusplus
00037 extern "C" 
00038 {
00039 #endif /* __cplusplus */
00040 
00041 
00053 typedef struct gdsl_bstree* gdsl_bstree_t;
00054 
00055 /******************************************************************************/
00056 /* Management functions of binary search trees                                */
00057 /******************************************************************************/
00058 
00085 extern gdsl_bstree_t
00086 gdsl_bstree_alloc (const char* NAME,
00087            gdsl_alloc_func_t ALLOC_F,
00088            gdsl_free_func_t FREE_F,
00089            gdsl_compare_func_t COMP_F
00090            );
00091 
00105 extern void
00106 gdsl_bstree_free (gdsl_bstree_t T
00107           );
00108 
00123 extern void
00124 gdsl_bstree_flush (gdsl_bstree_t T
00125            );
00126 
00127 /******************************************************************************/
00128 /* Consultation functions of binary search trees                              */
00129 /******************************************************************************/
00130 
00140 extern const char*
00141 gdsl_bstree_get_name (const gdsl_bstree_t T
00142               );
00143 
00152 extern bool
00153 gdsl_bstree_is_empty (const gdsl_bstree_t T
00154               );
00155 
00163 extern gdsl_element_t
00164 gdsl_bstree_get_root (const gdsl_bstree_t T
00165               );
00166 
00175 extern ulong
00176 gdsl_bstree_get_size (const gdsl_bstree_t T
00177               );
00178 
00187 extern ulong
00188 gdsl_bstree_get_height (const gdsl_bstree_t T
00189             );
00190 
00191 /******************************************************************************/
00192 /* Modification functions of binary search trees                              */
00193 /******************************************************************************/
00194 
00208 extern gdsl_bstree_t
00209 gdsl_bstree_set_name (gdsl_bstree_t T,
00210               const char* NEW_NAME
00211               );
00212 
00235 extern gdsl_element_t
00236 gdsl_bstree_insert (gdsl_bstree_t T,
00237             void* VALUE,
00238             int* RESULT
00239             );
00240 
00259 extern gdsl_element_t
00260 gdsl_bstree_remove (gdsl_bstree_t T,
00261             void* VALUE
00262             );
00263 
00283 extern gdsl_bstree_t
00284 gdsl_bstree_delete (gdsl_bstree_t T,
00285             void* VALUE
00286             );
00287   
00288 /******************************************************************************/
00289 /* Search functions of binary search trees                                    */
00290 /******************************************************************************/
00291 
00311 extern gdsl_element_t
00312 gdsl_bstree_search (const gdsl_bstree_t T,
00313             gdsl_compare_func_t COMP_F,
00314             void* VALUE
00315             );
00316 
00317 /******************************************************************************/
00318 /* Parse functions of binary search trees                                     */
00319 /******************************************************************************/
00320 
00339 extern gdsl_element_t
00340 gdsl_bstree_map_prefix (const gdsl_bstree_t T,
00341             gdsl_map_func_t MAP_F,
00342             void* USER_DATA
00343             );
00344 
00363 extern gdsl_element_t
00364 gdsl_bstree_map_infix (const gdsl_bstree_t T,
00365                gdsl_map_func_t MAP_F,
00366                void* USER_DATA
00367                );
00368 
00387 extern gdsl_element_t
00388 gdsl_bstree_map_postfix (const gdsl_bstree_t T,
00389              gdsl_map_func_t MAP_F,
00390              void* USER_DATA
00391              );
00392 
00393 /******************************************************************************/
00394 /* Input/output functions of binary search trees                              */
00395 /******************************************************************************/
00396 
00413 extern void
00414 gdsl_bstree_write (const gdsl_bstree_t T,
00415            gdsl_write_func_t WRITE_F,
00416            FILE* OUTPUT_FILE,
00417            void* USER_DATA
00418            );
00419 
00438 extern void
00439 gdsl_bstree_write_xml (const gdsl_bstree_t T,
00440                gdsl_write_func_t WRITE_F,
00441                FILE* OUTPUT_FILE,
00442                void* USER_DATA
00443                );
00444 
00462 extern void
00463 gdsl_bstree_dump (const gdsl_bstree_t T,
00464           gdsl_write_func_t WRITE_F,
00465           FILE* OUTPUT_FILE,
00466           void* USER_DATA
00467           );
00468 
00469 /*
00470  * @}
00471  */
00472 
00473 
00474 #ifdef __cplusplus
00475 }
00476 #endif /* __cplusplus */
00477 
00478 
00479 #endif /* _GDSL_BSTREE_H_ */
00480 
00481 

Generated on Thu Jun 22 11:15:30 2006 for gdsl by  doxygen 1.4.6