51 if ( factories.find(name) == factories.end() ) {
53 if ( factories.find(name) == factories.end() ) {
54 factories[name] = factory;
62 if (
nullptr == factory || factories.empty() ) {
return; }
64 for (
auto const & f : factories ) {
65 if ( factory == f.second ) {
66 factories[f.first] =
nullptr;
76 auto it = factories.find(name);
77 if ( it != factories.end() ) {
79 }
else if ( abortIfNotFound ) {
81 msg <<
"Cross section factory with name: " << name <<
" not found.";
82 G4Exception(
"G4CrossSectionFactoryRegistry::GetFactory(...)",
89 msg<<
"Factory Registry "<<&rhs<<
" has factories: [";
90 for ( std::map<G4String,G4VBaseXSFactory*>::const_iterator it =rhs.factories.begin();
91 it != rhs.factories.end() ; ++it )
93 msg<<(*it).first<<
":"<<(*it).second<<
",";
G4TemplateAutoLock< G4Mutex > G4AutoLock
std::ostream & operator<<(std::ostream &msg, const G4CrossSectionFactoryRegistry &rhs)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4MUTEX_INITIALIZER
static G4CrossSectionFactoryRegistry * Instance()
void DeRegister(G4VBaseXSFactory *factory)
G4VBaseXSFactory * GetFactory(const G4String &name, G4bool abortIfNotFound=true) const
G4CrossSectionFactoryRegistry(const G4CrossSectionFactoryRegistry &)=delete
void Register(const G4String &name, G4VBaseXSFactory *factory)