gdsl
1.8
|
00001 /* 00002 * This file is part of the Generic Data Structures Library (GDSL). 00003 * Copyright (C) 1998-2015 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.3 $ 00022 * $Date: 2015/02/17 12:22:56 $ 00023 */ 00024 00029 #ifndef _GDSL_INTERVAL_HEAP_H_ 00030 #define _GDSL_INTERVAL_HEAP_H_ 00031 00032 00033 #include <stdio.h> 00034 00035 00036 #include "gdsl_types.h" 00037 00038 #ifdef __cplusplus 00039 extern "C" 00040 { 00041 #endif /* __cplusplus */ 00042 00043 00056 typedef struct heap* gdsl_interval_heap_t; 00057 00058 /******************************************************************************/ 00059 /* Management functions of heaps */ 00060 /******************************************************************************/ 00061 00084 extern gdsl_interval_heap_t 00085 gdsl_interval_heap_alloc (const char* NAME, 00086 gdsl_alloc_func_t ALLOC_F, 00087 gdsl_free_func_t FREE_F, 00088 gdsl_compare_func_t COMP_F 00089 ); 00090 00104 extern void 00105 gdsl_interval_heap_free (gdsl_interval_heap_t H 00106 ); 00107 00121 extern void 00122 gdsl_interval_heap_flush (gdsl_interval_heap_t H 00123 ); 00124 00125 /******************************************************************************/ 00126 /* Consultation functions of interval heaps */ 00127 /******************************************************************************/ 00128 00138 extern const char* 00139 gdsl_interval_heap_get_name (const gdsl_interval_heap_t H 00140 ); 00141 00149 extern ulong 00150 gdsl_interval_heap_get_size (const gdsl_interval_heap_t H 00151 ); 00152 00161 extern void 00162 gdsl_interval_heap_set_max_size (const gdsl_interval_heap_t H, 00163 ulong size); 00164 00174 extern bool 00175 gdsl_interval_heap_is_empty (const gdsl_interval_heap_t H 00176 ); 00177 00178 /******************************************************************************/ 00179 /* Modification functions of interval heaps */ 00180 /******************************************************************************/ 00181 00195 extern gdsl_interval_heap_t 00196 gdsl_interval_heap_set_name (gdsl_interval_heap_t H, 00197 const char* NEW_NAME 00198 ); 00199 00200 00219 extern gdsl_element_t 00220 gdsl_interval_heap_insert (gdsl_interval_heap_t H, 00221 void* VALUE 00222 ); 00223 00238 extern gdsl_element_t 00239 gdsl_interval_heap_remove_max (gdsl_interval_heap_t H 00240 ); 00241 00256 extern gdsl_element_t 00257 gdsl_interval_heap_remove_min (gdsl_interval_heap_t H 00258 ); 00259 00267 extern gdsl_element_t 00268 gdsl_interval_heap_get_min (const gdsl_interval_heap_t H 00269 ); 00270 00278 extern gdsl_element_t 00279 gdsl_interval_heap_get_max (const gdsl_interval_heap_t H 00280 ); 00281 00297 extern gdsl_interval_heap_t 00298 gdsl_interval_heap_delete_min (gdsl_interval_heap_t H 00299 ); 00300 00316 extern gdsl_interval_heap_t 00317 gdsl_interval_heap_delete_max (gdsl_interval_heap_t H 00318 ); 00319 00320 /******************************************************************************/ 00321 /* Parse functions of interval heaps */ 00322 /******************************************************************************/ 00323 00339 extern gdsl_element_t 00340 gdsl_interval_heap_map_forward (const gdsl_interval_heap_t H, 00341 gdsl_map_func_t MAP_F, 00342 void* USER_DATA 00343 ); 00344 00345 /******************************************************************************/ 00346 /* Input/output functions of interval heaps */ 00347 /******************************************************************************/ 00348 00364 extern void 00365 gdsl_interval_heap_write (const gdsl_interval_heap_t H, 00366 gdsl_write_func_t WRITE_F, 00367 FILE* OUTPUT_FILE, 00368 void* USER_DATA 00369 ); 00370 00387 extern void 00388 gdsl_interval_heap_write_xml (const gdsl_interval_heap_t H, 00389 gdsl_write_func_t WRITE_F, 00390 FILE* OUTPUT_FILE, 00391 void* USER_DATA 00392 ); 00393 00410 extern void 00411 gdsl_interval_heap_dump (const gdsl_interval_heap_t H, 00412 gdsl_write_func_t WRITE_F, 00413 FILE* OUTPUT_FILE, 00414 void* USER_DATA 00415 ); 00416 00417 /* 00418 * @} 00419 */ 00420 00421 00422 #ifdef __cplusplus 00423 } 00424 #endif /* __cplusplus */ 00425 00426 00427 #endif /* _GDSL_INTERVAL_HEAP_H_ */ 00428 00429