C Standard Library Extensions
1.0.5
|
00001 /* $Id: cxslist.h,v 1.6 2006/06/12 09:54:44 rpalsa Exp $ 00002 * 00003 * This file is part of the ESO C Extension Library 00004 * Copyright (C) 2001-2006 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: 2006/06/12 09:54:44 $ 00024 * $Revision: 1.6 $ 00025 * $Name: cpl-5_3_0-BRANCH $ 00026 */ 00027 00028 #ifndef CX_SLIST_H 00029 #define CX_SLIST_H 00030 00031 #include <cxmemory.h> 00032 00033 CX_BEGIN_DECLS 00034 00035 typedef struct _cx_slnode_ *cx_slist_iterator; 00036 typedef const struct _cx_slnode_ *cx_slist_const_iterator; 00037 00038 typedef struct _cx_slist_ cx_slist; 00039 00040 00041 /* 00042 * Create, copy and destroy operations 00043 */ 00044 00045 cx_slist *cx_slist_new(void); 00046 void cx_slist_delete(cx_slist *); 00047 void cx_slist_destroy(cx_slist *, cx_free_func); 00048 00049 /* 00050 * Nonmodifying operations 00051 */ 00052 00053 cxsize cx_slist_size(const cx_slist *); 00054 cxbool cx_slist_empty(const cx_slist *); 00055 cxsize cx_slist_max_size(const cx_slist *); 00056 00057 /* 00058 * Assignment operations 00059 */ 00060 00061 void cx_slist_swap(cx_slist *, cx_slist *); 00062 cxptr cx_slist_assign(cx_slist *, cx_slist_iterator, cxcptr); 00063 00064 /* 00065 * Element access 00066 */ 00067 00068 cxptr cx_slist_front(const cx_slist *); 00069 cxptr cx_slist_back(const cx_slist *); 00070 cxptr cx_slist_get(const cx_slist *, cx_slist_const_iterator); 00071 00072 /* 00073 * Iterator functions 00074 */ 00075 00076 cx_slist_iterator cx_slist_begin(const cx_slist *); 00077 cx_slist_iterator cx_slist_end(const cx_slist *); 00078 cx_slist_iterator cx_slist_next(const cx_slist *, cx_slist_const_iterator); 00079 00080 /* 00081 * Inserting and removing elements 00082 */ 00083 00084 void cx_slist_push_front(cx_slist *, cxcptr); 00085 cxptr cx_slist_pop_front(cx_slist *); 00086 void cx_slist_push_back(cx_slist *, cxcptr); 00087 cxptr cx_slist_pop_back(cx_slist *); 00088 00089 cx_slist_iterator cx_slist_insert(cx_slist *, cx_slist_iterator, cxcptr); 00090 cx_slist_iterator cx_slist_erase(cx_slist *, cx_slist_iterator, cx_free_func); 00091 cxptr cx_slist_extract(cx_slist *, cx_slist_iterator); 00092 void cx_slist_remove(cx_slist *, cxcptr); 00093 void cx_slist_clear(cx_slist *); 00094 00095 /* 00096 * Splice functions 00097 */ 00098 00099 void cx_slist_unique(cx_slist *, cx_compare_func); 00100 void cx_slist_splice(cx_slist *, cx_slist_iterator, cx_slist *, 00101 cx_slist_iterator, cx_slist_iterator); 00102 void cx_slist_merge(cx_slist *, cx_slist *, cx_compare_func); 00103 void cx_slist_sort(cx_slist *, cx_compare_func); 00104 void cx_slist_reverse(cx_slist *); 00105 00106 CX_END_DECLS 00107 00108 #endif /* CX_SLIST_H */