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 00043 00056 typedef struct _gdsl_queue* gdsl_queue_t; 00057 00058 /******************************************************************************/ 00059 /* Management functions of queues */ 00060 /******************************************************************************/ 00061 00082 extern gdsl_queue_t 00083 gdsl_queue_alloc (const char* NAME, 00084 gdsl_alloc_func_t ALLOC_F, 00085 gdsl_free_func_t FREE_F 00086 ); 00087 00101 extern void 00102 gdsl_queue_free (gdsl_queue_t Q 00103 ); 00104 00118 extern void 00119 gdsl_queue_flush (gdsl_queue_t Q 00120 ); 00121 00122 /******************************************************************************/ 00123 /* Consultation functions of queues */ 00124 /******************************************************************************/ 00125 00135 extern const char* 00136 gdsl_queue_get_name (const gdsl_queue_t Q 00137 ); 00138 00146 extern ulong 00147 gdsl_queue_get_size (const gdsl_queue_t Q 00148 ); 00149 00158 extern bool 00159 gdsl_queue_is_empty (const gdsl_queue_t Q 00160 ); 00161 00172 extern gdsl_element_t 00173 gdsl_queue_get_head (const gdsl_queue_t Q 00174 ); 00175 00186 extern gdsl_element_t 00187 gdsl_queue_get_tail (const gdsl_queue_t Q 00188 ); 00189 00190 /******************************************************************************/ 00191 /* Modification functions of queues */ 00192 /******************************************************************************/ 00193 00207 extern gdsl_queue_t 00208 gdsl_queue_set_name (gdsl_queue_t Q, 00209 const char* NEW_NAME 00210 ); 00211 00227 extern gdsl_element_t 00228 gdsl_queue_insert (gdsl_queue_t Q, 00229 void* VALUE 00230 ); 00231 00244 extern gdsl_element_t 00245 gdsl_queue_remove (gdsl_queue_t Q 00246 ); 00247 00248 /******************************************************************************/ 00249 /* Search functions of queues */ 00250 /******************************************************************************/ 00251 00267 extern gdsl_element_t 00268 gdsl_queue_search (const gdsl_queue_t Q, 00269 gdsl_compare_func_t COMP_F, 00270 void* VALUE 00271 ); 00272 00283 extern gdsl_element_t 00284 gdsl_queue_search_by_position (const gdsl_queue_t Q, 00285 ulong POS 00286 ); 00287 00288 /******************************************************************************/ 00289 /* Parse functions of queues */ 00290 /******************************************************************************/ 00291 00309 extern gdsl_element_t 00310 gdsl_queue_map_forward (const gdsl_queue_t Q, 00311 gdsl_map_func_t MAP_F, 00312 void* USER_DATA 00313 ); 00314 00332 extern gdsl_element_t 00333 gdsl_queue_map_backward (const gdsl_queue_t Q, 00334 gdsl_map_func_t MAP_F, 00335 void* USER_DATA 00336 ); 00337 00338 /******************************************************************************/ 00339 /* Input/output functions of queues */ 00340 /******************************************************************************/ 00341 00357 extern void 00358 gdsl_queue_write (const gdsl_queue_t Q, 00359 gdsl_write_func_t WRITE_F, 00360 FILE* OUTPUT_FILE, 00361 void* USER_DATA 00362 ); 00363 00380 extern void 00381 gdsl_queue_write_xml (const gdsl_queue_t Q, 00382 gdsl_write_func_t WRITE_F, 00383 FILE* OUTPUT_FILE, 00384 void* USER_DATA 00385 ); 00386 00403 extern void 00404 gdsl_queue_dump (const gdsl_queue_t Q, 00405 gdsl_write_func_t WRITE_F, 00406 FILE* OUTPUT_FILE, 00407 void* USER_DATA 00408 ); 00409 00410 /* 00411 * @} 00412 */ 00413 00414 00415 #ifdef __cplusplus 00416 } 00417 #endif /* __cplusplus */ 00418 00419 00420 #endif /* _GDSL_QUEUE_H_ */ 00421 00422