C Standard Library Extensions
1.1
|
00001 /* $Id: cxlist.h,v 1.4 2011/02/21 14:15:31 rpalsa Exp $ 00002 * 00003 * This file is part of the ESO C Extension Library 00004 * Copyright (C) 2001-2011 European Southern Observatory 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 /* 00022 * $Author: rpalsa $ 00023 * $Date: 2011/02/21 14:15:31 $ 00024 * $Revision: 1.4 $ 00025 * $Name: cpl-6_1_1 $ 00026 */ 00027 00028 #ifndef CX_LIST_H 00029 #define CX_LIST_H 00030 00031 #include <cxmemory.h> 00032 00033 CX_BEGIN_DECLS 00034 00035 typedef struct _cx_lnode_ *cx_list_iterator; 00036 typedef const struct _cx_lnode_ *cx_list_const_iterator; 00037 00038 typedef struct _cx_list_ cx_list; 00039 00040 00041 /* 00042 * Create, copy and destroy operations 00043 */ 00044 00045 cx_list *cx_list_new(void); 00046 void cx_list_delete(cx_list *); 00047 void cx_list_destroy(cx_list *, cx_free_func); 00048 00049 /* 00050 * Non-modifying operations 00051 */ 00052 00053 cxsize cx_list_size(const cx_list *); 00054 cxbool cx_list_empty(const cx_list *); 00055 cxsize cx_list_max_size(const cx_list *); 00056 00057 /* 00058 * Assignment operations 00059 */ 00060 00061 void cx_list_swap(cx_list *, cx_list *); 00062 cxptr cx_list_assign(cx_list *, cx_list_iterator, cxcptr); 00063 00064 /* 00065 * Element access 00066 */ 00067 00068 cxptr cx_list_front(const cx_list *); 00069 cxptr cx_list_back(const cx_list *); 00070 cxptr cx_list_get(const cx_list *, cx_list_const_iterator); 00071 00072 /* 00073 * Iterator functions 00074 */ 00075 00076 cx_list_iterator cx_list_begin(const cx_list *); 00077 cx_list_iterator cx_list_end(const cx_list *); 00078 cx_list_iterator cx_list_next(const cx_list *, cx_list_const_iterator); 00079 cx_list_iterator cx_list_previous(const cx_list *, cx_list_const_iterator); 00080 00081 /* 00082 * Inserting and removing elements 00083 */ 00084 00085 void cx_list_push_front(cx_list *, cxcptr); 00086 cxptr cx_list_pop_front(cx_list *); 00087 void cx_list_push_back(cx_list *, cxcptr); 00088 cxptr cx_list_pop_back(cx_list *); 00089 00090 cx_list_iterator cx_list_insert(cx_list *, cx_list_iterator, cxcptr); 00091 cx_list_iterator cx_list_erase(cx_list *, cx_list_iterator, cx_free_func); 00092 cxptr cx_list_extract(cx_list *, cx_list_iterator); 00093 void cx_list_remove(cx_list *, cxcptr); 00094 void cx_list_clear(cx_list *); 00095 00096 /* 00097 * Splice functions 00098 */ 00099 00100 void cx_list_unique(cx_list *, cx_compare_func); 00101 void cx_list_splice(cx_list *, cx_list_iterator, cx_list *, 00102 cx_list_iterator, cx_list_iterator); 00103 void cx_list_merge(cx_list *, cx_list *, cx_compare_func); 00104 void cx_list_sort(cx_list *, cx_compare_func); 00105 void cx_list_reverse(cx_list *); 00106 00107 CX_END_DECLS 00108 00109 #endif /* CX_LIST_H */