C Standard Library Extensions  1.2.4
cxmultimap.h
1 /*
2  * This file is part of the ESO C Extension Library
3  * Copyright (C) 2001-2017 European Southern Observatory
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef CX_MULTIMAP_H
21 #define CX_MULTIMAP_H
22 
23 #include <cxmemory.h>
24 #include <cxtree.h>
25 
26 CX_BEGIN_DECLS
27 
39 typedef cx_tree cx_multimap;
40 
50 typedef cx_tree_iterator cx_multimap_iterator;
51 
62 typedef cx_tree_const_iterator cx_multimap_const_iterator;
63 
79 
80 /*
81  * Create, copy and destroy operations
82  */
83 
84 
86  cx_free_func);
88 
89 /*
90  * Nonmodifying operations
91  */
92 
93 cxsize cx_multimap_size(const cx_multimap *);
94 cxbool cx_multimap_empty(const cx_multimap *);
95 cxsize cx_multimap_max_size(const cx_multimap *);
97 
98 /*
99  * Special search operations
100  */
101 
102 cxsize cx_multimap_count(const cx_multimap *, cxcptr);
106 void cx_multimap_equal_range(const cx_multimap *, cxcptr,
108 
109 /*
110  * Assignment operations
111  */
112 
115 
116 /*
117  * Element access
118  */
119 
122 
123 /*
124  * Iterator functions
125  */
126 
133 
134 
135 /*
136  * Inserting and removing elements
137  */
138 
143 cxsize cx_multimap_erase(cx_multimap *, cxcptr);
145 
146 CX_END_DECLS
147 
148 #endif /* CX_MULTIMAP_H */
void cx_multimap_clear(cx_multimap *)
Remove all pairs from a multimap.
Definition: cxmultimap.c:161
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:86
cx_tree cx_multimap
The multimap datatype.
Definition: cxmultimap.h:39
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:525
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:223
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:111
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:137
cxsize cx_multimap_erase(cx_multimap *, cxcptr)
Erase an element from a multimap according to the provided key.
Definition: cxmultimap.c:648
cxbool cx_multimap_empty(const cx_multimap *)
Check whether a multimap is empty.
Definition: cxmultimap.c:187
void cx_multimap_erase_range(cx_multimap *, cx_multimap_iterator, cx_multimap_iterator)
Erase a range of elements from a multimap.
Definition: cxmultimap.c:622
cxsize cx_multimap_max_size(const cx_multimap *)
Get the maximum number of pairs possible.
Definition: cxmultimap.c:293
cx_multimap_iterator cx_multimap_insert(cx_multimap *, cxcptr, cxcptr)
Insert data into a multimap.
Definition: cxmultimap.c:571
cxsize cx_multimap_count(const cx_multimap *, cxcptr)
Get the number of elements matching a key.
Definition: cxmultimap.c:548
cx_multimap_iterator cx_multimap_lower_bound(const cx_multimap *, cxcptr)
Find the beginning of a subsequence matching a given key.
Definition: cxmultimap.c:469
cx_tree_iterator cx_multimap_iterator
The multimap iterator datatype.
Definition: cxmultimap.h:50
void cx_multimap_swap(cx_multimap *, cx_multimap *)
Swap the contents of two multimaps.
Definition: cxmultimap.c:341
cx_multimap_iterator cx_multimap_upper_bound(const cx_multimap *, cxcptr)
Find the end of a subsequence matching a given key.
Definition: cxmultimap.c:496
cx_tree_const_iterator cx_multimap_const_iterator
The multimap constant iterator datatype.
Definition: cxmultimap.h:62
void cx_multimap_delete(cx_multimap *)
Destroy a multimap and all its elements.
Definition: cxmultimap.c:251
cx_multimap_compare_func cx_multimap_key_comp(const cx_multimap *)
Retrieve a multimap's key comparison function.
Definition: cxmultimap.c:317
cxsize cx_multimap_size(const cx_multimap *)
Get the actual number of pairs in the multimap.
Definition: cxmultimap.c:272
cxptr cx_multimap_get_key(const cx_multimap *, cx_multimap_const_iterator)
Get the key from a given iterator position.
Definition: cxmultimap.c:392
void cx_multimap_erase_position(cx_multimap *, cx_multimap_iterator)
Erase an element from a multimap.
Definition: cxmultimap.c:595
cxptr cx_multimap_get_value(const cx_multimap *, cx_multimap_const_iterator)
Get the data from a given iterator position.
Definition: cxmultimap.c:415
cx_multimap_iterator cx_multimap_find(const cx_multimap *, cxcptr)
Locate an element in the multimap.
Definition: cxmultimap.c:442
cxptr cx_multimap_assign(cx_multimap *, cx_multimap_iterator, cxcptr)
Assign data to an iterator position.
Definition: cxmultimap.c:365
cx_multimap_iterator cx_multimap_begin(const cx_multimap *)
Get an iterator to the first pair in a multimap.
Definition: cxmultimap.c:62
cx_tree_compare_func cx_multimap_compare_func
The multimap's key comparison operator function.
Definition: cxmultimap.h:78
cxbool(* cx_tree_compare_func)(cxcptr, cxcptr)
The tree's key comparison operator function.
Definition: cxtree.h:72