Main Page | Modules | File List | Globals

gdsl_rbtree.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__rbtree_8h-source.html,v $
00021  * $Revision: 1.4 $
00022  * $Date: 2004/10/03 14:35:38 $
00023  */
00024 
00025 #ifndef _GDSL_RBTREE_H_
00026 #define _GDSL_RBTREE_H_
00027 
00028 
00029 #include "gdsl_types.h"
00030 #include "_gdsl_bintree.h"
00031 #include "gdsl_macros.h"
00032 
00033 
00034 #ifdef __cplusplus
00035 extern "C" 
00036 {
00037 #endif /* __cplusplus */
00038 
00039 
00051 typedef struct gdsl_rbtree* gdsl_rbtree_t;
00052 
00053 /******************************************************************************/
00054 /* Management functions of red-black trees                                    */
00055 /******************************************************************************/
00056 
00080 extern gdsl_rbtree_t
00081 gdsl_rbtree_alloc (const char* NAME,
00082            gdsl_alloc_func_t ALLOC_F,
00083            gdsl_free_func_t FREE_F,
00084            gdsl_compare_func_t COMP_F
00085            );
00086   
00100 extern void 
00101 gdsl_rbtree_free (gdsl_rbtree_t T
00102           );
00103 
00116 extern void 
00117 gdsl_rbtree_flush (gdsl_rbtree_t T
00118            );
00119 
00120 /******************************************************************************/
00121 /* Consultation functions of red-black trees                                  */
00122 /******************************************************************************/
00123 
00133 extern char*
00134 gdsl_rbtree_get_name (const gdsl_rbtree_t T
00135               );
00136 
00145 extern bool
00146 gdsl_rbtree_is_empty (const gdsl_rbtree_t T
00147               );
00148 
00156 extern gdsl_element_t
00157 gdsl_rbtree_get_root (const gdsl_rbtree_t T
00158               );
00159 
00168 extern ulong
00169 gdsl_rbtree_get_size (const gdsl_rbtree_t T
00170               );
00171 
00180 extern ulong
00181 gdsl_rbtree_height (const gdsl_rbtree_t T
00182             );
00183 
00184 /******************************************************************************/
00185 /* Modification functions of red-black trees                                  */
00186 /******************************************************************************/
00187 
00201 extern gdsl_rbtree_t
00202 gdsl_rbtree_set_name (gdsl_rbtree_t T,
00203               const char* NEW_NAME
00204               );
00205 
00228 extern gdsl_element_t
00229 gdsl_rbtree_insert (gdsl_rbtree_t T,
00230             void* VALUE,
00231             int* RESULT
00232             );
00233 
00250 extern gdsl_element_t
00251 gdsl_rbtree_remove (gdsl_rbtree_t T,
00252             void* VALUE
00253             );
00254 
00272 extern gdsl_rbtree_t
00273 gdsl_rbtree_delete (gdsl_rbtree_t T,
00274             void* VALUE
00275             );
00276 
00277 /******************************************************************************/
00278 /* Search functions of red-black trees                                        */
00279 /******************************************************************************/
00280 
00300 extern gdsl_element_t
00301 gdsl_rbtree_search (const gdsl_rbtree_t T,
00302             gdsl_compare_func_t COMP_F,
00303             void* VALUE
00304             );
00305 
00306 /******************************************************************************/
00307 /* Parse functions of red-black trees                                         */
00308 /******************************************************************************/
00309 
00328 extern gdsl_element_t
00329 gdsl_rbtree_map_prefix (const gdsl_rbtree_t T,
00330             gdsl_map_func_t MAP_F,
00331             void* USER_DATA
00332             );
00333 
00352 extern gdsl_element_t
00353 gdsl_rbtree_map_infix (const gdsl_rbtree_t T,
00354                gdsl_map_func_t MAP_F,
00355                void* USER_DATA
00356                );
00357 
00376 extern gdsl_element_t
00377 gdsl_rbtree_map_postfix (const gdsl_rbtree_t T,
00378              gdsl_map_func_t MAP_F,
00379              void* USER_DATA
00380              );
00381 
00382 /******************************************************************************/
00383 /* Input/output functions of red-black trees                                  */
00384 /******************************************************************************/
00385 
00402 extern void
00403 gdsl_rbtree_write (const gdsl_rbtree_t T,
00404            gdsl_write_func_t WRITE_F,
00405            FILE* OUTPUT_FILE,
00406            void* USER_DATA
00407            );
00408 
00427 extern void
00428 gdsl_rbtree_write_xml (const gdsl_rbtree_t T,
00429                gdsl_write_func_t WRITE_F,
00430                FILE* OUTPUT_FILE,
00431                void* USER_DATA
00432                );
00433 
00451 extern void
00452 gdsl_rbtree_dump (const gdsl_rbtree_t T,
00453           gdsl_write_func_t WRITE_F,
00454           FILE* OUTPUT_FILE,
00455           void* USER_DATA
00456           );
00457 
00458 /*
00459  * @}
00460  */
00461 
00462 
00463 #ifdef __cplusplus
00464 }
00465 #endif /* __cplusplus */
00466 
00467 
00468 #endif /* _GDSL_RBTREE_H_ */
00469 

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