A wrapper around std::map that uses a constant-size array (or only a single value) plus linear search until the map grows too big. More...
#include <ogdf/cluster/sync_plan/basic/RegisteredMultiArray.h>
Public Types | |
| using | ValueArrayType = std::array< ValuePairType, array_max > |
| using | ValueMapType = std::unordered_map< Key2, Value > |
| using | ValuePairType = std::pair< Key2, Value > |
Public Member Functions | |
| UsuallySmallMap ()=default | |
| UsuallySmallMap (const UsuallySmallMap ©) | |
| UsuallySmallMap (UsuallySmallMap &&move) noexcept | |
| ~UsuallySmallMap () | |
| bool | contains (const Key2 &key) const |
| bool | empty () const |
| Value & | get_or_create (const Key2 &key, const Value &def=Value()) |
| Value & | get_or_raise (const Key2 &key) const |
| ValueArrayType & | getValueArray () const |
| ValueMapType & | getValueMap () const |
| ValuePairType & | getValueScalar () const |
| UsuallySmallMap & | operator= (UsuallySmallMap copy_by_value) noexcept |
Assign this UsuallySmallMap to be a copy of copy_by_value. | |
| size_t | size () const |
| void | unset (const Key2 &key) |
| bool | usesMap () const |
Public Attributes | |
| uint8_t | m_size = 0 |
| void * | m_value = nullptr |
Friends | |
| void | swap (UsuallySmallMap &first, UsuallySmallMap &second) noexcept |
A wrapper around std::map that uses a constant-size array (or only a single value) plus linear search until the map grows too big.
Automatically grows from storing a single value, over using an std::array of at most array_max values, to using an unbounded std::map. This is used for managing the second dimension of RegisteredMultiArray for a single value in the first dimension.
Definition at line 52 of file RegisteredMultiArray.h.
| using ogdf::UsuallySmallMap< Key2, Value, array_max >::ValueArrayType = std::array<ValuePairType, array_max> |
Definition at line 54 of file RegisteredMultiArray.h.
| using ogdf::UsuallySmallMap< Key2, Value, array_max >::ValueMapType = std::unordered_map<Key2, Value> |
Definition at line 55 of file RegisteredMultiArray.h.
| using ogdf::UsuallySmallMap< Key2, Value, array_max >::ValuePairType = std::pair<Key2, Value> |
Definition at line 53 of file RegisteredMultiArray.h.
|
default |
|
inline |
Definition at line 63 of file RegisteredMultiArray.h.
|
inline |
Definition at line 75 of file RegisteredMultiArray.h.
|
inlinenoexcept |
Definition at line 87 of file RegisteredMultiArray.h.
|
inline |
Definition at line 208 of file RegisteredMultiArray.h.
|
inline |
Definition at line 226 of file RegisteredMultiArray.h.
|
inline |
Definition at line 122 of file RegisteredMultiArray.h.
|
inline |
Definition at line 180 of file RegisteredMultiArray.h.
|
inline |
Definition at line 246 of file RegisteredMultiArray.h.
|
inline |
Definition at line 252 of file RegisteredMultiArray.h.
|
inline |
Definition at line 240 of file RegisteredMultiArray.h.
|
inlinenoexcept |
Assign this UsuallySmallMap to be a copy of copy_by_value.
Internally, this will use the copy constructor to create a temporary copy of the argument copy_by_value (as it is passed by value) and then swap this object instance with the temporary copy. If the assigned-from object can be moved, the move constructor will be automatically used instead of copying. Note that this method thereby covers both copy-assignment and move-assignment. See https://stackoverflow.com/a/3279550 for more details on this idiom. This method is noexcept as a potentially-throwing copy constructor call is made within the context of the caller (see https://stackoverflow.com/a/7628345) and swap is expected to be noexcept.
Definition at line 87 of file RegisteredMultiArray.h.
|
inline |
Definition at line 228 of file RegisteredMultiArray.h.
|
inline |
Definition at line 95 of file RegisteredMultiArray.h.
|
inline |
Definition at line 238 of file RegisteredMultiArray.h.
|
friend |
Definition at line 89 of file RegisteredMultiArray.h.
| uint8_t ogdf::UsuallySmallMap< Key2, Value, array_max >::m_size = 0 |
Definition at line 57 of file RegisteredMultiArray.h.
| void* ogdf::UsuallySmallMap< Key2, Value, array_max >::m_value = nullptr |
Definition at line 58 of file RegisteredMultiArray.h.