|
lsst.afw
17.0.1-24-g0055ebd3c+3
|
A GenericMap that allows insertion and deletion of arbitrary values. More...
#include <SimpleGenericMap.h>
Public Types | |
| using | key_type = K |
| using | size_type = std::size_t |
| using | difference_type = std::ptrdiff_t |
Public Member Functions | |
| SimpleGenericMap ()=default | |
| SimpleGenericMap (SimpleGenericMap const &other)=default | |
| SimpleGenericMap (SimpleGenericMap &&)=default | |
| virtual | ~SimpleGenericMap () noexcept=default |
| SimpleGenericMap & | operator= (SimpleGenericMap const &other)=default |
| SimpleGenericMap & | operator= (SimpleGenericMap &&)=default |
| GenericMap< K >::size_type | size () const noexcept override |
| Return the number of key-value pairs in the map. More... | |
| bool | empty () const noexcept override |
Return true if this map contains no key-value pairs. More... | |
| 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 implementation limitations. More... | |
| bool | contains (K const &key) const override |
Return true if this map contains a mapping whose key has the specified label. More... | |
| std::vector< K > | keys () const override |
| Return the set of all keys, without type information. More... | |
| void | clear () noexcept override |
| Remove all of the mappings from this map. More... | |
| template<typename T > | |
| bool | insert (Key< K, T > const &key, T const &value) |
| Insert an element into the map, if the map doesn't already contain a mapping with the same or a conflicting key. More... | |
| template<typename T > | |
| std::pair< Key< K, T >, bool > | insert (K const &key, T const &value) |
| Insert an element into the map, if the map doesn't already contain a mapping with a conflicting key. More... | |
| template<typename T > | |
| bool | erase (Key< K, T > const &key) |
| Remove the mapping for a key from this map, if it exists. More... | |
| template<typename T > | |
| size_type | count (Key< K, T > const &key) const |
| Return the number of elements mapped to the specified key. More... | |
| template<typename T , typename std::enable_if_t<!IS_SMART_PTR< T >, int > = 0> | |
| T & | at (Key< K, T > const &key) |
Return a reference to the mapped value of the element with key equal to key. More... | |
| template<typename T , typename std::enable_if_t< std::is_fundamental< T >::value||std::is_base_of< std::string, T >::value, int > = 0> | |
| T const & | at (Key< K, T > const &key) const |
Return a reference to the mapped value of the element with key equal to key. More... | |
| template<typename T , typename std::enable_if_t< std::is_base_of< Storable, T >::value, int > = 0> | |
| T const & | at (Key< K, T > const &key) const |
Return a reference to the mapped value of the element with key equal to key. More... | |
| template<typename T , typename std::enable_if_t< std::is_base_of< Storable, T >::value, int > = 0> | |
| std::shared_ptr< T > | at (Key< K, std::shared_ptr< T >> const &key) const |
Return a reference to the mapped value of the element with key equal to key. More... | |
| template<typename T , typename std::enable_if_t< std::is_fundamental< T >::value||std::is_base_of< std::string, T >::value, int > = 0> | |
| bool | contains (Key< K, T > const &key) const |
Return true if this map contains a mapping for the specified key. More... | |
| template<typename T , typename std::enable_if_t< std::is_base_of< Storable, T >::value, int > = 0> | |
| bool | contains (Key< K, std::shared_ptr< T >> const &key) const |
Return true if this map contains a mapping for the specified key. More... | |
| virtual bool | operator== (GenericMap const &other) const |
| Test for map equality. More... | |
| bool | operator!= (GenericMap const &other) const |
| Test for map equality. More... | |
Protected Types | |
| using | ValueReference = boost::variant< bool const &, std::int32_t const &, std::int64_t const &, float const &, double const &, std::string const &, PolymorphicValue const &, std::shared_ptr< Storable > const & > |
| A type-agnostic reference to the value stored inside the map. More... | |
| using | StorableType = decltype(_referenceToType(std::declval< ValueReference >())) |
| The types that can be stored in a map. More... | |
Protected Member Functions | |
| ValueReference | unsafeLookup (K key) const override |
Return a reference to the mapped value of the element with key equal to key. More... | |
| bool | unsafeInsert (K key, StorableType &&value) override |
Create a new mapping with key equal to key and value equal to value. More... | |
| bool | unsafeErase (K key) override |
| Remove the mapping for a key from this map, if it exists. More... | |
A GenericMap that allows insertion and deletion of arbitrary values.
In Python, a SimpleGenericMap behaves like a dict.
| K | the key type of the map. Must be hashable. |
Definition at line 52 of file SimpleGenericMap.h.
|
inherited |
Definition at line 233 of file GenericMap.h.
|
inherited |
Definition at line 231 of file GenericMap.h.
|
inherited |
Definition at line 232 of file GenericMap.h.
|
protectedinherited |
The types that can be stored in a map.
These are the pass-by-value equivalents (using std::decay) of ValueReference.
Definition at line 522 of file GenericMap.h.
|
protectedinherited |
A type-agnostic reference to the value stored inside the map.
Keys of any subclass of Storable are implemented using PolymorphicValue to preserve type.
Definition at line 514 of file GenericMap.h.
|
default |
|
default |
|
default |
|
virtualdefaultnoexcept |
|
inlineinherited |
Return a reference to the mapped value of the element with key equal to key.
| T | the type of the element mapped to key |
| key | the key of the element to find |
T mapped to key, if one exists| pex::exceptions::OutOfRangeError | Thrown if the map does not have a T with the specified key |
Definition at line 255 of file GenericMap.h.
|
inlineinherited |
Return a reference to the mapped value of the element with key equal to key.
| T | the type of the element mapped to key |
| key | the key of the element to find |
T mapped to key, if one exists| pex::exceptions::OutOfRangeError | Thrown if the map does not have a T with the specified key |
Definition at line 264 of file GenericMap.h.
|
inlineinherited |
Return a reference to the mapped value of the element with key equal to key.
| T | the type of the element mapped to key |
| key | the key of the element to find |
T mapped to key, if one exists| pex::exceptions::OutOfRangeError | Thrown if the map does not have a T with the specified key |
Definition at line 278 of file GenericMap.h.
|
inlineinherited |
Return a reference to the mapped value of the element with key equal to key.
| T | the type of the element mapped to key |
| key | the key of the element to find |
T mapped to key, if one exists| pex::exceptions::OutOfRangeError | Thrown if the map does not have a T with the specified key |
Definition at line 301 of file GenericMap.h.
|
inlineoverridevirtualnoexcept |
Remove all of the mappings from this map.
After this call, the map will be empty.
Implements lsst::afw::typehandling::MutableGenericMap< K >.
Definition at line 83 of file SimpleGenericMap.h.
|
inlineoverridevirtual |
Return true if this map contains a mapping whose key has the specified label.
More formally, this method returns true if and only if this map contains a mapping with a key k such that k.getId() == key. There can be at most one such mapping.
| key | the weakly-typed key to search for |
true if this map contains a mapping for key, regardless of value type.Implements lsst::afw::typehandling::GenericMap< K >.
Definition at line 72 of file SimpleGenericMap.h.
|
inlineinherited |
Return true if this map contains a mapping for the specified key.
This is equivalent to testing whether at(key) would succeed.
| T | the value corresponding to key |
| key | the key to search for |
true if this map contains a mapping from the specified key to a Ttrue, it calls unsafeLookup, then uses templates and RTTI to determine if the value is of the expected type. The performance of this method depends strongly on the performance of contains(K const&). Definition at line 397 of file GenericMap.h.
|
inlineinherited |
Return true if this map contains a mapping for the specified key.
This is equivalent to testing whether at(key) would succeed.
| T | the value corresponding to key |
| key | the key to search for |
true if this map contains a mapping from the specified key to a Ttrue, it calls unsafeLookup, then uses templates and RTTI to determine if the value is of the expected type. The performance of this method depends strongly on the performance of contains(K const&). Definition at line 432 of file GenericMap.h.
|
inlineinherited |
Return the number of elements mapped to the specified key.
| T | the value corresponding to key |
| key | key value of the elements to count |
T with key key, that is, either 1 or 0.Definition at line 355 of file GenericMap.h.
|
inlineoverridevirtualnoexcept |
Return true if this map contains no key-value pairs.
Implements lsst::afw::typehandling::GenericMap< K >.
Definition at line 68 of file SimpleGenericMap.h.
|
inlineinherited |
Remove the mapping for a key from this map, if it exists.
| T | the type of value the key maps to |
| key | the key to remove |
true if key was removed, false if it was not presentDefinition at line 641 of file GenericMap.h.
|
inlineinherited |
Insert an element into the map, if the map doesn't already contain a mapping with the same or a conflicting key.
| T | the type of value to insert |
| key | key to insert |
| value | value to insert |
true if the insertion took place, false otherwiseT to prevent insertion. Callers can safely assume this->contains(key.getId()) as a postcondition, but not this->contains(key).Definition at line 595 of file GenericMap.h.
|
inlineinherited |
Insert an element into the map, if the map doesn't already contain a mapping with a conflicting key.
| T | the type of value to insert |
| key | key to insert |
| value | value to insert |
true if the insertion took place and false otherwiseDefinition at line 619 of file GenericMap.h.
|
inlineoverridevirtual |
Return the set of all keys, without type information.
Implements lsst::afw::typehandling::GenericMap< K >.
Definition at line 74 of file SimpleGenericMap.h.
|
inlineoverridevirtualnoexcept |
Return the maximum number of elements the container is able to hold due to system or library implementation limitations.
Implements lsst::afw::typehandling::GenericMap< K >.
Definition at line 70 of file SimpleGenericMap.h.
|
inlineinherited |
Test for map equality.
Two GenericMap objects are considered equal if they map the same keys to the same values. The two objects do not need to have the same implementation class. If either class orders its keys, the order is ignored.
Definition at line 493 of file GenericMap.h.
|
default |
|
default |
|
inlinevirtualinherited |
Test for map equality.
Two GenericMap objects are considered equal if they map the same keys to the same values. The two objects do not need to have the same implementation class. If either class orders its keys, the order is ignored.
Definition at line 479 of file GenericMap.h.
|
inlineoverridevirtualnoexcept |
Return the number of key-value pairs in the map.
Implements lsst::afw::typehandling::GenericMap< K >.
Definition at line 66 of file SimpleGenericMap.h.
|
inlineoverrideprotectedvirtual |
Remove the mapping for a key from this map, if it exists.
| key | the key to remove |
true if key was removed, false if it was not presentImplements lsst::afw::typehandling::MutableGenericMap< K >.
Definition at line 100 of file SimpleGenericMap.h.
|
inlineoverrideprotectedvirtual |
Create a new mapping with key equal to key and value equal to value.
This method is the primary way to implement the MutableGenericMap interface.
| key | the key of the element to insert. The method may assume that the map does not contain key. |
| value | a reference to the value to insert. |
true if the insertion took place, false otherwiseImplements lsst::afw::typehandling::MutableGenericMap< K >.
Definition at line 96 of file SimpleGenericMap.h.
|
inlineoverrideprotectedvirtual |
Return a reference to the mapped value of the element with key equal to key.
This method is the primary way to implement the GenericMap interface.
| key | the key of the element to find |
key, if one exists| pex::exceptions::OutOfRangeError | Thrown if the map does not have a value with the specified key |
Implements lsst::afw::typehandling::GenericMap< K >.
Definition at line 86 of file SimpleGenericMap.h.
1.8.13