C Standard Library Extensions  1.0.5
cxdeque.h
00001 /* $Id: cxdeque.h,v 1.2 2007/07/04 12:14:04 scastro 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: scastro $
00023  * $Date: 2007/07/04 12:14:04 $
00024  * $Revision: 1.2 $
00025  * $Name: cpl-5_3_0-BRANCH $
00026  */
00027 
00028 #ifndef CX_DEQUE_H
00029 #define CX_DEQUE_H
00030 
00031 #include <cxmemory.h>
00032 
00033 CX_BEGIN_DECLS
00034 
00035 typedef struct _cx_deque_ cx_deque;
00036 
00037 typedef unsigned long cx_deque_const_iterator;
00038 typedef unsigned long cx_deque_iterator;
00039 typedef cxint (*cx_deque_compare) (cxcptr a, cxcptr b);
00040 
00041 
00042 cx_deque *cx_deque_new(void);
00043 void cx_deque_destroy(cx_deque *d, cx_free_func deallocate);
00044 
00045 cxsize cx_deque_size(const cx_deque *d);
00046 cxbool cx_deque_empty(const cx_deque *d);
00047 
00048 cxptr cx_deque_get(const cx_deque *d, cx_deque_const_iterator indx);
00049 
00050 cx_deque_iterator cx_deque_begin(const cx_deque *d);
00051 cx_deque_iterator cx_deque_end(const cx_deque *d);
00052 cx_deque_iterator cx_deque_next(const cx_deque *d, cx_deque_const_iterator i);
00053 
00054 
00055 void cx_deque_push_back(cx_deque *d, cxptr what);
00056 void cx_deque_push_front(cx_deque *d, cxptr what);
00057 cx_deque_iterator cx_deque_erase(cx_deque *d, cx_deque_iterator indx, cx_free_func deallocate);
00058 void cx_deque_insert(cx_deque *d, cx_deque_iterator indx, cxptr what);
00059 
00060 void cx_deque_sort(cx_deque *d, cx_deque_compare compare);
00061 
00062 CX_END_DECLS
00063 
00064 #endif /* CX_DEQUE_H */
00065