Main Page | Modules | File List | Globals

gdsl_list.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-2004 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__list_8h-source.html,v $
00021  * $Revision: 1.4 $
00022  * $Date: 2004/10/03 14:35:38 $
00023  */
00024 
00025 #ifndef _GDSL_LIST_H_
00026 #define _GDSL_LIST_H_
00027 
00028 #include <stdio.h>
00029 
00030 #include "gdsl_types.h"
00031 
00032 #ifdef __cplusplus
00033 extern "C" 
00034 {
00035 #endif
00036 
00037 
00050 typedef struct _gdsl_list* gdsl_list_t;
00051 
00058 typedef struct _gdsl_list_cursor* gdsl_list_cursor_t;
00059 
00060 /******************************************************************************/
00061 /* Management functions of doubly-linked lists                                */
00062 /******************************************************************************/
00063 
00084 extern gdsl_list_t
00085 gdsl_list_alloc (const char* NAME,
00086          gdsl_alloc_func_t ALLOC_F,
00087          gdsl_free_func_t FREE_F
00088          );
00089 
00102 extern void 
00103 gdsl_list_free (gdsl_list_t L
00104         );
00105 
00119 extern void
00120 gdsl_list_flush (gdsl_list_t L
00121          );
00122 
00123 /******************************************************************************/
00124 /* Consultation functions of doubly-linked lists                              */
00125 /******************************************************************************/
00126 
00136 extern const char*
00137 gdsl_list_get_name (const gdsl_list_t L
00138             );
00139 
00147 extern ulong
00148 gdsl_list_get_size (const gdsl_list_t L
00149             );
00150 
00159 extern bool
00160 gdsl_list_is_empty (const gdsl_list_t L
00161             );
00162 
00173 extern gdsl_element_t
00174 gdsl_list_get_head (const gdsl_list_t L
00175             );
00176 
00187 extern gdsl_element_t
00188 gdsl_list_get_tail (const gdsl_list_t L
00189             );
00190 
00191 /******************************************************************************/
00192 /* Modification functions of doubly-linked lists                              */
00193 /******************************************************************************/
00194 
00208 extern gdsl_list_t
00209 gdsl_list_set_name (gdsl_list_t L,
00210             const char* NEW_NAME
00211             );
00212 
00231 extern gdsl_element_t
00232 gdsl_list_insert_head (gdsl_list_t L,
00233                void* VALUE
00234                );
00235 
00254 extern gdsl_element_t
00255 gdsl_list_insert_tail (gdsl_list_t L,
00256                void* VALUE
00257                );
00258 
00274 extern gdsl_element_t
00275 gdsl_list_remove_head (gdsl_list_t L
00276                );
00277 
00293 extern gdsl_element_t
00294 gdsl_list_remove_tail (gdsl_list_t L
00295                );
00296 
00315 extern gdsl_element_t
00316 gdsl_list_remove (gdsl_list_t L,
00317           gdsl_compare_func_t COMP_F,
00318           const void* VALUE
00319           );
00320 
00336 extern gdsl_list_t
00337 gdsl_list_delete_head (gdsl_list_t L
00338                );
00339 
00355 extern gdsl_list_t
00356 gdsl_list_delete_tail (gdsl_list_t L
00357                );
00358 
00377 extern gdsl_list_t
00378 gdsl_list_delete (gdsl_list_t L,
00379           gdsl_compare_func_t COMP_F,
00380           const void *VALUE
00381           );
00382 
00383 /******************************************************************************/
00384 /* Search functions of doubly-linked lists                                    */
00385 /******************************************************************************/
00386 
00404 extern gdsl_element_t
00405 gdsl_list_search (const gdsl_list_t L,
00406           gdsl_compare_func_t COMP_F,
00407           const void* VALUE
00408           );
00409 
00422 extern gdsl_element_t
00423 gdsl_list_search_by_position (const gdsl_list_t L,
00424                   ulong POS
00425                   );
00426 
00443 extern gdsl_element_t
00444 gdsl_list_search_max (const gdsl_list_t L,
00445               gdsl_compare_func_t COMP_F
00446               );
00447 
00464 extern gdsl_element_t
00465 gdsl_list_search_min (const gdsl_list_t L,
00466               gdsl_compare_func_t COMP_F
00467               );
00468 
00469 /******************************************************************************/
00470 /* Sort functions of doubly-linked lists                                      */
00471 /******************************************************************************/
00472 
00488 extern gdsl_list_t
00489 gdsl_list_sort (gdsl_list_t L,
00490         gdsl_compare_func_t COMP_F,
00491         gdsl_element_t MAX
00492         );
00493 
00494 /******************************************************************************/
00495 /* Parse functions of doubly-linked lists                                     */
00496 /******************************************************************************/
00497 
00515 extern gdsl_element_t
00516 gdsl_list_map_forward (const gdsl_list_t L,
00517                gdsl_map_func_t MAP_F,
00518                void *USER_DATA
00519                );
00520 
00538 extern gdsl_element_t
00539 gdsl_list_map_backward (const gdsl_list_t L,
00540             gdsl_map_func_t MAP_F,
00541             void *USER_DATA
00542             );
00543 
00544 /******************************************************************************/
00545 /* Input/output functions of doubly-linked lists                              */
00546 /******************************************************************************/
00547 
00563 extern void
00564 gdsl_list_write (const gdsl_list_t L,
00565          gdsl_write_func_t WRITE_F,
00566          FILE *OUTPUT_FILE,
00567          void *USER_DATA
00568          );
00569 
00586 extern void
00587 gdsl_list_write_xml (const gdsl_list_t L,
00588              gdsl_write_func_t WRITE_F,
00589              FILE *OUTPUT_FILE,
00590              void *USER_DATA
00591              );
00592 
00609 extern void
00610 gdsl_list_dump (const gdsl_list_t L,
00611         gdsl_write_func_t WRITE_F,
00612         FILE *OUTPUT_FILE,
00613         void *USER_DATA
00614         );
00615 
00616 /******************************************************************************/
00617 /* Cursor specific functions of doubly-linked lists                           */
00618 /******************************************************************************/
00619 
00629 gdsl_list_cursor_t
00630 gdsl_list_cursor_alloc (const gdsl_list_t L
00631             );
00639 void
00640 gdsl_list_cursor_free (gdsl_list_cursor_t C
00641                );
00642 
00653 extern void
00654 gdsl_list_cursor_move_to_head (gdsl_list_cursor_t C
00655                    );
00656 
00667 extern void
00668 gdsl_list_cursor_move_to_tail (gdsl_list_cursor_t C
00669                    );
00670 
00686 extern gdsl_element_t
00687 gdsl_list_cursor_move_to_value (gdsl_list_cursor_t C,
00688                 gdsl_compare_func_t COMP_F,
00689                 void* VALUE
00690                 );
00691 
00706 extern gdsl_element_t
00707 gdsl_list_cursor_move_to_position (gdsl_list_cursor_t C,
00708                    ulong POS
00709                    );
00710 
00722 extern void
00723 gdsl_list_cursor_step_forward (gdsl_list_cursor_t C
00724                    );
00725 
00737 extern void
00738 gdsl_list_cursor_step_backward (gdsl_list_cursor_t C
00739                 );
00740 
00750 extern bool
00751 gdsl_list_cursor_is_on_head (const gdsl_list_cursor_t C
00752                  );
00753 
00763 extern bool
00764 gdsl_list_cursor_is_on_tail (const gdsl_list_cursor_t C
00765                  );
00766 
00776 extern bool 
00777 gdsl_list_cursor_has_succ (const gdsl_list_cursor_t C
00778                );
00779 
00789 extern bool 
00790 gdsl_list_cursor_has_pred (const gdsl_list_cursor_t C
00791                );
00792 
00806 extern void
00807  gdsl_list_cursor_set_content (gdsl_list_cursor_t C,
00808                    gdsl_element_t E
00809                    );
00818 extern gdsl_element_t
00819 gdsl_list_cursor_get_content (const gdsl_list_cursor_t C
00820                   );
00821 
00840 extern gdsl_element_t
00841 gdsl_list_cursor_insert_after (gdsl_list_cursor_t C,
00842                    void *VALUE
00843                    );
00862 extern gdsl_element_t
00863 gdsl_list_cursor_insert_before (gdsl_list_cursor_t C,
00864                 void *VALUE
00865                 );
00866 
00880 extern gdsl_element_t
00881 gdsl_list_cursor_remove (gdsl_list_cursor_t C
00882              );
00883 
00896 extern gdsl_element_t
00897 gdsl_list_cursor_remove_after (gdsl_list_cursor_t C
00898                    );
00899 
00912 extern gdsl_element_t
00913 gdsl_list_cursor_remove_before (gdsl_list_cursor_t C
00914                 );
00915 
00931 extern gdsl_list_cursor_t
00932 gdsl_list_cursor_delete (gdsl_list_cursor_t C
00933              );
00934 
00950 extern gdsl_list_cursor_t
00951 gdsl_list_cursor_delete_after (gdsl_list_cursor_t C
00952                    );
00953 
00968 extern gdsl_list_cursor_t
00969 gdsl_list_cursor_delete_before (gdsl_list_cursor_t C
00970                 );
00971 
00972 
00973 /*
00974  * @}
00975  */
00976 
00977 
00978 #ifdef __cplusplus
00979 }
00980 #endif /* __cplusplus */
00981 
00982 
00983 #endif /* GDSL_LIST_H_ */
00984 

Generated on Sun Oct 3 16:15:50 2004 for GDSL by doxygen 1.3.5