cxmultimap.h
/*
* This file is part of the ESO C Extension Library
* Copyright (C) 2001-2026 European Southern Observatory
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CX_MULTIMAP_H
#define CX_MULTIMAP_H
#include "cxtree.h"
#include "cxtypes.h"
CX_BEGIN_DECLS
typedef cx_tree cx_multimap;
typedef cx_tree_iterator cx_multimap_iterator;
typedef cx_tree_const_iterator cx_multimap_const_iterator;
typedef cx_tree_compare_func cx_multimap_compare_func;
/*
* Create, copy and destroy operations
*/
cx_multimap *cx_multimap_new(cx_multimap_compare_func, cx_free_func,
cx_free_func);
void cx_multimap_delete(cx_multimap *);
/*
* Nonmodifying operations
*/
cxsize cx_multimap_size(const cx_multimap *);
cxbool cx_multimap_empty(const cx_multimap *);
cxsize cx_multimap_max_size(const cx_multimap *);
cx_multimap_compare_func cx_multimap_key_comp(const cx_multimap *);
/*
* Special search operations
*/
cxsize cx_multimap_count(const cx_multimap *, cxcptr);
cx_multimap_iterator cx_multimap_find(const cx_multimap *, cxcptr);
cx_multimap_iterator cx_multimap_lower_bound(const cx_multimap *, cxcptr);
cx_multimap_iterator cx_multimap_upper_bound(const cx_multimap *, cxcptr);
void cx_multimap_equal_range(const cx_multimap *, cxcptr,
cx_multimap_iterator *, cx_multimap_iterator *);
/*
* Assignment operations
*/
void cx_multimap_swap(cx_multimap *, cx_multimap *);
cxptr cx_multimap_assign(cx_multimap *, cx_multimap_iterator, cxcptr);
/*
* Element access
*/
cxptr cx_multimap_get_key(const cx_multimap *, cx_multimap_const_iterator);
cxptr cx_multimap_get_value(const cx_multimap *, cx_multimap_const_iterator);
/*
* Iterator functions
*/
cx_multimap_iterator cx_multimap_begin(const cx_multimap *);
cx_multimap_iterator cx_multimap_end(const cx_multimap *);
cx_multimap_iterator cx_multimap_next(const cx_multimap *,
cx_multimap_const_iterator);
cx_multimap_iterator cx_multimap_previous(const cx_multimap *,
cx_multimap_const_iterator);
/*
* Inserting and removing elements
*/
cx_multimap_iterator cx_multimap_insert(cx_multimap *, cxcptr, cxcptr);
void cx_multimap_erase_position(cx_multimap *, cx_multimap_iterator);
void cx_multimap_erase_range(cx_multimap *, cx_multimap_iterator,
cx_multimap_iterator);
cxsize cx_multimap_erase(cx_multimap *, cxcptr);
void cx_multimap_clear(cx_multimap *);
CX_END_DECLS
#endif /* CX_MULTIMAP_H */
cx_multimap_clear
void cx_multimap_clear(cx_multimap *)
Remove all pairs from a multimap.
Definition cxmultimap.c:150
cx_multimap_end
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:81
cx_multimap
cx_tree cx_multimap
The multimap datatype.
Definition cxmultimap.h:39
cx_multimap_equal_range
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:486
cx_multimap_next
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:104
cx_multimap_previous
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:128
cx_multimap_erase
cxsize cx_multimap_erase(cx_multimap *, cxcptr)
Erase an element from a multimap according to the provided key.
Definition cxmultimap.c:598
cx_multimap_empty
cxbool cx_multimap_empty(const cx_multimap *)
Check whether a multimap is empty.
Definition cxmultimap.c:174
cx_multimap_erase_range
void cx_multimap_erase_range(cx_multimap *, cx_multimap_iterator, cx_multimap_iterator)
Erase a range of elements from a multimap.
Definition cxmultimap.c:574
cx_multimap_max_size
cxsize cx_multimap_max_size(const cx_multimap *)
Get the maximum number of pairs possible.
Definition cxmultimap.c:272
cx_multimap_insert
cx_multimap_iterator cx_multimap_insert(cx_multimap *, cxcptr, cxcptr)
Insert data into a multimap.
Definition cxmultimap.c:528
cx_multimap_count
cxsize cx_multimap_count(const cx_multimap *, cxcptr)
Get the number of elements matching a key.
Definition cxmultimap.c:507
cx_multimap_lower_bound
cx_multimap_iterator cx_multimap_lower_bound(const cx_multimap *, cxcptr)
Find the beginning of a subsequence matching a given key.
Definition cxmultimap.c:434
cx_multimap_new
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:208
cx_multimap_iterator
cx_tree_iterator cx_multimap_iterator
The multimap iterator datatype.
Definition cxmultimap.h:50
cx_multimap_swap
void cx_multimap_swap(cx_multimap *, cx_multimap *)
Swap the contents of two multimaps.
Definition cxmultimap.c:316
cx_multimap_upper_bound
cx_multimap_iterator cx_multimap_upper_bound(const cx_multimap *, cxcptr)
Find the end of a subsequence matching a given key.
Definition cxmultimap.c:459
cx_multimap_const_iterator
cx_tree_const_iterator cx_multimap_const_iterator
The multimap constant iterator datatype.
Definition cxmultimap.h:62
cx_multimap_delete
void cx_multimap_delete(cx_multimap *)
Destroy a multimap and all its elements.
Definition cxmultimap.c:234
cx_multimap_key_comp
cx_multimap_compare_func cx_multimap_key_comp(const cx_multimap *)
Retrieve a multimap's key comparison function.
Definition cxmultimap.c:294
cx_multimap_size
cxsize cx_multimap_size(const cx_multimap *)
Get the actual number of pairs in the multimap.
Definition cxmultimap.c:253
cx_multimap_get_key
cxptr cx_multimap_get_key(const cx_multimap *, cx_multimap_const_iterator)
Get the key from a given iterator position.
Definition cxmultimap.c:363
cx_multimap_erase_position
void cx_multimap_erase_position(cx_multimap *, cx_multimap_iterator)
Erase an element from a multimap.
Definition cxmultimap.c:550
cx_multimap_get_value
cxptr cx_multimap_get_value(const cx_multimap *, cx_multimap_const_iterator)
Get the data from a given iterator position.
Definition cxmultimap.c:384
cx_multimap_find
cx_multimap_iterator cx_multimap_find(const cx_multimap *, cxcptr)
Locate an element in the multimap.
Definition cxmultimap.c:409
cx_multimap_assign
cxptr cx_multimap_assign(cx_multimap *, cx_multimap_iterator, cxcptr)
Assign data to an iterator position.
Definition cxmultimap.c:338
cx_multimap_begin
cx_multimap_iterator cx_multimap_begin(const cx_multimap *)
Get an iterator to the first pair in a multimap.
Definition cxmultimap.c:59
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_compare_func
cxbool(* cx_tree_compare_func)(cxcptr, cxcptr)
The tree's key comparison operator function.
Definition cxtree.h:72