|
void | addKey (const KeyType &key) |
| Adds a single element for the key to the data storage.
|
|
void | addKey (const KeyType &key, const Scalar &value) |
| Adds a single element for the key to the data storage.
|
|
void | addKeys (std::span< const KeyType > keys) |
| Adds a continuous vector for the keys to the data storage.
|
|
void | addKeys (std::span< const KeyType > keys, std::span< const Scalar > values) |
| Adds a continuous vector for the keys to the data storage.
|
|
void | addKeys (std::span< const std::pair< KeyType, Scalar > > keyValues) |
| Adds a continuous vector for the keys to the data storage.
|
|
Scalar & | at (const KeyType &key) |
| Returns a reference to the mapped value of the element with specified key. If no such element exists, an exception of type std::out_of_range is thrown.
|
|
const Scalar & | at (const KeyType &key) const |
| Returns a reference to the mapped value of the element with specified key. If no such element exists, an exception of type std::out_of_range is thrown.
|
|
std::vector< Scalar > & | at (std::span< const KeyType > keys) |
| Returns a reference to the mapped value of the element with specified keys. If no such element exists, an exception of type std::out_of_range is thrown.
|
|
const std::vector< Scalar > & | at (std::span< const KeyType > keys) const |
| Returns a reference to the mapped value of the element with specified keys. If no such element exists, an exception of type std::out_of_range is thrown.
|
|
decltype(auto) | begin () |
| Returns an iterator to the first element.
|
|
decltype(auto) | begin () const noexcept |
| Returns an iterator to the first element.
|
|
decltype(auto) | cbegin () const noexcept |
| Returns an iterator to the first element.
|
|
decltype(auto) | cend () const noexcept |
| Returns an iterator to the element following the last element of.
|
|
void | clear () |
| Erases all elements from the container. After this call, size() returns zero.
|
|
bool | contains (const KeyType &key) const |
| Checks if there is an element with key equivalent to key in the container.
|
|
bool | contains (std::span< const KeyType > keys) const |
| Checks if there are elements with keys equivalent to keys in the container.
|
|
bool | empty () const |
| Checks if the container has no elements.
|
|
decltype(auto) | end () |
| Returns an iterator to the element following the last element of.
|
|
decltype(auto) | end () const noexcept |
| Returns an iterator to the element following the last element of.
|
|
std::vector< KeyType > | keys () const |
| Collect all keys.
|
|
size_t | size () const |
| Returns the number of elements in the container.
|
|
size_t | size_of (const KeyType &key) const |
| Returns the size of parameters represented by the key.
|
|
template<typename KeyType, typename Scalar, bool unordered = true>
class NAV::KeyedMap< KeyType, Scalar, unordered >
Similar to KeyedMatrix, but memory is allocated in a map and therefore never reallocated.
- Template Parameters
-
KeyType | Type to use as keys |
Scalar | Type to store in the map |
unordered | Wether an unordered_map or a std::map should be used |
Definition at line 34 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
Scalar & NAV::KeyedMap< KeyType, Scalar, unordered >::at |
( |
const KeyType & | key | ) |
|
|
inline |
Returns a reference to the mapped value of the element with specified key. If no such element exists, an exception of type std::out_of_range is thrown.
- Parameters
-
[in] | key | the key of the element to find |
- Returns
- A reference to the mapped value of the requested element.
Definition at line 163 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
const Scalar & NAV::KeyedMap< KeyType, Scalar, unordered >::at |
( |
const KeyType & | key | ) |
const |
|
inlinenodiscard |
Returns a reference to the mapped value of the element with specified key. If no such element exists, an exception of type std::out_of_range is thrown.
- Parameters
-
[in] | key | the key of the element to find |
- Returns
- A reference to the mapped value of the requested element.
Definition at line 172 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
std::vector< Scalar > & NAV::KeyedMap< KeyType, Scalar, unordered >::at |
( |
std::span< const KeyType > | keys | ) |
|
|
inline |
Returns a reference to the mapped value of the element with specified keys. If no such element exists, an exception of type std::out_of_range is thrown.
- Parameters
-
[in] | keys | the keys of the element to find |
- Returns
- A reference to the mapped value of the requested element.
Definition at line 181 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
const std::vector< Scalar > & NAV::KeyedMap< KeyType, Scalar, unordered >::at |
( |
std::span< const KeyType > | keys | ) |
const |
|
inlinenodiscard |
Returns a reference to the mapped value of the element with specified keys. If no such element exists, an exception of type std::out_of_range is thrown.
- Parameters
-
[in] | keys | the key of the element to find |
- Returns
- A reference to the mapped value of the requested element.
Definition at line 193 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
decltype(auto) NAV::KeyedMap< KeyType, Scalar, unordered >::begin |
( |
| ) |
|
|
inline |
Returns an iterator to the first element.
If the buffer is empty, the returned iterator will be equal to end().
Definition at line 48 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
decltype(auto) NAV::KeyedMap< KeyType, Scalar, unordered >::begin |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Returns an iterator to the first element.
If the buffer is empty, the returned iterator will be equal to end().
Definition at line 52 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
decltype(auto) NAV::KeyedMap< KeyType, Scalar, unordered >::cbegin |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Returns an iterator to the first element.
If the buffer is empty, the returned iterator will be equal to end().
Definition at line 56 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
decltype(auto) NAV::KeyedMap< KeyType, Scalar, unordered >::cend |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Returns an iterator to the element following the last element of.
This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 69 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
decltype(auto) NAV::KeyedMap< KeyType, Scalar, unordered >::end |
( |
| ) |
|
|
inline |
Returns an iterator to the element following the last element of.
This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 61 of file KeyedMap.hpp.
template<typename KeyType, typename Scalar, bool unordered = true>
decltype(auto) NAV::KeyedMap< KeyType, Scalar, unordered >::end |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Returns an iterator to the element following the last element of.
This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 65 of file KeyedMap.hpp.