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:37 $
00023  */
00024 
00025 #ifndef __GDSL_BSTREE_H_
00026 #define __GDSL_BSTREE_H_
00027 
00028 
00029 #include "_gdsl_bintree.h"
00030 #include "gdsl_macros.h"
00031 #include "gdsl_types.h"
00032 
00033 
00034 #ifdef __cplusplus
00035 extern "C" 
00036 {
00037 #endif /* __cplusplus */
00038 
00039 
00051 typedef _gdsl_bintree_t _gdsl_bstree_t;
00052 
00059 typedef int (* gdsl_bstree_map_func_t) (_gdsl_bstree_t TREE,
00060                     void *USER_DATA
00061                     );
00062 
00063 /******************************************************************************/
00064 /* Management functions of low-level binary search trees                      */
00065 /******************************************************************************/
00066 
00080 extern _gdsl_bstree_t
00081 _gdsl_bstree_alloc (const gdsl_element_t E
00082             );
00083 
00097 extern void 
00098 _gdsl_bstree_free (_gdsl_bstree_t T,
00099            const gdsl_free_func_t FREE_F
00100            );
00101 
00119 extern _gdsl_bstree_t
00120 _gdsl_bstree_copy (const _gdsl_bstree_t T,
00121            const gdsl_copy_func_t COPY_F
00122            );
00123 
00124 /******************************************************************************/
00125 /* Consultation functions of low-level binary search trees                    */
00126 /******************************************************************************/
00127 
00138 extern bool
00139 _gdsl_bstree_is_empty (const _gdsl_bstree_t T
00140                );
00141 
00152 extern bool
00153 _gdsl_bstree_is_leaf (const _gdsl_bstree_t T
00154               );
00155 
00163 extern gdsl_element_t
00164 _gdsl_bstree_get_content (const _gdsl_bstree_t T
00165               );
00166 
00177 extern bool
00178 _gdsl_bstree_is_root (const _gdsl_bstree_t T
00179               );
00180 
00191 extern _gdsl_bstree_t
00192 _gdsl_bstree_get_parent (const _gdsl_bstree_t T
00193              );
00194 
00205 extern _gdsl_bstree_t
00206 _gdsl_bstree_get_left (const _gdsl_bstree_t T
00207                );
00208 
00219 extern _gdsl_bstree_t
00220 _gdsl_bstree_get_right (const _gdsl_bstree_t T
00221             );
00222 
00231 extern ulong
00232 _gdsl_bstree_get_size (const _gdsl_bstree_t T
00233                );
00234   
00246 extern ulong
00247 _gdsl_bstree_get_height (const _gdsl_bstree_t T
00248              );
00249 
00250 /******************************************************************************/
00251 /* Modification functions of low-level binary search trees                    */
00252 /******************************************************************************/
00253 
00277 extern _gdsl_bstree_t
00278 _gdsl_bstree_insert (_gdsl_bstree_t* T,
00279              const gdsl_compare_func_t COMP_F,
00280              const gdsl_element_t VALUE,
00281              int* RESULT
00282              );
00283 
00305 extern gdsl_element_t
00306 _gdsl_bstree_remove (_gdsl_bstree_t* T,
00307              const gdsl_compare_func_t COMP_F,
00308              const gdsl_element_t VALUE
00309              );
00310   
00311 /******************************************************************************/
00312 /* Search functions of low-level binary search trees                          */
00313 /******************************************************************************/
00314 
00332 extern _gdsl_bstree_t
00333 _gdsl_bstree_search (const _gdsl_bstree_t T,
00334              const gdsl_compare_func_t COMP_F,
00335              const gdsl_element_t VALUE
00336              );
00337 
00354 extern _gdsl_bstree_t
00355 _gdsl_bstree_search_next (const _gdsl_bstree_t T, 
00356               const gdsl_compare_func_t COMP_F,
00357               const gdsl_element_t VALUE
00358               );
00359 
00360 /******************************************************************************/
00361 /* Parse functions of low-level binary search trees                           */
00362 /******************************************************************************/
00363 
00382 extern _gdsl_bstree_t
00383 _gdsl_bstree_map_prefix (const _gdsl_bstree_t T,
00384              const gdsl_bstree_map_func_t MAP_F,
00385              void* USER_DATA
00386              );
00387 
00406 extern _gdsl_bstree_t
00407 _gdsl_bstree_map_infix (const _gdsl_bstree_t T,
00408             const gdsl_bstree_map_func_t MAP_F,
00409             void* USER_DATA
00410             );
00411 
00430 extern _gdsl_bstree_t
00431 _gdsl_bstree_map_postfix (const _gdsl_bstree_t T,
00432               const gdsl_bstree_map_func_t MAP_F,
00433               void* USER_DATA
00434               );
00435 
00436 /******************************************************************************/
00437 /* Input/output functions of low-level binary search trees                    */
00438 /******************************************************************************/
00439 
00457 extern void
00458 _gdsl_bstree_write (const _gdsl_bstree_t T,
00459             const gdsl_write_func_t WRITE_F,
00460             FILE* OUTPUT_FILE,
00461             void* USER_DATA
00462             );
00463 
00483 extern void
00484 _gdsl_bstree_write_xml (const _gdsl_bstree_t T,
00485             const gdsl_write_func_t WRITE_F,
00486             FILE* OUTPUT_FILE,
00487             void* USER_DATA
00488             );
00489 
00508 extern void
00509 _gdsl_bstree_dump (const _gdsl_bstree_t T,
00510            const gdsl_write_func_t WRITE_F,
00511            FILE* OUTPUT_FILE,
00512            void* USER_DATA
00513            );
00514 
00515 /*
00516  * @}
00517  */
00518 
00519 
00520 #ifdef __cplusplus
00521 }
00522 #endif /* __cplusplus */
00523 
00524 
00525 #endif /* _GDSL_BSTREE_H_ */
00526 

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