gdsl  1.8
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-2018 Nicolas Darnis <ndarnis@free.fr>.
00004  *
00005  * GDSL is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation, either version 3 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * GDSL 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 GDSL.  If not, see <http://www.gnu.org/licenses/>. 
00017  */
00018 
00019 /*
00020  * GDSL - Generic Data Structures Library
00021  * $RCSfile: gdsl_interval_heap.h,v $
00022  * $Revision: 1.3 $
00023  * $Date: 2015/02/17 12:22:56 $
00024  */
00025 
00026 
00027 #ifndef _GDSL_INTERVAL_HEAP_H_
00028 #define _GDSL_INTERVAL_HEAP_H_
00029 
00030 
00031 #include <stdio.h>
00032 
00033 
00034 #include "gdsl_types.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" 
00038 {
00039 #endif /* __cplusplus */
00040 
00054 typedef struct heap* gdsl_interval_heap_t;
00055 
00056 /******************************************************************************/
00057 /* Management functions of heaps                                              */
00058 /******************************************************************************/
00059 
00082 extern gdsl_interval_heap_t
00083 gdsl_interval_heap_alloc (const char* NAME,
00084               gdsl_alloc_func_t ALLOC_F,
00085               gdsl_free_func_t FREE_F,
00086               gdsl_compare_func_t COMP_F
00087               );
00088 
00102 extern void
00103 gdsl_interval_heap_free (gdsl_interval_heap_t H
00104              );
00105 
00119 extern void
00120 gdsl_interval_heap_flush (gdsl_interval_heap_t H
00121               );
00122 
00123 /******************************************************************************/
00124 /* Consultation functions of interval heaps                                   */
00125 /******************************************************************************/
00126 
00136 extern const char*
00137 gdsl_interval_heap_get_name (const gdsl_interval_heap_t H
00138                  );
00139 
00147 extern ulong
00148 gdsl_interval_heap_get_size (const gdsl_interval_heap_t H
00149                  );
00150 
00159 extern  void
00160 gdsl_interval_heap_set_max_size (const gdsl_interval_heap_t H,
00161                  ulong size);
00162 
00172 extern bool 
00173 gdsl_interval_heap_is_empty (const gdsl_interval_heap_t H
00174                  );
00175 
00176 /******************************************************************************/
00177 /* Modification functions of interval heaps                                   */
00178 /******************************************************************************/
00179   
00193 extern gdsl_interval_heap_t
00194 gdsl_interval_heap_set_name (gdsl_interval_heap_t H,
00195                  const char* NEW_NAME
00196                  );
00197 
00198 
00217 extern gdsl_element_t
00218 gdsl_interval_heap_insert (gdsl_interval_heap_t H,
00219                void* VALUE
00220                );
00221 
00236 extern gdsl_element_t
00237 gdsl_interval_heap_remove_max (gdsl_interval_heap_t H
00238                    );
00239 
00254 extern gdsl_element_t
00255 gdsl_interval_heap_remove_min (gdsl_interval_heap_t H
00256                    );
00257 
00265 extern gdsl_element_t
00266 gdsl_interval_heap_get_min (const gdsl_interval_heap_t H
00267                 );
00268 
00276 extern gdsl_element_t
00277 gdsl_interval_heap_get_max (const gdsl_interval_heap_t H
00278                 );
00279 
00295 extern gdsl_interval_heap_t
00296 gdsl_interval_heap_delete_min (gdsl_interval_heap_t H
00297                    );
00298 
00314 extern gdsl_interval_heap_t
00315 gdsl_interval_heap_delete_max (gdsl_interval_heap_t H
00316                    );
00317 
00318 /******************************************************************************/
00319 /* Parse functions of interval heaps                                          */
00320 /******************************************************************************/
00321 
00337 extern gdsl_element_t
00338 gdsl_interval_heap_map_forward (const gdsl_interval_heap_t H,
00339                 gdsl_map_func_t MAP_F,
00340                 void* USER_DATA
00341                 );
00342 
00343 /******************************************************************************/
00344 /* Input/output functions of interval heaps                                   */
00345 /******************************************************************************/
00346 
00362 extern void
00363 gdsl_interval_heap_write (const gdsl_interval_heap_t H,
00364               gdsl_write_func_t WRITE_F,
00365               FILE* OUTPUT_FILE,
00366               void* USER_DATA
00367               );
00368 
00385 extern void
00386 gdsl_interval_heap_write_xml (const gdsl_interval_heap_t H,
00387                   gdsl_write_func_t WRITE_F,
00388                   FILE* OUTPUT_FILE,
00389                   void* USER_DATA
00390                   );
00391 
00408 extern void
00409 gdsl_interval_heap_dump (const gdsl_interval_heap_t H,
00410              gdsl_write_func_t WRITE_F,
00411              FILE* OUTPUT_FILE,
00412              void* USER_DATA
00413              );
00414 
00420 #ifdef __cplusplus
00421 }
00422 #endif /* __cplusplus */
00423 
00424 
00425 #endif /* _GDSL_INTERVAL_HEAP_H_ */
00426 
00427