gdsl  1.8
gdsl_queue.h
Go to the documentation of this file.
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_queue.h,v $
00021  * $Revision: 1.19 $
00022  * $Date: 2015/02/17 12:22:57 $
00023  */
00024 
00025 
00030 #ifndef _GDSL_QUEUE_H_
00031 #define _GDSL_QUEUE_H_
00032 
00033 
00034 #include <stdio.h>
00035 
00036 
00037 #include "gdsl_types.h"
00038 
00039 
00040 #ifdef __cplusplus
00041 extern "C" 
00042 {
00043 #endif /* __cplusplus */
00044 
00045 
00058 typedef struct _gdsl_queue* gdsl_queue_t;
00059 
00060 /******************************************************************************/
00061 /* Management functions of queues                                             */
00062 /******************************************************************************/
00063 
00084 extern gdsl_queue_t
00085 gdsl_queue_alloc (const char* NAME,
00086           gdsl_alloc_func_t ALLOC_F,
00087           gdsl_free_func_t FREE_F
00088           );
00089 
00103 extern void 
00104 gdsl_queue_free (gdsl_queue_t Q
00105          );
00106 
00120 extern void
00121 gdsl_queue_flush (gdsl_queue_t Q
00122           );
00123 
00124 /******************************************************************************/
00125 /* Consultation functions of queues                                           */
00126 /******************************************************************************/
00127 
00137 extern const char*
00138 gdsl_queue_get_name (const gdsl_queue_t Q
00139              );
00140 
00148 extern ulong
00149 gdsl_queue_get_size (const gdsl_queue_t Q
00150              );
00151 
00160 extern bool 
00161 gdsl_queue_is_empty (const gdsl_queue_t Q
00162              );
00163 
00174 extern gdsl_element_t
00175 gdsl_queue_get_head (const gdsl_queue_t Q
00176              );
00177 
00188 extern gdsl_element_t
00189 gdsl_queue_get_tail (const gdsl_queue_t Q
00190              );
00191 
00192 /******************************************************************************/
00193 /* Modification functions of queues                                           */
00194 /******************************************************************************/
00195 
00209 extern gdsl_queue_t
00210 gdsl_queue_set_name (gdsl_queue_t Q,
00211              const char* NEW_NAME
00212              );
00213 
00229 extern gdsl_element_t
00230 gdsl_queue_insert (gdsl_queue_t Q,
00231            void* VALUE
00232            );
00233 
00246 extern gdsl_element_t
00247 gdsl_queue_remove (gdsl_queue_t Q
00248            );
00249 
00250 /******************************************************************************/
00251 /* Search functions of queues                                                 */
00252 /******************************************************************************/
00253 
00269 extern gdsl_element_t
00270 gdsl_queue_search (const gdsl_queue_t Q,
00271            gdsl_compare_func_t COMP_F,
00272            void* VALUE
00273            );
00274 
00285 extern gdsl_element_t
00286 gdsl_queue_search_by_position (const gdsl_queue_t Q,
00287                    ulong POS
00288                    );
00289 
00290 /******************************************************************************/
00291 /* Parse functions of queues                                                  */
00292 /******************************************************************************/
00293 
00311 extern gdsl_element_t
00312 gdsl_queue_map_forward (const gdsl_queue_t Q,
00313             gdsl_map_func_t MAP_F,
00314             void* USER_DATA
00315             );
00316 
00334 extern gdsl_element_t
00335 gdsl_queue_map_backward (const gdsl_queue_t Q,
00336              gdsl_map_func_t MAP_F,
00337              void* USER_DATA
00338              );
00339 
00340 /******************************************************************************/
00341 /* Input/output functions of queues                                           */
00342 /******************************************************************************/
00343 
00359 extern void
00360 gdsl_queue_write (const gdsl_queue_t Q,
00361           gdsl_write_func_t WRITE_F,
00362           FILE* OUTPUT_FILE,
00363           void* USER_DATA
00364           );
00365 
00382 extern void
00383 gdsl_queue_write_xml (const gdsl_queue_t Q,
00384               gdsl_write_func_t WRITE_F,
00385               FILE* OUTPUT_FILE,
00386               void* USER_DATA
00387               );
00388 
00405 extern void 
00406 gdsl_queue_dump (const gdsl_queue_t Q,
00407          gdsl_write_func_t WRITE_F,
00408          FILE* OUTPUT_FILE,
00409          void* USER_DATA
00410          );
00411 
00412 /*
00413  * @}
00414  */
00415 
00416 
00417 #ifdef __cplusplus
00418 }
00419 #endif /* __cplusplus */
00420 
00421 
00422 #endif /* _GDSL_QUEUE_H_ */
00423 
00424