gdsl
1.8
|
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_queue.h,v $ 00019 * $Revision: 1.19 $ 00020 * $Date: 2015/02/17 12:22:57 $ 00021 */ 00022 00023 00028 #ifndef _GDSL_QUEUE_H_ 00029 #define _GDSL_QUEUE_H_ 00030 00031 00032 #include <stdio.h> 00033 00034 00035 #include "gdsl_types.h" 00036 00037 00038 #ifdef __cplusplus 00039 extern "C" 00040 { 00041 #endif /* __cplusplus */ 00042 00074 typedef struct _gdsl_queue* gdsl_queue_t; 00075 00076 /******************************************************************************/ 00077 /* Management functions of queues */ 00078 /******************************************************************************/ 00079 00100 extern gdsl_queue_t 00101 gdsl_queue_alloc (const char* NAME, 00102 gdsl_alloc_func_t ALLOC_F, 00103 gdsl_free_func_t FREE_F 00104 ); 00105 00119 extern void 00120 gdsl_queue_free (gdsl_queue_t Q 00121 ); 00122 00136 extern void 00137 gdsl_queue_flush (gdsl_queue_t Q 00138 ); 00139 00140 /******************************************************************************/ 00141 /* Consultation functions of queues */ 00142 /******************************************************************************/ 00143 00153 extern const char* 00154 gdsl_queue_get_name (const gdsl_queue_t Q 00155 ); 00156 00164 extern ulong 00165 gdsl_queue_get_size (const gdsl_queue_t Q 00166 ); 00167 00176 extern bool 00177 gdsl_queue_is_empty (const gdsl_queue_t Q 00178 ); 00179 00190 extern gdsl_element_t 00191 gdsl_queue_get_head (const gdsl_queue_t Q 00192 ); 00193 00204 extern gdsl_element_t 00205 gdsl_queue_get_tail (const gdsl_queue_t Q 00206 ); 00207 00208 /******************************************************************************/ 00209 /* Modification functions of queues */ 00210 /******************************************************************************/ 00211 00225 extern gdsl_queue_t 00226 gdsl_queue_set_name (gdsl_queue_t Q, 00227 const char* NEW_NAME 00228 ); 00229 00245 extern gdsl_element_t 00246 gdsl_queue_insert (gdsl_queue_t Q, 00247 void* VALUE 00248 ); 00249 00262 extern gdsl_element_t 00263 gdsl_queue_remove (gdsl_queue_t Q 00264 ); 00265 00266 /******************************************************************************/ 00267 /* Search functions of queues */ 00268 /******************************************************************************/ 00269 00285 extern gdsl_element_t 00286 gdsl_queue_search (const gdsl_queue_t Q, 00287 gdsl_compare_func_t COMP_F, 00288 void* VALUE 00289 ); 00290 00301 extern gdsl_element_t 00302 gdsl_queue_search_by_position (const gdsl_queue_t Q, 00303 ulong POS 00304 ); 00305 00306 /******************************************************************************/ 00307 /* Parse functions of queues */ 00308 /******************************************************************************/ 00309 00327 extern gdsl_element_t 00328 gdsl_queue_map_forward (const gdsl_queue_t Q, 00329 gdsl_map_func_t MAP_F, 00330 void* USER_DATA 00331 ); 00332 00350 extern gdsl_element_t 00351 gdsl_queue_map_backward (const gdsl_queue_t Q, 00352 gdsl_map_func_t MAP_F, 00353 void* USER_DATA 00354 ); 00355 00356 /******************************************************************************/ 00357 /* Input/output functions of queues */ 00358 /******************************************************************************/ 00359 00375 extern void 00376 gdsl_queue_write (const gdsl_queue_t Q, 00377 gdsl_write_func_t WRITE_F, 00378 FILE* OUTPUT_FILE, 00379 void* USER_DATA 00380 ); 00381 00398 extern void 00399 gdsl_queue_write_xml (const gdsl_queue_t Q, 00400 gdsl_write_func_t WRITE_F, 00401 FILE* OUTPUT_FILE, 00402 void* USER_DATA 00403 ); 00404 00421 extern void 00422 gdsl_queue_dump (const gdsl_queue_t Q, 00423 gdsl_write_func_t WRITE_F, 00424 FILE* OUTPUT_FILE, 00425 void* USER_DATA 00426 ); 00427 00433 #ifdef __cplusplus 00434 } 00435 #endif /* __cplusplus */ 00436 00437 00438 #endif /* _GDSL_QUEUE_H_ */ 00439 00440