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-2017 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  * $RCSfile: gdsl_interval_heap.h,v $
00019  * $Revision: 1.3 $
00020  * $Date: 2015/02/17 12:22:56 $
00021  */
00022 
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 
00072 typedef struct heap* gdsl_interval_heap_t;
00073 
00074 /******************************************************************************/
00075 /* Management functions of heaps                                              */
00076 /******************************************************************************/
00077 
00100 extern gdsl_interval_heap_t
00101 gdsl_interval_heap_alloc (const char* NAME,
00102               gdsl_alloc_func_t ALLOC_F,
00103               gdsl_free_func_t FREE_F,
00104               gdsl_compare_func_t COMP_F
00105               );
00106 
00120 extern void
00121 gdsl_interval_heap_free (gdsl_interval_heap_t H
00122              );
00123 
00137 extern void
00138 gdsl_interval_heap_flush (gdsl_interval_heap_t H
00139               );
00140 
00141 /******************************************************************************/
00142 /* Consultation functions of interval heaps                                   */
00143 /******************************************************************************/
00144 
00154 extern const char*
00155 gdsl_interval_heap_get_name (const gdsl_interval_heap_t H
00156                  );
00157 
00165 extern ulong
00166 gdsl_interval_heap_get_size (const gdsl_interval_heap_t H
00167                  );
00168 
00177 extern  void
00178 gdsl_interval_heap_set_max_size (const gdsl_interval_heap_t H,
00179                  ulong size);
00180 
00190 extern bool 
00191 gdsl_interval_heap_is_empty (const gdsl_interval_heap_t H
00192                  );
00193 
00194 /******************************************************************************/
00195 /* Modification functions of interval heaps                                   */
00196 /******************************************************************************/
00197   
00211 extern gdsl_interval_heap_t
00212 gdsl_interval_heap_set_name (gdsl_interval_heap_t H,
00213                  const char* NEW_NAME
00214                  );
00215 
00216 
00235 extern gdsl_element_t
00236 gdsl_interval_heap_insert (gdsl_interval_heap_t H,
00237                void* VALUE
00238                );
00239 
00254 extern gdsl_element_t
00255 gdsl_interval_heap_remove_max (gdsl_interval_heap_t H
00256                    );
00257 
00272 extern gdsl_element_t
00273 gdsl_interval_heap_remove_min (gdsl_interval_heap_t H
00274                    );
00275 
00283 extern gdsl_element_t
00284 gdsl_interval_heap_get_min (const gdsl_interval_heap_t H
00285                 );
00286 
00294 extern gdsl_element_t
00295 gdsl_interval_heap_get_max (const gdsl_interval_heap_t H
00296                 );
00297 
00313 extern gdsl_interval_heap_t
00314 gdsl_interval_heap_delete_min (gdsl_interval_heap_t H
00315                    );
00316 
00332 extern gdsl_interval_heap_t
00333 gdsl_interval_heap_delete_max (gdsl_interval_heap_t H
00334                    );
00335 
00336 /******************************************************************************/
00337 /* Parse functions of interval heaps                                          */
00338 /******************************************************************************/
00339 
00355 extern gdsl_element_t
00356 gdsl_interval_heap_map_forward (const gdsl_interval_heap_t H,
00357                 gdsl_map_func_t MAP_F,
00358                 void* USER_DATA
00359                 );
00360 
00361 /******************************************************************************/
00362 /* Input/output functions of interval heaps                                   */
00363 /******************************************************************************/
00364 
00380 extern void
00381 gdsl_interval_heap_write (const gdsl_interval_heap_t H,
00382               gdsl_write_func_t WRITE_F,
00383               FILE* OUTPUT_FILE,
00384               void* USER_DATA
00385               );
00386 
00403 extern void
00404 gdsl_interval_heap_write_xml (const gdsl_interval_heap_t H,
00405                   gdsl_write_func_t WRITE_F,
00406                   FILE* OUTPUT_FILE,
00407                   void* USER_DATA
00408                   );
00409 
00426 extern void
00427 gdsl_interval_heap_dump (const gdsl_interval_heap_t H,
00428              gdsl_write_func_t WRITE_F,
00429              FILE* OUTPUT_FILE,
00430              void* USER_DATA
00431              );
00432 
00438 #ifdef __cplusplus
00439 }
00440 #endif /* __cplusplus */
00441 
00442 
00443 #endif /* _GDSL_INTERVAL_HEAP_H_ */
00444 
00445