OrderedMap
template <class KeyType, class MappedType> class OrderedMap
@brief a associative key-value container maintaining insertion order
The OrderedMap provides for an insertion-order aware key-value container which has similar access, modification and query methods as std::map. The differences are that knowledge of insertion order is maintained, values may be of different and any type and iterator for both key and insertion order are provided.
Operators
| Name | Description |
|---|---|
| operator= | Assignment operator. |
| operator= | Move assignment. |
Functions
| Name | Description |
|---|---|
| begin | Return an iterator to the first element of the OrderedMap Return : |
| end | Return an iterator past the last element of the OrderedMap Return : |
| OrderedMap | Construct an empty OrderedMap |
| OrderedMap | OrderedMap copy constructr other : |
| OrderedMap | Construct an ordered map with one element in it identified by key key1 : value1 : |
| OrderedMap | Construct an ordered map with two elements in it identified by keys key1 : value1 : key2 : value2 : |
| OrderedMap | Construct an ordered map with three elements in it identified by keys key1 : value1 : key2 : value2 : key3 : value3 : |
| OrderedMap | Construct an ordered map with four elements in it identified by keys key1 : value1 : key2 : value2 : key3 : value3 : key4 : value4 : |
| OrderedMap | Construct an ordered map with five elements in it identified by keys key1 : value1 : key2 : value2 : key3 : value3 : key4 : value4 : key5 : value5 : |
| OrderedMap | Construct an ordered map with six elements in it identified by keys key1 : value1 : key2 : value2 : key3 : value3 : key4 : value4 : key5 : value5 : key6 : value6 : |
| OrderedMap | Move constructor. |
| lbegin | Return an iterator iterating from the first element over elements in insertion order Return : |
| lend | Return an iterator past the last element in insertion order Return : |
| mbegin | Return an iterator iterating from the first element over elements in key sorting order Return : |
| mend | Return an iterator past the last element in key sorting order Return : |
| find | Return a key-sorted iterator to the element identified by key. |
| has | Query if the element identified by key exists in the OrderedMap key : Return : |
| erase | Erase element identified by key if key exists. |
| erase | Erase element identified by map_iterator. |
| size | Return the number or elements in this map Return : |
| empty | Query if this map is empty Return : |
| clear | Empty or clear the map |
| set | Set the element identified by key to value key : value : Return : |
| get | Return the element identified by key. |
| get | Fill the reference value with the element identified by key. |
| get | Return the element for the key-associative iterator to the OrderedMap Raises an exception if T is not of the type of the inserted element key : Return : |
| getAs | Return the element identified by key. |
| getNode | Get the Element identified by key as a Node key : Return : |
| getAny | Get the Element identified by key as a std::any value key : Return : |
| is | Check if the element at key is of type T key : Return : |
| is | Check if the element the iterator refers to is of type T key : Return : |
| is | Check if the element at key is of the given Karabo reference type key : Return : |
Operator Details
operator=
OrderedMap<KeyType, MappedType>& operator=(const OrderedMap<KeyType, MappedType>& other)
Assignment operator. Clears this map and then assigns the entries of other to it
other
:
Return :
OrderedMap<KeyType, MappedType>& operator=( OrderedMap<KeyType, MappedType>&& other) noexcept
Move assignment. Moves the entries of other to this map, other is then empty
other
:
Return :
Function Details
OrderedMap
OrderedMap()
Construct an empty OrderedMap
OrderedMap(const OrderedMap<KeyType, MappedType>& other)
OrderedMap copy constructr
other
:
template <typename T> OrderedMap(const KeyType& key1, const T& value1)
Construct an ordered map with one element in it identified by key
key1
:
value1
:
template <typename T, typename U> OrderedMap(const KeyType& key1, const T& value1, const KeyType& key2, const U& value2)
Construct an ordered map with two elements in it identified by keys
key1
:
value1
:
key2
:
value2
:
template <typename T, typename U, typename V> OrderedMap(const KeyType& key1, const T& value1, const KeyType& key2, const U& value2, const KeyType& key3, const V& value3)
Construct an ordered map with three elements in it identified by keys
key1
:
value1
:
key2
:
value2
:
key3
:
value3
:
template <typename T, typename U, typename V, typename X> OrderedMap(const KeyType& key1, const T& value1, const KeyType& key2, const U& value2, const KeyType& key3, const V& value3, const KeyType& key4, const X& value4)
Construct an ordered map with four elements in it identified by keys
key1
:
value1
:
key2
:
value2
:
key3
:
value3
:
key4
:
value4
:
template <typename T, typename U, typename V, typename X, typename Y> OrderedMap(const KeyType& key1, const T& value1, const KeyType& key2, const U& value2, const KeyType& key3, const V& value3, const KeyType& key4, const X& value4, const KeyType& key5, const Y& value5)
Construct an ordered map with five elements in it identified by keys
key1
:
value1
:
key2
:
value2
:
key3
:
value3
:
key4
:
value4
:
key5
:
value5
:
template <typename T, typename U, typename V, typename X, typename Y, typename Z> OrderedMap(const KeyType& key1, const T& value1, const KeyType& key2, const U& value2, const KeyType& key3, const V& value3, const KeyType& key4, const X& value4, const KeyType& key5, const Y& value5, const KeyType& key6, const Z& value6)
Construct an ordered map with six elements in it identified by keys
key1
:
value1
:
key2
:
value2
:
key3
:
value3
:
key4
:
value4
:
key5
:
value5
:
key6
:
value6
:
OrderedMap( OrderedMap<KeyType, MappedType>&& other) noexcept
Move constructor. Moves the entries of other to this map, other is then empty
other
:
Return :
begin
iterator begin()
Return an iterator to the first element of the OrderedMap
Return :
clear
inline void clear()
Empty or clear the map
empty
inline bool empty() const
Query if this map is empty
Return :
end
iterator end()
Return an iterator past the last element of the OrderedMap
Return :
erase
inline size_t erase(const KeyType& key)
Erase element identified by key if key exists.
key
:
Return : number of elements erased, i.e. 0 or 1.
inline map_iterator erase(const map_iterator& it)
Erase element identified by map_iterator.
it
: - a valid map_iterator
Return : a map_iterator pointing to the element after 'it' (or mend() if 'it' was the last element)
find
inline map_iterator find(const KeyType& key)
Return a key-sorted iterator to the element identified by key. Returns OrderedMap::mend if the element is not found
key
:
Return :
get
template <class T> inline const T& get(const KeyType& key) const
Return the element identified by key. Raises an exception if T is not of the type of the inserted element
key
:
Return :
template <class T> inline void get(const KeyType& key, T& value) const
Fill the reference value with the element identified by key. Raises an exception if T is not of the type of the inserted element
key
:
value
:
Return :
template <class T> inline const T& get(const const_map_iterator& it) const
Return the element for the key-associative iterator to the OrderedMap Raises an exception if T is not of the type of the inserted element
key
:
Return :
getAny
inline const std::any& getAny(const KeyType& key) const
Get the Element identified by key as a std::any value
key
:
Return :
getAs
template <typename ValueType> inline ValueType getAs(const KeyType& key) const
Return the element identified by key. Raises an exception if T is not of the type of the inserted element or the value cannot be casted to T
key
:
Return :
getNode
inline const Node& getNode(const KeyType& key) const
Get the Element identified by key as a Node
key
:
Return :
has
inline bool has(const KeyType& key) const
Query if the element identified by key exists in the OrderedMap
key
:
Return :
is
template <typename T> bool is(const KeyType& key) const
Check if the element at key is of type T
key
:
Return :
template <typename T> bool is(const const_map_iterator& it) const
Check if the element the iterator refers to is of type T
key
:
Return :
bool is(const KeyType& key, const Types::ReferenceType& type) const
Check if the element at key is of the given Karabo reference type
key
:
Return :
lbegin
list_iterator lbegin()
Return an iterator iterating from the first element over elements in insertion order
Return :
lend
list_iterator lend()
Return an iterator past the last element in insertion order
Return :
mbegin
map_iterator mbegin()
Return an iterator iterating from the first element over elements in key sorting order
Return :
mend
map_iterator mend()
Return an iterator past the last element in key sorting order
Return :
set
template <class T> inline Node& set(const KeyType& key, const T& value)
Set the element identified by key to value
key
:
value
:
Return :
size
inline size_t size() const
Return the number or elements in this map
Return :