C Standard Library Extensions  1.2.3
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 */
cx_multimap_get_key
cxptr cx_multimap_get_key(const cx_multimap *multimap, cx_multimap_const_iterator position)
Get the key from a given iterator position.
Definition: cxmultimap.c:392
cx_multimap_iterator
cx_tree_iterator cx_multimap_iterator
The multimap iterator datatype.
Definition: cxmultimap.h:50
cx_tree_compare_func
cxbool(* cx_tree_compare_func)(cxcptr, cxcptr)
The tree's key comparison operator function.
Definition: cxtree.h:72
cx_tree_count
cxsize cx_tree_count(const cx_tree *tree, cxcptr key)
Get the number of elements matching a key.
Definition: cxtree.c:1616
cx_multimap_erase
cxsize cx_multimap_erase(cx_multimap *multimap, cxcptr key)
Erase an element from a multimap according to the provided key.
Definition: cxmultimap.c:648
cx_multimap_lower_bound
cx_multimap_iterator cx_multimap_lower_bound(const cx_multimap *multimap, cxcptr key)
Find the beginning of a subsequence matching a given key.
Definition: cxmultimap.c:469
cx_tree_end
cx_tree_iterator cx_tree_end(const cx_tree *tree)
Get an iterator for the position after the last pair in the tree.
Definition: cxtree.c:1056
cx_tree_upper_bound
cx_tree_iterator cx_tree_upper_bound(const cx_tree *tree, cxcptr key)
Find the end of a subsequence.
Definition: cxtree.c:1557
cx_multimap_end
cx_multimap_iterator cx_multimap_end(const cx_multimap *multimap)
Get an iterator for the position after the last pair in the multimap.
Definition: cxmultimap.c:86
cx_multimap_clear
void cx_multimap_clear(cx_multimap *multimap)
Remove all pairs from a multimap.
Definition: cxmultimap.c:161
cx_tree_equal_range
void cx_tree_equal_range(const cx_tree *tree, cxcptr key, cx_tree_iterator *begin, cx_tree_iterator *end)
Find a subsequence matching a given key.
Definition: cxtree.c:1588
cx_tree_find
cx_tree_iterator cx_tree_find(const cx_tree *tree, cxcptr key)
Locate an element in the tree.
Definition: cxtree.c:1499
cx_multimap_previous
cx_multimap_iterator cx_multimap_previous(const cx_multimap *multimap, cx_multimap_const_iterator position)
Get an iterator for the previous pair in the multimap.
Definition: cxmultimap.c:137
cx_multimap_delete
void cx_multimap_delete(cx_multimap *multimap)
Destroy a multimap and all its elements.
Definition: cxmultimap.c:251
cx_multimap_get_value
cxptr cx_multimap_get_value(const cx_multimap *multimap, cx_multimap_const_iterator position)
Get the data from a given iterator position.
Definition: cxmultimap.c:415
cx_multimap_insert
cx_multimap_iterator cx_multimap_insert(cx_multimap *multimap, cxcptr key, cxcptr data)
Insert data into a multimap.
Definition: cxmultimap.c:571
cx_multimap_const_iterator
cx_tree_const_iterator cx_multimap_const_iterator
The multimap constant iterator datatype.
Definition: cxmultimap.h:62
cx_tree_next
cx_tree_iterator cx_tree_next(const cx_tree *tree, cx_tree_const_iterator position)
Get an iterator for the next pair in the tree.
Definition: cxtree.c:1083
cx_tree_get_value
cxptr cx_tree_get_value(const cx_tree *tree, cx_tree_const_iterator position)
Get the data from a given iterator position.
Definition: cxtree.c:1468
cx_tree_insert_equal
cx_tree_iterator cx_tree_insert_equal(cx_tree *tree, cxcptr key, cxcptr data)
Insert data into a tree.
Definition: cxtree.c:1688
cx_tree_lower_bound
cx_tree_iterator cx_tree_lower_bound(const cx_tree *tree, cxcptr key)
Find the beginning of a subsequence.
Definition: cxtree.c:1528
cx_tree_erase_position
void cx_tree_erase_position(cx_tree *tree, cx_tree_iterator position)
Erase an element from a tree.
Definition: cxtree.c:1715
cx_multimap_begin
cx_multimap_iterator cx_multimap_begin(const cx_multimap *multimap)
Get an iterator to the first pair in a multimap.
Definition: cxmultimap.c:62
cx_tree_clear
void cx_tree_clear(cx_tree *tree)
Remove all pairs from a tree.
Definition: cxtree.c:1148
cx_tree_erase
cxsize cx_tree_erase(cx_tree *tree, cxcptr key)
Erase all elements from a tree matching the provided key.
Definition: cxtree.c:1785
cx_tree_new
cx_tree * cx_tree_new(cx_tree_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy)
Create a new tree without any elements.
Definition: cxtree.c:1212
cx_tree_previous
cx_tree_iterator cx_tree_previous(const cx_tree *tree, cx_tree_const_iterator position)
Get an iterator for the previous pair in the tree.
Definition: cxtree.c:1117
cx_tree_begin
cx_tree_iterator cx_tree_begin(const cx_tree *tree)
Get an iterator to the first pair in the tree.
Definition: cxtree.c:1030
cx_multimap_new
cx_multimap * cx_multimap_new(cx_multimap_compare_func compare, cx_free_func key_destroy, cx_free_func value_destroy)
Create a new multimap without any elements.
Definition: cxmultimap.c:223
cx_multimap_find
cx_multimap_iterator cx_multimap_find(const cx_multimap *multimap, cxcptr key)
Locate an element in the multimap.
Definition: cxmultimap.c:442
cx_multimap
cx_tree cx_multimap
The multimap datatype.
Definition: cxmultimap.h:39
cx_tree_key_comp
cx_tree_compare_func cx_tree_key_comp(const cx_tree *tree)
Get the key comparison function.
Definition: cxtree.c:1326
cx_tree_max_size
cxsize cx_tree_max_size(const cx_tree *tree)
Get the maximum number of pairs possible.
Definition: cxtree.c:1299
cx_multimap_key_comp
cx_multimap_compare_func cx_multimap_key_comp(const cx_multimap *multimap)
Retrieve a multimap's key comparison function.
Definition: cxmultimap.c:317
cx_multimap_size
cxsize cx_multimap_size(const cx_multimap *multimap)
Get the actual number of pairs in the multimap.
Definition: cxmultimap.c:272
cx_multimap_erase_position
void cx_multimap_erase_position(cx_multimap *multimap, cx_multimap_iterator position)
Erase an element from a multimap.
Definition: cxmultimap.c:595
cx_multimap_empty
cxbool cx_multimap_empty(const cx_multimap *multimap)
Check whether a multimap is empty.
Definition: cxmultimap.c:187
cx_tree_erase_range
void cx_tree_erase_range(cx_tree *tree, cx_tree_iterator begin, cx_tree_iterator end)
Erase a range of elements from a tree.
Definition: cxtree.c:1749
cx_multimap_swap
void cx_multimap_swap(cx_multimap *multimap1, cx_multimap *multimap2)
Swap the contents of two multimaps.
Definition: cxmultimap.c:341
cx_multimap_assign
cxptr cx_multimap_assign(cx_multimap *multimap, cx_multimap_iterator position, cxcptr data)
Assign data to an iterator position.
Definition: cxmultimap.c:365
cx_multimap_equal_range
void cx_multimap_equal_range(const cx_multimap *multimap, cxcptr key, cx_multimap_iterator *begin, cx_multimap_iterator *end)
Find a subsequence matching a given key.
Definition: cxmultimap.c:525
cx_multimap_compare_func
cx_tree_compare_func cx_multimap_compare_func
The multimap's key comparison operator function.
Definition: cxmultimap.h:78
cx_tree_assign
cxptr cx_tree_assign(cx_tree *tree, cx_tree_iterator position, cxcptr data)
Assign data to an iterator position.
Definition: cxtree.c:1404
cx_tree_delete
void cx_tree_delete(cx_tree *tree)
Destroy a tree and all its elements.
Definition: cxtree.c:1250
cx_tree_get_key
cxptr cx_tree_get_key(const cx_tree *tree, cx_tree_const_iterator position)
Get the key from a given iterator position.
Definition: cxtree.c:1441
cx_tree_swap
void cx_tree_swap(cx_tree *tree1, cx_tree *tree2)
Swap the contents of two trees.
Definition: cxtree.c:1352
cx_tree_empty
cxbool cx_tree_empty(const cx_tree *tree)
Check whether a tree is empty.
Definition: cxtree.c:1176
cx_multimap_max_size
cxsize cx_multimap_max_size(const cx_multimap *multimap)
Get the maximum number of pairs possible.
Definition: cxmultimap.c:293
cx_multimap_upper_bound
cx_multimap_iterator cx_multimap_upper_bound(const cx_multimap *multimap, cxcptr key)
Find the end of a subsequence matching a given key.
Definition: cxmultimap.c:496
cx_multimap_erase_range
void cx_multimap_erase_range(cx_multimap *multimap, cx_multimap_iterator begin, cx_multimap_iterator end)
Erase a range of elements from a multimap.
Definition: cxmultimap.c:622
cx_tree_size
cxsize cx_tree_size(const cx_tree *tree)
Get the actual number of pairs in the tree.
Definition: cxtree.c:1276
cx_multimap_count
cxsize cx_multimap_count(const cx_multimap *multimap, cxcptr key)
Get the number of elements matching a key.
Definition: cxmultimap.c:548
cx_multimap_next
cx_multimap_iterator cx_multimap_next(const cx_multimap *multimap, cx_multimap_const_iterator position)
Get an iterator for the next pair in the multimap.
Definition: cxmultimap.c:111