Module* findModule( const char* type, int version, const char* name ) const { Modules_::const_iterator i = m_modules.find( ModuleKey( ModuleType( type, version ), name ) ); if ( i != m_modules.end() ) { return ( *i ).second; } return 0; }
void foreachModule (const std::string& type, int version, const Visitor& visitor) { for (Modules_::const_iterator i = m_modules.begin(); i != m_modules.end(); ++i) { if ((*i).first.first.first == type) { visitor.visit((*i).first.second, *(*i).second); } } }
void foreachModule( const char* type, int version, const Visitor& visitor ){ for ( Modules_::const_iterator i = m_modules.begin(); i != m_modules.end(); ++i ) { if ( string_equal( ( *i ).first.first.first.c_str(), type ) ) { visitor.visit( ( *i ).first.second.c_str(), *( *i ).second ); } } }
void registerModule (const std::string& type, int version, const std::string& name, Module& module) { ASSERT_NOTNULL(&module); if (!m_modules.insert(Modules_::value_type(ModuleKey(ModuleType(type, version), name), &module)).second) { g_warning("Module already registered: type='%s' name='%s'\n", type.c_str(), name.c_str()); } else { g_message("Module registered: type='%s' version='%i' name='%s'\n", type.c_str(), version, name.c_str()); } }
void registerModule( const char* type, int version, const char* name, Module& module ){ ASSERT_NOTNULL( &module ); if ( !m_modules.insert( Modules_::value_type( ModuleKey( ModuleType( type, version ), name ), &module ) ).second ) { globalErrorStream() << "module already registered: type=" << makeQuoted( type ) << " name=" << makeQuoted( name ) << "\n"; } else { globalOutputStream() << "Module Registered: type=" << makeQuoted( type ) << " version=" << makeQuoted( version ) << " name=" << makeQuoted( name ) << "\n"; } }