Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4CrossSectionFactoryRegistry Class Reference

#include <G4CrossSectionFactoryRegistry.hh>

Public Member Functions

G4VBaseXSFactoryGetFactory (const G4String &name, G4bool abortIfNotFound=true) const
 
void Register (const G4String &name, G4VBaseXSFactory *factory)
 

Static Public Member Functions

static
G4CrossSectionFactoryRegistry
Instance ()
 

Friends

std::ostream & operator<< (std::ostream &, const G4CrossSectionFactoryRegistry &)
 

Detailed Description

Definition at line 48 of file G4CrossSectionFactoryRegistry.hh.

Member Function Documentation

G4VBaseXSFactory * G4CrossSectionFactoryRegistry::GetFactory ( const G4String name,
G4bool  abortIfNotFound = true 
) const

Definition at line 78 of file G4CrossSectionFactoryRegistry.cc.

79 {
80  G4AutoLock l(&xsFactoryRegisterMutex);
81  std::map<G4String,G4VBaseXSFactory*>::const_iterator it = factories.find(name);
82  if ( it != factories.end() ) return it->second;
83  else
84  {
85  if ( abortIfNotFound )
86  {
88  msg <<"Cross section factory with name: "<<name
89  <<" not found.";
90  G4Exception("G4CrossSectionFactoryRegistry::Register(...)",
91  "CrossSection003",FatalException,msg);
92  }
93  }
94  return static_cast<G4VBaseXSFactory*>(0);
95 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
if(nIso!=0)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

G4CrossSectionFactoryRegistry * G4CrossSectionFactoryRegistry::Instance ( void  )
static

Definition at line 41 of file G4CrossSectionFactoryRegistry.cc.

42 {
43  G4AutoLock l(&xsFactoryRegisterMutex);
45  return instance;
46 }
static MCTruthManager * instance

Here is the caller graph for this function:

void G4CrossSectionFactoryRegistry::Register ( const G4String name,
G4VBaseXSFactory factory 
)

Definition at line 64 of file G4CrossSectionFactoryRegistry.cc.

65 {
66  G4AutoLock l(&xsFactoryRegisterMutex);
67  if ( factories.find(name) != factories.end() )
68  {
70  msg <<"Cross section factory with name: "<<name
71  <<" already existing, old factory has been replaced";
72  G4Exception("G4CrossSectionFactoryRegistry::Register(...)",
73  "CrossSection002",JustWarning,msg);
74  }
75  factories[name] = factory;
76 }
const XML_Char * name
Definition: expat.h:151
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  msg,
const G4CrossSectionFactoryRegistry rhs 
)
friend

Definition at line 98 of file G4CrossSectionFactoryRegistry.cc.

98  {
99  msg<<"Factory Registry "<<&rhs<<" has factories: [";
100  for ( std::map<G4String,G4VBaseXSFactory*>::const_iterator it =rhs.factories.begin() ;
101  it != rhs.factories.end() ; ++it )
102  {
103  msg<<(*it).first<<":"<<(*it).second<<",";
104  }
105  msg<<"]";
106  return msg;
107 }

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