gdsl
1.6
|
00001 /* 00002 * This file is part of the Generic Data Structures Library (GDSL). 00003 * Copyright (C) 1998-2006 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__queue_8h_source.html,v $ 00021 * $Revision: 1.2 $ 00022 * $Date: 2012/08/21 14:01:03 $ 00023 */ 00024 00025 00026 #ifndef _GDSL_QUEUE_H_ 00027 #define _GDSL_QUEUE_H_ 00028 00029 00030 #include <stdio.h> 00031 00032 00033 #include "gdsl_types.h" 00034 00035 00036 #ifdef __cplusplus 00037 extern "C" 00038 { 00039 #endif /* __cplusplus */ 00040 00041 00054 typedef struct _gdsl_queue* gdsl_queue_t; 00055 00056 /******************************************************************************/ 00057 /* Management functions of queues */ 00058 /******************************************************************************/ 00059 00080 extern gdsl_queue_t 00081 gdsl_queue_alloc (const char* NAME, 00082 gdsl_alloc_func_t ALLOC_F, 00083 gdsl_free_func_t FREE_F 00084 ); 00085 00099 extern void 00100 gdsl_queue_free (gdsl_queue_t Q 00101 ); 00102 00116 extern void 00117 gdsl_queue_flush (gdsl_queue_t Q 00118 ); 00119 00120 /******************************************************************************/ 00121 /* Consultation functions of queues */ 00122 /******************************************************************************/ 00123 00133 extern const char* 00134 gdsl_queue_get_name (const gdsl_queue_t Q 00135 ); 00136 00144 extern ulong 00145 gdsl_queue_get_size (const gdsl_queue_t Q 00146 ); 00147 00156 extern bool 00157 gdsl_queue_is_empty (const gdsl_queue_t Q 00158 ); 00159 00170 extern gdsl_element_t 00171 gdsl_queue_get_head (const gdsl_queue_t Q 00172 ); 00173 00184 extern gdsl_element_t 00185 gdsl_queue_get_tail (const gdsl_queue_t Q 00186 ); 00187 00188 /******************************************************************************/ 00189 /* Modification functions of queues */ 00190 /******************************************************************************/ 00191 00205 extern gdsl_queue_t 00206 gdsl_queue_set_name (gdsl_queue_t Q, 00207 const char* NEW_NAME 00208 ); 00209 00225 extern gdsl_element_t 00226 gdsl_queue_insert (gdsl_queue_t Q, 00227 void* VALUE 00228 ); 00229 00242 extern gdsl_element_t 00243 gdsl_queue_remove (gdsl_queue_t Q 00244 ); 00245 00246 /******************************************************************************/ 00247 /* Search functions of queues */ 00248 /******************************************************************************/ 00249 00265 extern gdsl_element_t 00266 gdsl_queue_search (const gdsl_queue_t Q, 00267 gdsl_compare_func_t COMP_F, 00268 void* VALUE 00269 ); 00270 00281 extern gdsl_element_t 00282 gdsl_queue_search_by_position (const gdsl_queue_t Q, 00283 ulong POS 00284 ); 00285 00286 /******************************************************************************/ 00287 /* Parse functions of queues */ 00288 /******************************************************************************/ 00289 00307 extern gdsl_element_t 00308 gdsl_queue_map_forward (const gdsl_queue_t Q, 00309 gdsl_map_func_t MAP_F, 00310 void* USER_DATA 00311 ); 00312 00330 extern gdsl_element_t 00331 gdsl_queue_map_backward (const gdsl_queue_t Q, 00332 gdsl_map_func_t MAP_F, 00333 void* USER_DATA 00334 ); 00335 00336 /******************************************************************************/ 00337 /* Input/output functions of queues */ 00338 /******************************************************************************/ 00339 00355 extern void 00356 gdsl_queue_write (const gdsl_queue_t Q, 00357 gdsl_write_func_t WRITE_F, 00358 FILE* OUTPUT_FILE, 00359 void* USER_DATA 00360 ); 00361 00378 extern void 00379 gdsl_queue_write_xml (const gdsl_queue_t Q, 00380 gdsl_write_func_t WRITE_F, 00381 FILE* OUTPUT_FILE, 00382 void* USER_DATA 00383 ); 00384 00401 extern void 00402 gdsl_queue_dump (const gdsl_queue_t Q, 00403 gdsl_write_func_t WRITE_F, 00404 FILE* OUTPUT_FILE, 00405 void* USER_DATA 00406 ); 00407 00408 /* 00409 * @} 00410 */ 00411 00412 00413 #ifdef __cplusplus 00414 } 00415 #endif /* __cplusplus */ 00416 00417 00418 #endif /* _GDSL_QUEUE_H_ */ 00419 00420