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::DataMap Class Reference

general-purpose store for any reference-count derived object More...

#include <DataMap.hh>

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

Public Types

typedef std::map< std::string,
std::map< std::string,
utility::VirtualBaseOP >
>::iterator 
iterator
 
typedef std::map< std::string,
std::map< std::string,
utility::VirtualBaseOP >
>::const_iterator 
const_iterator
 
typedef std::map< std::string,
utility::VirtualBaseCOP >
::const_iterator 
resource_const_iterator
 

Public Member Functions

 DataMap ()
 
 ~DataMap () override
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
resource_const_iterator resources_begin () const
 
resource_const_iterator resources_end () const
 
virtual bool add (std::string const &type, std::string const &name, utility::VirtualBaseOP op)
 
bool add_resource (std::string const &resource_name, utility::VirtualBaseCOP op)
 
bool has_type (std::string const &type) const
 Does the data map contain the given type? More...
 
bool has_resource (std::string const &resource_name) const
 Does the data map contain a resource with the given name? More...
 
bool has (std::string const &type, std::string const &name="") const
 Does the data map contain an entry with a specific name in the given type? More...
 
template<class T >
T get (std::string const &type, std::string const &name) const
 
template<class T >
utility::pointer::shared_ptr< Tget_ptr (std::string const &type, std::string const &name) const
 
template<class T >
utility::pointer::shared_ptr
< T const > 
get_resource (std::string const &resource_name) const
 
std::map< std::string,
utility::VirtualBaseOP > & 
operator[] (std::string const &type)
 
std::map< std::string,
utility::VirtualBaseOP > const & 
category_map (std::string const &type) const
 
platform::Size size () const
 returns the size of the map (how many different types are in data_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

std::map< std::string,
std::map< std::string,
utility::VirtualBaseOP > > 
data_map_
 
std::map< std::string,
utility::VirtualBaseCOP
resource_map_
 

Detailed Description

general-purpose store for any reference-count derived object

Member Typedef Documentation

typedef std::map< std::string, std::map< std::string, utility::VirtualBaseOP > >::const_iterator basic::datacache::DataMap::const_iterator
typedef std::map< std::string, std::map< std::string, utility::VirtualBaseOP > >::iterator basic::datacache::DataMap::iterator

Constructor & Destructor Documentation

basic::datacache::DataMap::DataMap ( )
default
basic::datacache::DataMap::~DataMap ( )
overridedefault

Member Function Documentation

bool basic::datacache::DataMap::add ( std::string const &  type,
std::string const &  name,
utility::VirtualBaseOP  op 
)
virtual
bool basic::datacache::DataMap::add_resource ( std::string const &  resource_name,
utility::VirtualBaseCOP  op 
)
DataMap::iterator basic::datacache::DataMap::begin ( )

References data_map_.

DataMap::const_iterator basic::datacache::DataMap::begin ( ) const

References data_map_.

std::map< std::string, utility::VirtualBaseOP > const & basic::datacache::DataMap::category_map ( std::string const &  type) const
DataMap::iterator basic::datacache::DataMap::end ( )

References data_map_.

DataMap::const_iterator basic::datacache::DataMap::end ( ) const

References data_map_.

template<class T >
T basic::datacache::DataMap::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 DataMap.

References CREATE_EXCEPTION, data_map_, and has().

template<class T >
utility::pointer::shared_ptr< T > basic::datacache::DataMap::get_ptr ( 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 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 DataMap.

References CREATE_EXCEPTION, data_map_, utility::pointer::dynamic_pointer_cast(), and has().

Referenced by basic::datacache::HierarchicalDataMap::get(), and basic::datacache::get_set_from_datamap().

template<class T >
utility::pointer::shared_ptr< T const > basic::datacache::DataMap::get_resource ( std::string const &  resource_name) const
bool basic::datacache::DataMap::has ( std::string const &  type,
std::string const &  name = "" 
) const

Does the data map contain an entry with a specific name in the given type?

Note
calling this function without providing a name is just plain wrong and makes no sense and I would be changing that right now if Kale hadn't already found out that some code relies on this bad behavior back in pull request #187

References data_map_.

Referenced by add(), get(), basic::datacache::HierarchicalDataMap::get(), get_ptr(), and basic::datacache::get_set_from_datamap().

bool basic::datacache::DataMap::has_resource ( std::string const &  resource_name) const

Does the data map contain a resource with the given name?

References resource_map_.

Referenced by add_resource().

bool basic::datacache::DataMap::has_type ( std::string const &  type) const

Does the data map contain the given type?

References data_map_.

std::map< std::string, utility::VirtualBaseOP > & basic::datacache::DataMap::operator[] ( std::string const &  type)

References data_map_, and DRRAFTER::type.

resource_const_iterator basic::datacache::DataMap::resources_begin ( ) const
resource_const_iterator basic::datacache::DataMap::resources_end ( ) const
platform::Size basic::datacache::DataMap::size ( ) const

returns the size of the map (how many different types are in data_map_

References data_map_.

Member Data Documentation

std::map< std::string, std::map< std::string, utility::VirtualBaseOP > > basic::datacache::DataMap::data_map_
private
std::map< std::string, utility::VirtualBaseCOP > basic::datacache::DataMap::resource_map_
private

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