Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Attributes | List of all members
basic::datacache::ConstDataMap Class Reference

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>

Inheritance diagram for basic::datacache::ConstDataMap:
Inheritance graph
[legend]

Public Types

typedef std::map< std::string,
utility::VirtualBaseCOP
NamedConstObjectMap
 
typedef std::map< std::string,
NamedConstObjectMap
CategorizedConstObjectMap
 
typedef
CategorizedConstObjectMap::iterator 
iterator
 
typedef
CategorizedConstObjectMap::const_iterator 
const_iterator
 

Public Member Functions

 ConstDataMap ()
 
 ConstDataMap (ConstDataMap const &src)
 
 ~ConstDataMap () override
 
ConstDataMapoperator= (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::VirtualBaseCOP 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
 
NamedConstObjectMapoperator[] (std::string const &type)
 
platform::Size size () const
 returns the number of objects contained in the map More...
 
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
 
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 
 VirtualBase (VirtualBase const &)=default
 
 VirtualBase (VirtualBase &&)=default
 
VirtualBaseoperator= (VirtualBase const &)=default
 
VirtualBaseoperator= (VirtualBase &&)=default
 

Private Attributes

CategorizedConstObjectMap data_map_
 

Detailed Description

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.

Member Typedef Documentation

typedef CategorizedConstObjectMap::const_iterator basic::datacache::ConstDataMap::const_iterator
typedef CategorizedConstObjectMap::iterator basic::datacache::ConstDataMap::iterator

Constructor & Destructor Documentation

basic::datacache::ConstDataMap::ConstDataMap ( )
default
basic::datacache::ConstDataMap::ConstDataMap ( ConstDataMap const &  src)
default
basic::datacache::ConstDataMap::~ConstDataMap ( )
overridedefault

Member Function Documentation

void basic::datacache::ConstDataMap::add ( std::string const &  type,
std::string const &  name,
utility::VirtualBaseCOP const  op 
)
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_.

template<class Ty >
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 VirtualBase object in map to the template data type using dynamic_cast to ensure type-correctness

Exceptions
Throwsa 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().

template<class Ty >
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

Exceptions
Throwsa 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

are there any objects in the outer map with the given category?

References data_map_.

Referenced by get(), and get_ptr().

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_.

Member Data Documentation

CategorizedConstObjectMap basic::datacache::ConstDataMap::data_map_
private

The documentation for this class was generated from the following files: