LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
25 #ifndef LSST_AFW_TYPEHANDLING_SIMPLEGENERICMAP_H
26 #define LSST_AFW_TYPEHANDLING_SIMPLEGENERICMAP_H
30 #include <unordered_map>
33 #include "boost/variant.hpp"
39 namespace typehandling {
71 _storage =
other._storage;
74 swap(_keyView, newKeys);
82 _storage = _convertStorage(
other);
84 swap(_keyView, newKeys);
90 bool empty() const noexcept
override {
return _storage.
empty(); }
108 return _storage.
at(
key);
111 message <<
"Key not found: " <<
key;
124 swap(_keyView, newKeys);
131 for (
auto it = newKeys.
cbegin(); it != newKeys.
cend();) {
133 it = newKeys.
erase(it);
139 bool erased = _storage.
erase(
key) > 0;
142 swap(_keyView, newKeys);
165 map.
apply([&newStorage](K
const&
key,
auto const& value) { newStorage.
emplace(
key, value); });
virtual ~SimpleGenericMap() noexcept=default
SimpleGenericMap()=default
decltype(_typeToConstRef(std::declval< StorableType >())) ConstValueReference
A type-agnostic reference to the value stored inside the map.
bool unsafeInsert(K key, StorableType &&value) override
Create a new mapping with key equal to key and value equal to value.
SimpleGenericMap(SimpleGenericMap &&) noexcept=default
std::vector< K > const & keys() const noexcept override
Return the set of all keys, without type information.
SimpleGenericMap(SimpleGenericMap const &other)=default
bool unsafeErase(K key) override
Remove the mapping for a key from this map, if it exists.
SimpleGenericMap & operator=(SimpleGenericMap &&) noexcept=default
GenericMap< K >::size_type max_size() const noexcept override
Return the maximum number of elements the container is able to hold due to system or library implemen...
Interface for a heterogeneous map.
T throw_with_nested(T... args)
ItemVariant const * other
boost::variant< bool, int, long, long long, float, double, std::string, PolymorphicValue, std::shared_ptr< Storable const > > StorableType
The types that can be stored in a map.
void swap(PolymorphicValue &lhs, PolymorphicValue &rhs) noexcept
Swap specialization for PolymorphicValue.
void clear() noexcept override
Remove all of the mappings from this map.
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
T emplace_back(T... args)
GenericMap< K >::size_type size() const noexcept override
Return the number of key-value pairs in the map.
A GenericMap that allows insertion and deletion of arbitrary values.
Interface for a GenericMap that allows element addition and removal.
Reports attempts to access elements outside a valid range of indices.
auto apply(Visitor &&visitor) const
Apply an operation to each key-value pair in the map.
bool contains(K const &key) const override
Return true if this map contains a mapping whose key has the specified label.
bool empty() const noexcept override
Return true if this map contains no key-value pairs.
ConstValueReference unsafeLookup(K key) const override
Return a reference to the mapped value of the element with key equal to key.