Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
multimap< TKey, TValue, MAX_SIZE_, TCompare > Class Template Reference
A templated multimap implementation that uses a fixed size buffer. More...
#include <multimap.h>
Inherits imultimap< TKey, TValue, TCompare >.
Public Types | |
typedef size_t | size_type |
The type used for determining the size of map. | |
Public Member Functions | |
multimap () | |
Default constructor. | |
multimap (const multimap &other) | |
Copy constructor. | |
template<typename TIterator > | |
multimap (TIterator first, TIterator last) | |
Constructor, from an iterator range. | |
~multimap () | |
Destructor. | |
multimap & | operator= (const multimap &rhs) |
Assignment operator. | |
iterator | begin () |
Gets the beginning of the multimap. | |
const_iterator | begin () const |
Gets the beginning of the multimap. | |
iterator | end () |
Gets the end of the multimap. | |
const_iterator | end () const |
Gets the end of the multimap. | |
const_iterator | cbegin () const |
Gets the beginning of the multimap. | |
const_iterator | cend () const |
Gets the end of the multimap. | |
reverse_iterator | rbegin () |
Gets the reverse beginning of the list. | |
const_reverse_iterator | rbegin () const |
Gets the reverse beginning of the list. | |
reverse_iterator | rend () |
Gets the reverse end of the list. | |
const_reverse_iterator | rend () const |
Gets the reverse end of the list. | |
const_reverse_iterator | crbegin () const |
Gets the reverse beginning of the list. | |
const_reverse_iterator | crend () const |
Gets the reverse end of the list. | |
void | assign (TIterator first, TIterator last) |
Assigns values to the multimap. | |
void | clear () |
Clears the multimap. | |
size_type | count (key_parameter_t key) const |
Counts the number of elements that contain the key specified. | |
std::pair< iterator, iterator > | equal_range (key_parameter_t key) |
Returns two iterators with bounding (lower bound, upper bound) the key provided. | |
std::pair< const_iterator, const_iterator > | equal_range (key_parameter_t key) const |
Returns two const iterators with bounding (lower bound, upper bound) the key provided. | |
void | erase (iterator position) |
Erases the value at the specified position. | |
iterator | erase (const_iterator position) |
Erases the value at the specified position. | |
iterator | erase (iterator first, iterator last) |
Erases a range of elements. | |
iterator | erase (const_iterator first, const_iterator last) |
Erases a range of elements. | |
iterator | find (key_parameter_t key) |
Finds an element. | |
const_iterator | find (key_parameter_t key) const |
Finds an element. | |
iterator | insert (const value_type &value) |
Inserts a value to the multimap. | |
iterator | insert (iterator, const value_type &value) |
Inserts a value to the multimap starting at the position recommended. | |
iterator | insert (const_iterator, const value_type &value) |
Inserts a value to the multimap starting at the position recommended. | |
void | insert (TIterator first, TIterator last) |
Inserts a range of values to the multimap. | |
iterator | lower_bound (key_parameter_t key) |
Returns an iterator pointing to the first element in the container whose key is not considered to go before the key provided or end() if all keys are considered to go before the key provided. | |
const_iterator | lower_bound (key_parameter_t key) const |
Returns a const_iterator pointing to the first element in the container whose key is not considered to go before the key provided or end() if all keys are considered to go before the key provided. | |
iterator | upper_bound (key_parameter_t key) |
Returns an iterator pointing to the first element in the container whose key is not considered to go after the key provided or end() if all keys are considered to go after the key provided. | |
const_iterator | upper_bound (key_parameter_t key) const |
Returns a const_iterator pointing to the first element in the container whose key is not considered to go after the key provided or end() if all keys are considered to go after the key provided. | |
size_type | size () const |
Gets the size of the map. | |
size_type | max_size () const |
Gets the maximum possible size of the map. | |
bool | empty () const |
Checks to see if the map is empty. | |
bool | full () const |
Checks to see if the map is full. | |
size_type | capacity () const |
Returns the capacity of the vector. | |
size_t | available () const |
Returns the remaining capacity. | |
Protected Types | |
typedef etl::parameter_type < TKey >::type | key_parameter_t |
Defines the key value parameter type. | |
Protected Member Functions | |
bool | node_comp (const Data_Node &node1, const Data_Node &node2) const |
How to compare node elements. | |
void | initialise () |
Initialise the multimap. | |
void | balance_node (Node *&critical_node) |
Balance the critical node at the position provided as needed. | |
void | rotate_2node (Node *&position, uint_least8_t dir) |
Rotate two nodes at the position provided the to balance the tree. | |
void | rotate_3node (Node *&position, uint_least8_t dir, uint_least8_t third) |
Rotate three nodes at the position provided the to balance the tree. | |
void | next_node (Node *&position) const |
Find the next node in sequence from the node provided. | |
void | next_node (const Node *&position) const |
Find the next node in sequence from the node provided. | |
void | prev_node (Node *&position) const |
Find the previous node in sequence from the node provided. | |
void | prev_node (const Node *&position) const |
Find the previous node in sequence from the node provided. | |
Node * | find_limit_node (Node *position, const int8_t dir) const |
Find the node whose key would go before all the other keys from the position provided. | |
void | attach_node (Node *parent, Node *&position, Node &node) |
Attach the provided node to the position provided. | |
void | detach_node (Node *&position, Node *&replacement) |
Detach the node at the position provided. | |
Protected Attributes | |
size_type | current_size |
The number of the used nodes. | |
const size_type | CAPACITY |
The maximum size of the map. | |
Node * | root_node |
The node that acts as the multimap root. |
Detailed Description
template<typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = std::less<TKey>>
class etl::multimap< TKey, TValue, MAX_SIZE_, TCompare >
A templated multimap implementation that uses a fixed size buffer.
Definition at line 1891 of file multimap.h.
Member Typedef Documentation
typedef etl::parameter_type<TKey>::type key_parameter_t [protected, inherited] |
Defines the key value parameter type.
Definition at line 662 of file multimap.h.
typedef size_t size_type [inherited] |
The type used for determining the size of map.
Reimplemented from multimap_base.
Definition at line 622 of file multimap.h.
Constructor & Destructor Documentation
multimap | ( | ) |
Default constructor.
Definition at line 1900 of file multimap.h.
Copy constructor.
Definition at line 1909 of file multimap.h.
multimap | ( | TIterator | first, |
TIterator | last | ||
) |
Constructor, from an iterator range.
- Template Parameters:
-
TIterator The iterator type.
- Parameters:
-
first The iterator to the first element. last The iterator to the last element + 1.
Definition at line 1922 of file multimap.h.
~multimap | ( | ) |
Destructor.
Definition at line 1931 of file multimap.h.
Member Function Documentation
void assign | ( | TIterator | first, |
TIterator | last | ||
) | [inherited] |
Assigns values to the multimap.
If asserts or exceptions are enabled, emits map_full if the multimap does not have enough free space. If asserts or exceptions are enabled, emits map_iterator if the iterators are reversed.
- Parameters:
-
first The iterator to the first element. last The iterator to the last element + 1.
Definition at line 1060 of file multimap.h.
Attach the provided node to the position provided.
Definition at line 551 of file multimap.h.
size_t available | ( | ) | const [inherited] |
Returns the remaining capacity.
- Returns:
- The remaining capacity.
Definition at line 174 of file multimap.h.
void balance_node | ( | Node *& | critical_node ) | [protected, inherited] |
Balance the critical node at the position provided as needed.
Definition at line 234 of file multimap.h.
iterator begin | ( | ) | [inherited] |
Gets the beginning of the multimap.
Definition at line 959 of file multimap.h.
const_iterator begin | ( | ) | const [inherited] |
Gets the beginning of the multimap.
Definition at line 967 of file multimap.h.
size_type capacity | ( | ) | const [inherited] |
Returns the capacity of the vector.
- Returns:
- The capacity of the vector.
Definition at line 165 of file multimap.h.
const_iterator cbegin | ( | ) | const [inherited] |
Gets the beginning of the multimap.
Definition at line 991 of file multimap.h.
const_iterator cend | ( | ) | const [inherited] |
Gets the end of the multimap.
Definition at line 999 of file multimap.h.
void clear | ( | ) | [inherited] |
Clears the multimap.
Definition at line 1069 of file multimap.h.
size_type count | ( | key_parameter_t | key ) | const [inherited] |
Counts the number of elements that contain the key specified.
- Parameters:
-
key The key to search for.
- Returns:
- 1 if element was found, 0 otherwise.
Definition at line 1079 of file multimap.h.
const_reverse_iterator crbegin | ( | ) | const [inherited] |
Gets the reverse beginning of the list.
Definition at line 1039 of file multimap.h.
const_reverse_iterator crend | ( | ) | const [inherited] |
Gets the reverse end of the list.
Definition at line 1047 of file multimap.h.
Detach the node at the position provided.
Definition at line 569 of file multimap.h.
bool empty | ( | ) | const [inherited] |
Checks to see if the map is empty.
Definition at line 148 of file multimap.h.
const_iterator end | ( | ) | const [inherited] |
Gets the end of the multimap.
Definition at line 983 of file multimap.h.
iterator end | ( | ) | [inherited] |
Gets the end of the multimap.
Definition at line 975 of file multimap.h.
std::pair<iterator, iterator> equal_range | ( | key_parameter_t | key ) | [inherited] |
Returns two iterators with bounding (lower bound, upper bound) the key provided.
Definition at line 1088 of file multimap.h.
std::pair<const_iterator, const_iterator> equal_range | ( | key_parameter_t | key ) | const [inherited] |
Returns two const iterators with bounding (lower bound, upper bound) the key provided.
Definition at line 1099 of file multimap.h.
void erase | ( | iterator | position ) | [inherited] |
Erases the value at the specified position.
Definition at line 1109 of file multimap.h.
iterator erase | ( | const_iterator | position ) | [inherited] |
Erases the value at the specified position.
Definition at line 1118 of file multimap.h.
iterator erase | ( | iterator | first, |
iterator | last | ||
) | [inherited] |
Erases a range of elements.
Definition at line 1157 of file multimap.h.
iterator erase | ( | const_iterator | first, |
const_iterator | last | ||
) | [inherited] |
Erases a range of elements.
Definition at line 1171 of file multimap.h.
iterator find | ( | key_parameter_t | key ) | [inherited] |
Finds an element.
- Parameters:
-
key The key to search for.
- Returns:
- An iterator pointing to the element or end() if not found.
Definition at line 1187 of file multimap.h.
const_iterator find | ( | key_parameter_t | key ) | const [inherited] |
Finds an element.
- Parameters:
-
key The key to search for.
- Returns:
- An iterator pointing to the element or end() if not found.
Definition at line 1197 of file multimap.h.
Find the node whose key would go before all the other keys from the position provided.
Definition at line 535 of file multimap.h.
bool full | ( | ) | const [inherited] |
Checks to see if the map is full.
Definition at line 156 of file multimap.h.
void initialise | ( | ) | [protected, inherited] |
Initialise the multimap.
Definition at line 1336 of file multimap.h.
void insert | ( | TIterator | first, |
TIterator | last | ||
) | [inherited] |
Inserts a range of values to the multimap.
If asserts or exceptions are enabled, emits map_full if the multimap does not have enough free space.
- Parameters:
-
position The position to insert at. first The first element to add. last The last + 1 element to add.
Definition at line 1256 of file multimap.h.
iterator insert | ( | const_iterator | , |
const value_type & | value | ||
) | [inherited] |
Inserts a value to the multimap starting at the position recommended.
If asserts or exceptions are enabled, emits map_full if the multimap is already full.
- Parameters:
-
position The position that would precede the value to insert. value The value to insert.
Definition at line 1242 of file multimap.h.
iterator insert | ( | const value_type & | value ) | [inherited] |
Inserts a value to the multimap.
If asserts or exceptions are enabled, emits map_full if the multimap is already full.
- Parameters:
-
value The value to insert.
Definition at line 1207 of file multimap.h.
iterator insert | ( | iterator | , |
const value_type & | value | ||
) | [inherited] |
Inserts a value to the multimap starting at the position recommended.
If asserts or exceptions are enabled, emits map_full if the multimap is already full.
- Parameters:
-
position The position that would precede the value to insert. value The value to insert.
Definition at line 1230 of file multimap.h.
iterator lower_bound | ( | key_parameter_t | key ) | [inherited] |
Returns an iterator pointing to the first element in the container whose key is not considered to go before the key provided or end() if all keys are considered to go before the key provided.
- Returns:
- An iterator pointing to the element not before key or end()
Definition at line 1270 of file multimap.h.
const_iterator lower_bound | ( | key_parameter_t | key ) | const [inherited] |
Returns a const_iterator pointing to the first element in the container whose key is not considered to go before the key provided or end() if all keys are considered to go before the key provided.
- Returns:
- An const_iterator pointing to the element not before key or end()
Definition at line 1281 of file multimap.h.
size_type max_size | ( | ) | const [inherited] |
Gets the maximum possible size of the map.
Definition at line 140 of file multimap.h.
void next_node | ( | const Node *& | position ) | const [protected, inherited] |
Find the next node in sequence from the node provided.
Definition at line 426 of file multimap.h.
void next_node | ( | Node *& | position ) | const [protected, inherited] |
Find the next node in sequence from the node provided.
Definition at line 394 of file multimap.h.
bool node_comp | ( | const Data_Node & | node1, |
const Data_Node & | node2 | ||
) | const [protected, inherited] |
How to compare node elements.
Definition at line 667 of file multimap.h.
Assignment operator.
Definition at line 1939 of file multimap.h.
void prev_node | ( | const Node *& | position ) | const [protected, inherited] |
Find the previous node in sequence from the node provided.
Definition at line 496 of file multimap.h.
void prev_node | ( | Node *& | position ) | const [protected, inherited] |
Find the previous node in sequence from the node provided.
Definition at line 458 of file multimap.h.
const_reverse_iterator rbegin | ( | ) | const [inherited] |
Gets the reverse beginning of the list.
Definition at line 1015 of file multimap.h.
reverse_iterator rbegin | ( | ) | [inherited] |
Gets the reverse beginning of the list.
Definition at line 1007 of file multimap.h.
reverse_iterator rend | ( | ) | [inherited] |
Gets the reverse end of the list.
Definition at line 1023 of file multimap.h.
const_reverse_iterator rend | ( | ) | const [inherited] |
Gets the reverse end of the list.
Definition at line 1031 of file multimap.h.
void rotate_2node | ( | Node *& | position, |
uint_least8_t | dir | ||
) | [protected, inherited] |
Rotate two nodes at the position provided the to balance the tree.
Definition at line 297 of file multimap.h.
void rotate_3node | ( | Node *& | position, |
uint_least8_t | dir, | ||
uint_least8_t | third | ||
) | [protected, inherited] |
Rotate three nodes at the position provided the to balance the tree.
Definition at line 338 of file multimap.h.
size_type size | ( | ) | const [inherited] |
Gets the size of the map.
Definition at line 132 of file multimap.h.
iterator upper_bound | ( | key_parameter_t | key ) | [inherited] |
Returns an iterator pointing to the first element in the container whose key is not considered to go after the key provided or end() if all keys are considered to go after the key provided.
- Returns:
- An iterator pointing to the element after key or end()
Definition at line 1292 of file multimap.h.
const_iterator upper_bound | ( | key_parameter_t | key ) | const [inherited] |
Returns a const_iterator pointing to the first element in the container whose key is not considered to go after the key provided or end() if all keys are considered to go after the key provided.
- Returns:
- An const_iterator pointing to the element after key or end()
Definition at line 1303 of file multimap.h.
Field Documentation
The maximum size of the map.
Definition at line 600 of file multimap.h.
size_type current_size [protected, inherited] |
The number of the used nodes.
Definition at line 599 of file multimap.h.
The node that acts as the multimap root.
Definition at line 601 of file multimap.h.
Generated on Tue Jul 12 2022 14:05:52 by
