C Standard Library Extensions  1.1
cxmultimap.h
00001 /* $Id: cxmultimap.h,v 1.6 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.6 $
00025  * $Name: cpl-6_1_1 $
00026  */
00027 
00028 #ifndef CX_MULTIMAP_H
00029 #define CX_MULTIMAP_H
00030 
00031 #include <cxmemory.h>
00032 #include <cxtree.h>
00033 
00034 CX_BEGIN_DECLS
00035 
00047 typedef cx_tree cx_multimap;
00048 
00058 typedef cx_tree_iterator cx_multimap_iterator;
00059 
00070 typedef cx_tree_const_iterator cx_multimap_const_iterator;
00071 
00086 typedef cx_tree_compare_func cx_multimap_compare_func;
00087 
00088 /*
00089  * Create, copy and destroy operations
00090  */
00091 
00092 
00093 cx_multimap *cx_multimap_new(cx_multimap_compare_func, cx_free_func,
00094                              cx_free_func);
00095 void cx_multimap_delete(cx_multimap *);
00096 
00097 /*
00098  * Nonmodifying operations
00099  */
00100 
00101 cxsize cx_multimap_size(const cx_multimap *);
00102 cxbool cx_multimap_empty(const cx_multimap *);
00103 cxsize cx_multimap_max_size(const cx_multimap *);
00104 cx_multimap_compare_func cx_multimap_key_comp(const cx_multimap *);
00105 
00106 /*
00107  * Special search operations
00108  */
00109 
00110 cxsize cx_multimap_count(const cx_multimap *, cxcptr);
00111 cx_multimap_iterator cx_multimap_find(const cx_multimap *, cxcptr);
00112 cx_multimap_iterator cx_multimap_lower_bound(const cx_multimap *, cxcptr);
00113 cx_multimap_iterator cx_multimap_upper_bound(const cx_multimap *, cxcptr);
00114 void cx_multimap_equal_range(const cx_multimap *, cxcptr,
00115                              cx_multimap_iterator *, cx_multimap_iterator *);
00116 
00117 /*
00118  * Assignment operations
00119  */
00120 
00121 void cx_multimap_swap(cx_multimap *, cx_multimap *);
00122 cxptr cx_multimap_assign(cx_multimap *, cx_multimap_iterator, cxcptr);
00123 
00124 /*
00125  * Element access
00126  */
00127 
00128 cxptr cx_multimap_get_key(const cx_multimap *, cx_multimap_const_iterator);
00129 cxptr cx_multimap_get_value(const cx_multimap *, cx_multimap_const_iterator);
00130 
00131 /*
00132  * Iterator functions
00133  */
00134 
00135 cx_multimap_iterator cx_multimap_begin(const cx_multimap *);
00136 cx_multimap_iterator cx_multimap_end(const cx_multimap *);
00137 cx_multimap_iterator cx_multimap_next(const cx_multimap *,
00138                                       cx_multimap_const_iterator);
00139 cx_multimap_iterator cx_multimap_previous(const cx_multimap *,
00140                                           cx_multimap_const_iterator);
00141 
00142 
00143 /*
00144  * Inserting and removing elements
00145  */
00146 
00147 cx_multimap_iterator cx_multimap_insert(cx_multimap *, cxcptr, cxcptr);
00148 void cx_multimap_erase_position(cx_multimap *, cx_multimap_iterator);
00149 void cx_multimap_erase_range(cx_multimap *, cx_multimap_iterator,
00150                              cx_multimap_iterator);
00151 cxsize cx_multimap_erase(cx_multimap *, cxcptr);
00152 void cx_multimap_clear(cx_multimap *);
00153 
00154 CX_END_DECLS
00155 
00156 #endif /* CX_MULTIMAP_H */