C Standard Library Extensions  1.2.0
cxmultimap.h
1 /* $Id: cxmultimap.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.6 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_MULTIMAP_H
29 #define CX_MULTIMAP_H
30 
31 #include <cxmemory.h>
32 #include <cxtree.h>
33 
34 CX_BEGIN_DECLS
35 
47 typedef cx_tree cx_multimap;
48 
58 typedef cx_tree_iterator cx_multimap_iterator;
59 
70 typedef cx_tree_const_iterator cx_multimap_const_iterator;
71 
87 
88 /*
89  * Create, copy and destroy operations
90  */
91 
92 
94  cx_free_func);
96 
97 /*
98  * Nonmodifying operations
99  */
100 
101 cxsize cx_multimap_size(const cx_multimap *);
102 cxbool cx_multimap_empty(const cx_multimap *);
103 cxsize cx_multimap_max_size(const cx_multimap *);
105 
106 /*
107  * Special search operations
108  */
109 
110 cxsize cx_multimap_count(const cx_multimap *, cxcptr);
114 void cx_multimap_equal_range(const cx_multimap *, cxcptr,
116 
117 /*
118  * Assignment operations
119  */
120 
123 
124 /*
125  * Element access
126  */
127 
130 
131 /*
132  * Iterator functions
133  */
134 
141 
142 
143 /*
144  * Inserting and removing elements
145  */
146 
151 cxsize cx_multimap_erase(cx_multimap *, cxcptr);
153 
154 CX_END_DECLS
155 
156 #endif /* CX_MULTIMAP_H */
cxsize cx_multimap_max_size(const cx_multimap *)
Get the maximum number of pairs possible.
Definition: cxmultimap.c:301
cx_multimap_iterator cx_multimap_insert(cx_multimap *, cxcptr, cxcptr)
Insert data into a multimap.
Definition: cxmultimap.c:579
cxsize cx_multimap_count(const cx_multimap *, cxcptr)
Get the number of elements matching a key.
Definition: cxmultimap.c:556
cxbool(* cx_tree_compare_func)(cxcptr, cxcptr)
The tree's key comparison operator function.
Definition: cxtree.h:75
cx_multimap * cx_multimap_new(cx_multimap_compare_func, cx_free_func, cx_free_func)
Create a new multimap without any elements.
Definition: cxmultimap.c:231
void cx_multimap_clear(cx_multimap *)
Remove all pairs from a multimap.
Definition: cxmultimap.c:169
cxptr cx_multimap_get_value(const cx_multimap *, cx_multimap_const_iterator)
Get the data from a given iterator position.
Definition: cxmultimap.c:423
void cx_multimap_swap(cx_multimap *, cx_multimap *)
Swap the contents of two multimaps.
Definition: cxmultimap.c:349
cx_multimap_iterator cx_multimap_next(const cx_multimap *, cx_multimap_const_iterator)
Get an iterator for the next pair in the multimap.
Definition: cxmultimap.c:119
cx_multimap_iterator cx_multimap_find(const cx_multimap *, cxcptr)
Locate an element in the multimap.
Definition: cxmultimap.c:450
void cx_multimap_erase_range(cx_multimap *, cx_multimap_iterator, cx_multimap_iterator)
Erase a range of elements from a multimap.
Definition: cxmultimap.c:630
cx_multimap_compare_func cx_multimap_key_comp(const cx_multimap *)
Retrieve a multimap's key comparison function.
Definition: cxmultimap.c:325
cx_multimap_iterator cx_multimap_previous(const cx_multimap *, cx_multimap_const_iterator)
Get an iterator for the previous pair in the multimap.
Definition: cxmultimap.c:145
cxsize cx_multimap_erase(cx_multimap *, cxcptr)
Erase an element from a multimap according to the provided key.
Definition: cxmultimap.c:656
cxptr cx_multimap_assign(cx_multimap *, cx_multimap_iterator, cxcptr)
Assign data to an iterator position.
Definition: cxmultimap.c:373
cx_tree_const_iterator cx_multimap_const_iterator
The multimap constant iterator datatype.
Definition: cxmultimap.h:70
cx_multimap_iterator cx_multimap_lower_bound(const cx_multimap *, cxcptr)
Find the beginning of a subsequence matching a given key.
Definition: cxmultimap.c:477
cx_multimap_iterator cx_multimap_upper_bound(const cx_multimap *, cxcptr)
Find the end of a subsequence matching a given key.
Definition: cxmultimap.c:504
cxsize cx_multimap_size(const cx_multimap *)
Get the actual number of pairs in the multimap.
Definition: cxmultimap.c:280
cx_multimap_iterator cx_multimap_begin(const cx_multimap *)
Get an iterator to the first pair in a multimap.
Definition: cxmultimap.c:70
cxbool cx_multimap_empty(const cx_multimap *)
Check whether a multimap is empty.
Definition: cxmultimap.c:195
cx_tree cx_multimap
The multimap datatype.
Definition: cxmultimap.h:47
cx_tree_iterator cx_multimap_iterator
The multimap iterator datatype.
Definition: cxmultimap.h:58
cx_multimap_iterator cx_multimap_end(const cx_multimap *)
Get an iterator for the position after the last pair in the multimap.
Definition: cxmultimap.c:94
void cx_multimap_delete(cx_multimap *)
Destroy a multimap and all its elements.
Definition: cxmultimap.c:259
cx_tree_compare_func cx_multimap_compare_func
The multimap's key comparison operator function.
Definition: cxmultimap.h:86
void cx_multimap_equal_range(const cx_multimap *, cxcptr, cx_multimap_iterator *, cx_multimap_iterator *)
Find a subsequence matching a given key.
Definition: cxmultimap.c:533
void cx_multimap_erase_position(cx_multimap *, cx_multimap_iterator)
Erase an element from a multimap.
Definition: cxmultimap.c:603
cxptr cx_multimap_get_key(const cx_multimap *, cx_multimap_const_iterator)
Get the key from a given iterator position.
Definition: cxmultimap.c:400