Rosetta
2020.11
|
general-purpose store for any kind of object with the particular copy semantics of copying by value. This is effectively a map of string pairs to (constant) pointers. The first string represents the category of the object, and the second being a name for that particular object. The guarantee with the ConstDataMap is that if an object is put into the map, it may be read from, but it will not be changed underneath you. Data stored in the ConstDataMap can safely be shared between threads. More...
#include <ConstDataMap.hh>
Public Types | |
typedef std::map< std::string, utility::pointer::ReferenceCountCOP > | NamedConstObjectMap |
typedef std::map< std::string, NamedConstObjectMap > | CategorizedConstObjectMap |
typedef CategorizedConstObjectMap::iterator | iterator |
typedef CategorizedConstObjectMap::const_iterator | const_iterator |
Public Types inherited from utility::pointer::ReferenceCount | |
typedef platform::Size | Size |
typedef platform::Size | size_type |
Public Member Functions | |
ConstDataMap () | |
ConstDataMap (ConstDataMap const &src) | |
~ConstDataMap () override | |
ConstDataMap & | operator= (ConstDataMap const &rhs) |
Performs a shallow copy of all of the pointers stored in rhs into this. More... | |
bool | operator== (ConstDataMap const &rhs) const |
Performs pointer comparison to determine if these two maps point at the same data. More... | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
void | add (std::string const &type, std::string const &name, utility::pointer::ReferenceCountCOP const op) |
bool | has (std::string const &category) const |
are there any objects in the outer map with the given category? More... | |
bool | has (std::string const &category, std::string const &name) const |
Is there an object with the given category and the given name? More... | |
template<class Ty > | |
Ty const & | get (std::string const &type, std::string const &name) const |
template<class Ty > | |
utility::pointer::shared_ptr < Ty const > | get_ptr (std::string const &type, std::string const &name) const |
NamedConstObjectMap & | operator[] (std::string const &type) |
platform::Size | size () const |
returns the number of objects contained in the map More... | |
Public Member Functions inherited from utility::pointer::ReferenceCount | |
ReferenceCount () | |
Default constructor. More... | |
virtual | ~ReferenceCount () |
Private Attributes | |
CategorizedConstObjectMap | data_map_ |
general-purpose store for any kind of object with the particular copy semantics of copying by value. This is effectively a map of string pairs to (constant) pointers. The first string represents the category of the object, and the second being a name for that particular object. The guarantee with the ConstDataMap is that if an object is put into the map, it may be read from, but it will not be changed underneath you. Data stored in the ConstDataMap can safely be shared between threads.
typedef std::map< std::string, NamedConstObjectMap > basic::datacache::ConstDataMap::CategorizedConstObjectMap |
typedef CategorizedConstObjectMap::const_iterator basic::datacache::ConstDataMap::const_iterator |
typedef CategorizedConstObjectMap::iterator basic::datacache::ConstDataMap::iterator |
typedef std::map< std::string, utility::pointer::ReferenceCountCOP > basic::datacache::ConstDataMap::NamedConstObjectMap |
|
default |
basic::datacache::ConstDataMap::ConstDataMap | ( | ConstDataMap const & | src | ) |
|
overridedefault |
void basic::datacache::ConstDataMap::add | ( | std::string const & | type, |
std::string const & | name, | ||
utility::pointer::ReferenceCountCOP const | op | ||
) |
References data_map_, name, and DRRAFTER::type.
Referenced by pyrosetta.bindings.pose.ResidueLabelAccessor::discard().
ConstDataMap::iterator basic::datacache::ConstDataMap::begin | ( | ) |
References data_map_.
ConstDataMap::const_iterator basic::datacache::ConstDataMap::begin | ( | ) | const |
References data_map_.
ConstDataMap::iterator basic::datacache::ConstDataMap::end | ( | ) |
References data_map_.
ConstDataMap::const_iterator basic::datacache::ConstDataMap::end | ( | ) | const |
References data_map_.
Ty const & basic::datacache::ConstDataMap::get | ( | std::string const & | type, |
std::string const & | name | ||
) | const |
a template utility function to grab any type of object from the Data_map. Downcasts the ReferenceCount object in map to the template data type using dynamic_cast to ensure type-correctness
Throws | a utility::excn::EXCN_Msg_Exception in the event that the requested object cannot be found in the ConstDataMap. |
References CREATE_EXCEPTION, data_map_, and has().
utility::pointer::shared_ptr< Ty const > basic::datacache::ConstDataMap::get_ptr | ( | std::string const & | type, |
std::string const & | name | ||
) | const |
a template utility function to grab any type of object from the ConstDataMap. Downcasts the owning pointer in map to the template data type using dynamic_pointer_cast to ensure type-correctness
Throws | a utility::excn::EXCN_Msg_Exception in the event that the requested object cannot be found in the ConstDataMap. |
References CREATE_EXCEPTION, data_map_, and has().
bool basic::datacache::ConstDataMap::has | ( | std::string const & | category | ) | const |
bool basic::datacache::ConstDataMap::has | ( | std::string const & | category, |
std::string const & | name | ||
) | const |
Is there an object with the given category and the given name?
References data_map_.
ConstDataMap & basic::datacache::ConstDataMap::operator= | ( | ConstDataMap const & | rhs | ) |
Performs a shallow copy of all of the pointers stored in rhs into this.
merge-sort style iteration over the elements of both data-maps. This implementation may not be necessary as the STL library may already implement map's assignment operator this way.
References data_map_.
bool basic::datacache::ConstDataMap::operator== | ( | ConstDataMap const & | rhs | ) | const |
Performs pointer comparison to determine if these two maps point at the same data.
merge-sort style iteration over the elements of both data-maps.
References data_map_.
ConstDataMap::NamedConstObjectMap & basic::datacache::ConstDataMap::operator[] | ( | std::string const & | type | ) |
References data_map_, and DRRAFTER::type.
platform::Size basic::datacache::ConstDataMap::size | ( | ) | const |
returns the number of objects contained in the map
References clean_pdb_keep_ligand::count, and data_map_.
|
private |
Referenced by add(), begin(), end(), get(), get_ptr(), has(), operator=(), operator==(), operator[](), and size().