Typedefs | |
typedef cx_tree | cx_multimap |
The multimap datatype. | |
typedef cx_tree_iterator | cx_multimap_iterator |
The multimap iterator datatype. | |
typedef cx_tree_const_iterator | cx_multimap_const_iterator |
The multimap constant iterator datatype. | |
typedef cx_tree_compare_func | cx_multimap_compare_func |
The multimap's key comparison operator function. | |
Functions | |
cx_multimap_iterator | cx_multimap_begin (const cx_multimap *multimap) |
Get an iterator to the first pair in a multimap. | |
cx_multimap_iterator | cx_multimap_end (const cx_multimap *multimap) |
Get an iterator for the position after the last pair in the multimap. | |
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. | |
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. | |
void | cx_multimap_clear (cx_multimap *multimap) |
Remove all pairs from a multimap. | |
cxbool | cx_multimap_empty (const cx_multimap *multimap) |
Check whether a multimap is empty. | |
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. | |
void | cx_multimap_delete (cx_multimap *multimap) |
Destroy a multimap and all its elements. | |
cxsize | cx_multimap_size (const cx_multimap *multimap) |
Get the actual number of pairs in the multimap. | |
cxsize | cx_multimap_max_size (const cx_multimap *multimap) |
Get the maximum number of pairs possible. | |
cx_multimap_compare_func | cx_multimap_key_comp (const cx_multimap *multimap) |
Retrieve a multimap's key comparison function. | |
void | cx_multimap_swap (cx_multimap *multimap1, cx_multimap *multimap2) |
Swap the contents of two multimaps. | |
cxptr | cx_multimap_assign (cx_multimap *multimap, cx_multimap_iterator position, cxcptr data) |
Assign data to an iterator position. | |
cxptr | cx_multimap_get_key (const cx_multimap *multimap, cx_multimap_const_iterator position) |
Get the key from a given iterator position. | |
cxptr | cx_multimap_get_value (const cx_multimap *multimap, cx_multimap_const_iterator position) |
Get the data from a given iterator position. | |
cx_multimap_iterator | cx_multimap_find (const cx_multimap *multimap, cxcptr key) |
Locate an element in the multimap. | |
cx_multimap_iterator | cx_multimap_lower_bound (const cx_multimap *multimap, cxcptr key) |
Find the beginning of a subsequence matching a given key. | |
cx_multimap_iterator | cx_multimap_upper_bound (const cx_multimap *multimap, cxcptr key) |
Find the end of a subsequence matching a given key. | |
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. | |
cxsize | cx_multimap_count (const cx_multimap *multimap, cxcptr key) |
Get the number of elements matching a key. | |
cx_multimap_iterator | cx_multimap_insert (cx_multimap *multimap, cxcptr key, cxcptr data) |
Insert data into a multimap. | |
void | cx_multimap_erase_position (cx_multimap *multimap, cx_multimap_iterator position) |
Erase an element from a multimap. | |
void | cx_multimap_erase_range (cx_multimap *multimap, cx_multimap_iterator begin, cx_multimap_iterator end) |
Erase a range of elements from a multimap. | |
cxsize | cx_multimap_erase (cx_multimap *multimap, cxcptr key) |
Erase an element from a multimap according to the provided key. |
#include <cxmultimap.h>
typedef cx_tree cx_multimap |
The multimap datatype.
The internal representation of a mutimap is, as for ordinary maps too, a balanced binary tree. For this reason cx_multimap is just an alias for cx_tree.
The multimap's key comparison operator function.
This type of function is used internally by a multimap when key comparisons are necessary. It must return TRUE
if the comparison of its first argument with the second argument succeeds, and FALSE
otherwise. It is actually an alias for cx_tree_compare_func.
typedef cx_tree_const_iterator cx_multimap_const_iterator |
The multimap constant iterator datatype.
The multimap constant iterator is just an alias for the cx_tree_const_iterator datatype.
typedef cx_tree_iterator cx_multimap_iterator |
The multimap iterator datatype.
The multimap iterator is just an alias for the cx_tree_iterator datatype.
cxptr cx_multimap_assign | ( | cx_multimap * | multimap, | |
cx_multimap_iterator | position, | |||
cxcptr | data | |||
) |
Assign data to an iterator position.
multimap | A multimap. | |
position | Iterator positions where the data will be stored. | |
data | Data to store. |
cx_multimap_iterator cx_multimap_begin | ( | const cx_multimap * | multimap | ) |
Get an iterator to the first pair in a multimap.
multimap | The multimap to query. |
void cx_multimap_clear | ( | cx_multimap * | multimap | ) |
Remove all pairs from a multimap.
multimap | Multimap to be cleared. |
cxsize cx_multimap_count | ( | const cx_multimap * | multimap, | |
cxcptr | key | |||
) |
Get the number of elements matching a key.
multimap | A multimap. | |
key | Key of the (key, value) pair(s) to locate. |
void cx_multimap_delete | ( | cx_multimap * | multimap | ) |
Destroy a multimap and all its elements.
multimap | The multimap to destroy. |
cxbool cx_multimap_empty | ( | const cx_multimap * | multimap | ) |
Check whether a multimap is empty.
multimap | A multimap. |
TRUE
if the multimap is empty, and FALSE
otherwise.return (cx_multimap_size(multimap) == 0);
cx_multimap_iterator cx_multimap_end | ( | const cx_multimap * | multimap | ) |
Get an iterator for the position after the last pair in the multimap.
multimap | The multimap to query. |
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.
multimap | A multimap. | |
key | The key of the (key, value) pair(s) to be located. | |
begin | First element with key key. | |
end | Last element with key key. |
cxsize cx_multimap_erase | ( | cx_multimap * | multimap, | |
cxcptr | key | |||
) |
Erase an element from a multimap according to the provided key.
multimap | A multimap. | |
key | Key of the element to be erased. |
void cx_multimap_erase_position | ( | cx_multimap * | multimap, | |
cx_multimap_iterator | position | |||
) |
Erase an element from a multimap.
multimap | A multimap. | |
position | Iterator position of the element to be erased. |
void cx_multimap_erase_range | ( | cx_multimap * | multimap, | |
cx_multimap_iterator | begin, | |||
cx_multimap_iterator | end | |||
) |
Erase a range of elements from a multimap.
multimap | A multimap. | |
begin | Iterator pointing to the start of the range to erase. | |
end | Iterator pointing to the end of the range to erase. |
cx_multimap_iterator cx_multimap_find | ( | const cx_multimap * | multimap, | |
cxcptr | key | |||
) |
Locate an element in the multimap.
multimap | A multimap. | |
key | Key of the (key, value) pair to locate. |
cxptr cx_multimap_get_key | ( | const cx_multimap * | multimap, | |
cx_multimap_const_iterator | position | |||
) |
Get the key from a given iterator position.
multimap | A multimap. | |
position | Iterator position the data is retrieved from. |
cxptr cx_multimap_get_value | ( | const cx_multimap * | multimap, | |
cx_multimap_const_iterator | position | |||
) |
Get the data from a given iterator position.
multimap | A multimap. | |
position | Iterator position the data is retrieved from. |
cx_multimap_iterator cx_multimap_insert | ( | cx_multimap * | multimap, | |
cxcptr | key, | |||
cxcptr | data | |||
) |
Insert data into a multimap.
multimap | A multimap. | |
key | Key used to store the data. | |
data | Data to insert. |
cx_multimap_compare_func cx_multimap_key_comp | ( | const cx_multimap * | multimap | ) |
Retrieve a multimap's key comparison function.
multimap | The multimap to query. |
cx_multimap_iterator cx_multimap_lower_bound | ( | const cx_multimap * | multimap, | |
cxcptr | key | |||
) |
Find the beginning of a subsequence matching a given key.
multimap | A multimap. | |
key | Key of the (key, value) pair(s) to locate. |
cxsize cx_multimap_max_size | ( | const cx_multimap * | multimap | ) |
Get the maximum number of pairs possible.
multimap | A multimap. |
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.
compare | Function used to compare keys. | |
key_destroy | Destructor for the keys. | |
value_destroy | Destructor for the value field. |
The multimap's key comparison function is set to compare. It must return TRUE
or FALSE
if the comparison of the first argument passed to it with the second argument is found to be true or false respectively.
The destructors for a multimap node's key and value field are set to key_destroy and value_destroy. Whenever a multimap node is destroyed these functions are used to deallocate the memory used by the key and the value. Each of the destructors might be NULL
, i.e. keys and values are not deallocated during destroy operations.
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.
multimap | A multimap. | |
position | Current iterator position. |
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.
multimap | A multimap. | |
position | Current iterator position. |
cxsize cx_multimap_size | ( | const cx_multimap * | multimap | ) |
Get the actual number of pairs in the multimap.
multimap | A multimap. |
void cx_multimap_swap | ( | cx_multimap * | multimap1, | |
cx_multimap * | multimap2 | |||
) |
Swap the contents of two multimaps.
multimap1 | First multimap. | |
multimap2 | Second multimap. |
cx_multimap_iterator cx_multimap_upper_bound | ( | const cx_multimap * | multimap, | |
cxcptr | key | |||
) |
Find the end of a subsequence matching a given key.
multimap | A multimap. | |
key | Key of the (key, value) pair(s) to locate. |