14 #ifndef INCLUDED_protocols_moves_DataMap_hh
15 #define INCLUDED_protocols_moves_DataMap_hh
27 #include <utility/pointer/ReferenceCount.hh>
29 #include <utility/exit.hh>
31 #include <basic/Tracer.hh>
36 static basic::Tracer
TR_hh(
"protocols.moves.DataMap_hh" );
42 typedef std::map< std::string, std::map< std::string, utility::pointer::ReferenceCountOP > >
::iterator iterator;
57 utility::pointer::ReferenceCountOP
const op
61 std::map< std::string, utility::pointer::ReferenceCountOP > &
operator [](
68 std::map< std::string, std::map< std::string, utility::pointer::ReferenceCountOP > >
data_map_;
77 using namespace utility::pointer;
80 if( !
has( type, name ) ){
82 error_message <<
"ERROR: Could not find "<<type<<
" and name "<<name<<
" in Datamap\n";
84 utility_exit_with_message( error_message.str() );
87 std::map< std::string, utility::pointer::ReferenceCountOP >
const dm(
data_map_.find( type )->second );
88 for( std::map< std::string, ReferenceCountOP >::const_iterator it=dm.begin(); it!=dm.end(); ++it ) {
89 if( it->first == name ) {
90 ret =
dynamic_cast< Ty
>( it->second.get() );
96 error_message <<
"ERROR: Dynamic_cast failed for type "<<type<<
" and name "<<name<<
'\n';
98 utility_exit_with_message( error_message.str() );
107 template <
class Ty >
111 if( data.
has( type, name ) ){
112 obj = data.
get< Ty * >( type, name );
113 TR_hh<<
"Getting object-type, name "<<type<<
' '<<name<<
" from datamap"<<std::endl;
117 data.
add( type, name, obj );
118 TR_hh<<
"Adding object-type, name "<<type<<
' '<<name<<
" to datamap"<<std::endl;