gdsl
1.7
|
00001 /* 00002 * This file is part of the Generic Data Structures Library (GDSL). 00003 * Copyright (C) 1998-2013 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.h,v $ 00021 * $Revision: 1.1 $ 00022 * $Date: 2012/08/21 13:00:04 $ 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 /******************************************************************************/ 00318 /* Parse functions of interval heaps */ 00319 /******************************************************************************/ 00320 00336 extern gdsl_element_t 00337 gdsl_interval_heap_map_forward (const gdsl_interval_heap_t H, 00338 gdsl_map_func_t MAP_F, 00339 void* USER_DATA 00340 ); 00341 00342 /******************************************************************************/ 00343 /* Input/output functions of interval heaps */ 00344 /******************************************************************************/ 00345 00361 extern void 00362 gdsl_interval_heap_write (const gdsl_interval_heap_t H, 00363 gdsl_write_func_t WRITE_F, 00364 FILE* OUTPUT_FILE, 00365 void* USER_DATA 00366 ); 00367 00384 extern void 00385 gdsl_interval_heap_write_xml (const gdsl_interval_heap_t H, 00386 gdsl_write_func_t WRITE_F, 00387 FILE* OUTPUT_FILE, 00388 void* USER_DATA 00389 ); 00390 00407 extern void 00408 gdsl_interval_heap_dump (const gdsl_interval_heap_t H, 00409 gdsl_write_func_t WRITE_F, 00410 FILE* OUTPUT_FILE, 00411 void* USER_DATA 00412 ); 00413 00414 /* 00415 * @} 00416 */ 00417 00418 00419 #ifdef __cplusplus 00420 } 00421 #endif /* __cplusplus */ 00422 00423 00424 #endif /* _GDSL_INTERVAL_HEAP_H_ */ 00425 00426