Geant4  10.02.p03
G4CrossSectionFactoryRegistry Class Reference

#include <G4CrossSectionFactoryRegistry.hh>

Collaboration diagram for G4CrossSectionFactoryRegistry:

Public Member Functions

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

Static Public Member Functions

static G4CrossSectionFactoryRegistryInstance ()
 

Private Member Functions

 G4CrossSectionFactoryRegistry ()
 
 G4CrossSectionFactoryRegistry (const G4CrossSectionFactoryRegistry &)
 
G4CrossSectionFactoryRegistryoperator= (const G4CrossSectionFactoryRegistry &)
 

Private Attributes

std::map< G4String, G4VBaseXSFactory * > factories
 

Static Private Attributes

static G4CrossSectionFactoryRegistryinstance = 0
 

Friends

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

Detailed Description

Definition at line 48 of file G4CrossSectionFactoryRegistry.hh.

Constructor & Destructor Documentation

◆ G4CrossSectionFactoryRegistry() [1/2]

G4CrossSectionFactoryRegistry::G4CrossSectionFactoryRegistry ( )
private

Definition at line 48 of file G4CrossSectionFactoryRegistry.cc.

49 {
50 }
Here is the caller graph for this function:

◆ G4CrossSectionFactoryRegistry() [2/2]

G4CrossSectionFactoryRegistry::G4CrossSectionFactoryRegistry ( const G4CrossSectionFactoryRegistry )
private

Definition at line 52 of file G4CrossSectionFactoryRegistry.cc.

53 {
54  G4Exception("G4CrossSectionFactoryRegistry::G4CrossSectionFactoryRegistry",
55  "CrossSection004",FatalException,"Use of copy constructor not allowed");
56 }
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:

Member Function Documentation

◆ GetFactory()

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
std::map< G4String, G4VBaseXSFactory * > factories
if(nlines<=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:

◆ Instance()

G4CrossSectionFactoryRegistry * G4CrossSectionFactoryRegistry::Instance ( void  )
static

Definition at line 41 of file G4CrossSectionFactoryRegistry.cc.

42 {
43  G4AutoLock l(&xsFactoryRegisterMutex);
45  return instance;
46 }
static G4CrossSectionFactoryRegistry * instance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

G4CrossSectionFactoryRegistry & G4CrossSectionFactoryRegistry::operator= ( const G4CrossSectionFactoryRegistry )
private

Definition at line 57 of file G4CrossSectionFactoryRegistry.cc.

58 {
59  G4Exception("G4CrossSectionFactoryRegistry::G4CrossSectionFactoryRegistry",
60  "CrossSection004",FatalException,"Use of assignement operator not allowed");
61  return *this;
62 }
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:

◆ Register()

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 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4String name
Definition: TRTMaterials.hh:40
std::map< G4String, G4VBaseXSFactory * > factories
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

◆ operator<<

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 }

Member Data Documentation

◆ factories

std::map<G4String, G4VBaseXSFactory*> G4CrossSectionFactoryRegistry::factories
private

Definition at line 52 of file G4CrossSectionFactoryRegistry.hh.

◆ instance

G4CrossSectionFactoryRegistry * G4CrossSectionFactoryRegistry::instance = 0
staticprivate

Definition at line 53 of file G4CrossSectionFactoryRegistry.hh.


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