gdsl  1.6
gdsl_interval_heap.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__interval__heap_8h_source.html,v $
00021  * $Revision: 1.2 $
00022  * $Date: 2012/08/21 14:01:03 $
00023  */
00024 
00025 
00026 #ifndef _GDSL_INTERVAL_HEAP_H_
00027 #define _GDSL_INTERVAL_HEAP_H_
00028 
00029 
00030 #include <stdio.h>
00031 
00032 
00033 #include "gdsl_types.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C" 
00037 {
00038 #endif /* __cplusplus */
00039 
00040 
00053 typedef struct heap* gdsl_interval_heap_t;
00054 
00055 /******************************************************************************/
00056 /* Management functions of heaps                                              */
00057 /******************************************************************************/
00058 
00081 extern gdsl_interval_heap_t
00082 gdsl_interval_heap_alloc (const char* NAME,
00083          gdsl_alloc_func_t ALLOC_F,
00084          gdsl_free_func_t FREE_F,
00085          gdsl_compare_func_t COMP_F
00086          );
00087 
00101 extern void
00102 gdsl_interval_heap_free (gdsl_interval_heap_t H
00103         );
00104 
00118 extern void
00119 gdsl_interval_heap_flush (gdsl_interval_heap_t H
00120          );
00121 
00122 /******************************************************************************/
00123 /* Consultation functions of interval heaps                                            */
00124 /******************************************************************************/
00125 
00135 extern const char*
00136 gdsl_interval_heap_get_name (const gdsl_interval_heap_t H
00137             );
00138 
00146 extern ulong
00147 gdsl_interval_heap_get_size (const gdsl_interval_heap_t H
00148             );
00149 
00158 extern  void
00159 gdsl_interval_heap_set_max_size (const gdsl_interval_heap_t H,
00160             ulong size);
00161 
00171 extern bool 
00172 gdsl_interval_heap_is_empty (const gdsl_interval_heap_t H
00173             );
00174 
00175 /******************************************************************************/
00176 /* Modification functions of interval heaps                                   */
00177 /******************************************************************************/
00178   
00192 extern gdsl_interval_heap_t
00193 gdsl_interval_heap_set_name (gdsl_interval_heap_t H,
00194             const char* NEW_NAME
00195             );
00196 
00197 
00216 extern gdsl_element_t
00217 gdsl_interval_heap_insert (gdsl_interval_heap_t H,
00218           void* VALUE
00219           );
00220 
00235 extern gdsl_element_t
00236 gdsl_interval_heap_remove_max (gdsl_interval_heap_t H
00237               );
00238 
00253 extern gdsl_element_t
00254 gdsl_interval_heap_remove_min (gdsl_interval_heap_t H
00255               );
00256 
00264 extern gdsl_element_t
00265 gdsl_interval_heap_get_min (const gdsl_interval_heap_t H
00266             );
00267 
00275 extern gdsl_element_t
00276 gdsl_interval_heap_get_max (const gdsl_interval_heap_t H
00277             );
00278 
00294 extern gdsl_interval_heap_t
00295 gdsl_interval_heap_delete_min (gdsl_interval_heap_t H
00296               );
00297 
00313 extern gdsl_interval_heap_t
00314 gdsl_interval_heap_delete_max (gdsl_interval_heap_t H
00315               );
00316 /******************************************************************************/
00317 /* Parse functions of interval heaps                                          */
00318 /******************************************************************************/
00319 
00335 extern gdsl_element_t
00336 gdsl_interval_heap_map_forward (const gdsl_interval_heap_t H,
00337                gdsl_map_func_t MAP_F,
00338                void* USER_DATA
00339                );
00340 
00341 /******************************************************************************/
00342 /* Input/output functions of interval heaps                                   */
00343 /******************************************************************************/
00344 
00360 extern void
00361 gdsl_interval_heap_write (const gdsl_interval_heap_t H,
00362          gdsl_write_func_t WRITE_F,
00363          FILE* OUTPUT_FILE,
00364          void* USER_DATA
00365          );
00366 
00383 extern void
00384 gdsl_interval_heap_write_xml (const gdsl_interval_heap_t H,
00385              gdsl_write_func_t WRITE_F,
00386              FILE* OUTPUT_FILE,
00387              void* USER_DATA
00388              );
00389 
00406 extern void
00407 gdsl_interval_heap_dump (const gdsl_interval_heap_t H,
00408         gdsl_write_func_t WRITE_F,
00409         FILE* OUTPUT_FILE,
00410         void* USER_DATA
00411         );
00412 
00413 /*
00414  * @}
00415  */
00416 
00417 
00418 #ifdef __cplusplus
00419 }
00420 #endif /* __cplusplus */
00421 
00422 
00423 #endif /* _GDSL_INTERVAL_HEAP_H_ */
00424 
00425