LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
|
A map of Storable supporting strongly-typed access. More...
#include <StorableMap.h>
Public Types | |
using | mapped_type = std::shared_ptr<typehandling::Storable const> |
using | key_type = typehandling::Key<std::string, mapped_type> |
using | value_type = std::pair<key_type const, mapped_type> |
using | size_type = std::size_t |
using | difference_type = std::ptrdiff_t |
using | reference = value_type& |
using | const_reference = value_type const& |
using | pointer = value_type* |
using | const_pointer = value_type const* |
using | const_iterator = _Impl::const_iterator |
using | iterator = _Impl::iterator |
using | reverse_iterator = std::reverse_iterator<iterator> |
using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
template<typename V > | |
using | Key = lsst::afw::typehandling::Key<std::string, V> |
using | Storable = lsst::afw::typehandling::Storable |
Public Member Functions | |
StorableMap () | |
StorableMap (StorableMap const &other) | |
StorableMap (StorableMap &&other) | |
StorableMap & | operator= (StorableMap const &other) |
StorableMap & | operator= (StorableMap &&other) |
~StorableMap () noexcept | |
StorableMap (std::initializer_list< value_type > init) | |
Construct a map from an initializer list. | |
template<typename T > | |
std::shared_ptr< T > | at (Key< std::shared_ptr< T > > const &key) const |
Return a the mapped value of the element with key equal to key . | |
size_type | size () const noexcept |
Return the number of key-value pairs in the map. | |
bool | empty () const noexcept |
Return true if this map contains no key-value pairs. | |
size_type | max_size () const noexcept |
Return the maximum number of elements the container is able to hold due to system or library implementation limitations. | |
bool | contains (std::string const &key) const |
Return true if this map contains a mapping whose key has the specified label. | |
template<typename T > | |
bool | contains (Key< std::shared_ptr< T > > const &key) const |
Return true if this map contains a mapping for the specified key. | |
void | clear () noexcept |
Remove all of the mappings from this map. | |
template<typename T > | |
bool | insert (Key< std::shared_ptr< T > > const &key, std::shared_ptr< 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. | |
template<typename T > | |
std::pair< Key< T >, bool > | insert (std::string const &key, T const &value) |
Insert an element into the map, if the map doesn't already contain a mapping with a conflicting key. | |
template<typename T > | |
bool | erase (Key< T > const &key) noexcept |
Remove the mapping for a key from this map, if it exists. | |
bool | operator== (StorableMap const &other) const noexcept |
Test for map equality. | |
bool | operator!= (StorableMap const &other) const noexcept |
Test for map equality. | |
iterator | begin () noexcept |
Return an iterator to the first element of the map. | |
const_iterator | begin () const noexcept |
Return an iterator to the first element of the map. | |
const_iterator | cbegin () const noexcept |
Return an iterator to the first element of the map. | |
iterator | end () noexcept |
Return an iterator to the element past the end of the map. | |
const_iterator | end () const noexcept |
Return an iterator to the element past the end of the map. | |
const_iterator | cend () const noexcept |
Return an iterator to the element past the end of the map. | |
A map of Storable supporting strongly-typed access.
A Key for the map is parameterized by both the key type K
and a corresponding value type V
. The map is indexed uniquely by a value of type K
; no two entries in the map may have identical values of Key::getId().
All operations are sensitive to the value type of the key: a contains call requesting a SkyWcs labeled "value", for example, will report no such object if instead there is a Psf labeled "value". At present, a StorableMap does not store type information internally, instead relying on RTTI for type checking.
Definition at line 59 of file StorableMap.h.
using lsst::afw::image::detail::StorableMap::const_iterator = _Impl::const_iterator |
Definition at line 77 of file StorableMap.h.
using lsst::afw::image::detail::StorableMap::const_pointer = value_type const* |
Definition at line 69 of file StorableMap.h.
using lsst::afw::image::detail::StorableMap::const_reference = value_type const& |
Definition at line 67 of file StorableMap.h.
using lsst::afw::image::detail::StorableMap::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Definition at line 80 of file StorableMap.h.
Definition at line 65 of file StorableMap.h.
using lsst::afw::image::detail::StorableMap::iterator = _Impl::iterator |
Definition at line 78 of file StorableMap.h.
using lsst::afw::image::detail::StorableMap::Key = lsst::afw::typehandling::Key<std::string, V> |
Definition at line 83 of file StorableMap.h.
Definition at line 62 of file StorableMap.h.
using lsst::afw::image::detail::StorableMap::mapped_type = std::shared_ptr<typehandling::Storable const> |
Definition at line 61 of file StorableMap.h.
Definition at line 68 of file StorableMap.h.
Definition at line 66 of file StorableMap.h.
Definition at line 79 of file StorableMap.h.
Definition at line 64 of file StorableMap.h.
Definition at line 84 of file StorableMap.h.
Definition at line 63 of file StorableMap.h.
|
default |
|
default |
|
default |
|
defaultnoexcept |
lsst::afw::image::detail::StorableMap::StorableMap | ( | std::initializer_list< value_type > | init | ) |
Construct a map from an initializer list.
init | an initializer list of key-value pairs. The keys and values may be of any type that can be converted to std::shared_ptr<typehandling::Storable const> . |
init
contains any keys with the same ID, it is unspecified which will be inserted.Definition at line 42 of file StorableMap.cc.
|
inline |
Return a the mapped value of the element with key equal to key
.
T | the type of the element mapped to key . It may be the exact type of the element, if known, or any type to which its pointers can be implicitly converted (e.g., a superclass). |
key | the key of the element to find |
T
mapped to key
, if one existspex::exceptions::OutOfRangeError | Thrown if the map does not have a T with the specified key. |
Definition at line 122 of file StorableMap.h.
|
noexcept |
Return an iterator to the first element of the map.
const
Key and shared pointer to const
Storable. Definition at line 56 of file StorableMap.cc.
|
noexcept |
Return an iterator to the first element of the map.
const
Key and shared pointer to const
Storable. Definition at line 63 of file StorableMap.cc.
|
inlinenoexcept |
Return an iterator to the first element of the map.
const
Key and shared pointer to const
Storable. Definition at line 330 of file StorableMap.h.
|
inlinenoexcept |
Return an iterator to the element past the end of the map.
const
Key and shared pointer to const
Storable. Definition at line 344 of file StorableMap.h.
|
noexcept |
Remove all of the mappings from this map.
After this call, the map will be empty.
Definition at line 54 of file StorableMap.cc.
|
inline |
Return true
if this map contains a mapping for the specified key.
This is equivalent to testing whether at(key)
would succeed.
T | the type of element being tested for |
key | the key to search for |
true
if this map contains a mapping from the specified key to a T
.Definition at line 201 of file StorableMap.h.
bool lsst::afw::image::detail::StorableMap::contains | ( | std::string const & | key | ) | const |
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.Definition at line 50 of file StorableMap.cc.
|
noexcept |
Return true
if this map contains no key-value pairs.
Definition at line 46 of file StorableMap.cc.
|
noexcept |
Return an iterator to the element past the end of the map.
const
Key and shared pointer to const
Storable. Definition at line 59 of file StorableMap.cc.
|
noexcept |
Return an iterator to the element past the end of the map.
const
Key and shared pointer to const
Storable. Definition at line 64 of file StorableMap.cc.
|
inlinenoexcept |
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 present. Definition at line 311 of file StorableMap.h.
|
inline |
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 | the key to insert |
value | the value to insert |
true
if the insertion took place, false
otherwise.T
to prevent insertion. Callers can safely assume this->contains(key.getId())
as a postcondition, but not this->contains(key)
. Definition at line 263 of file StorableMap.h.
|
inline |
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 (will not compile unless shared pointer to a subclass of Storable ) |
key | the key to insert |
value | the value to insert |
true
if the insertion took place and false
otherwise.Definition at line 293 of file StorableMap.h.
|
noexcept |
Return the maximum number of elements the container is able to hold due to system or library implementation limitations.
Definition at line 48 of file StorableMap.cc.
|
inlinenoexcept |
Test for map equality.
Two StorableMap objects are considered equal if they map the same keys to the same values.
Definition at line 234 of file StorableMap.h.
|
default |
|
default |
|
noexcept |
Test for map equality.
Two StorableMap objects are considered equal if they map the same keys to the same values.
Definition at line 52 of file StorableMap.cc.
|
noexcept |
Return the number of key-value pairs in the map.
Definition at line 44 of file StorableMap.cc.