Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
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 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 47 of file G4CrossSectionFactoryRegistry.cc.

48{
49 instance = this;
50}
static G4CrossSectionFactoryRegistry * instance

References instance.

Referenced by Instance().

◆ 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}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35

References FatalException, and G4Exception().

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(G4TypeMutex<G4CrossSectionFactoryRegistry>());
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: G4Exception.hh:40
std::map< G4String, G4VBaseXSFactory * > factories
const char * name(G4int ptype)

References factories, FatalException, G4Exception(), and G4InuclParticleNames::name().

Referenced by G4CrossSectionDataSetRegistry::GetCrossSectionDataSet().

◆ Instance()

G4CrossSectionFactoryRegistry * G4CrossSectionFactoryRegistry::Instance ( void  )
static

◆ 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 assignment operator not allowed");
61 return *this;
62}

References FatalException, and G4Exception().

◆ Register()

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

Definition at line 64 of file G4CrossSectionFactoryRegistry.cc.

65{
66 G4AutoLock l(G4TypeMutex<G4CrossSectionFactoryRegistry>());
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 }
76}
@ JustWarning
factory
Definition: test.py:55

References factories, test::factory, G4Exception(), JustWarning, and G4InuclParticleNames::name().

Referenced by G4CrossSectionFactory< T, mode >::G4CrossSectionFactory(), G4CrossSectionFactory< T, 0 >::G4CrossSectionFactory(), G4CrossSectionFactory< T, 1 >::G4CrossSectionFactory(), and G4CrossSectionFactory< T, 2 >::G4CrossSectionFactory().

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}

Field Documentation

◆ factories

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

Definition at line 52 of file G4CrossSectionFactoryRegistry.hh.

Referenced by GetFactory(), and Register().

◆ instance

G4CrossSectionFactoryRegistry * G4CrossSectionFactoryRegistry::instance = 0
staticprivate

Definition at line 53 of file G4CrossSectionFactoryRegistry.hh.

Referenced by G4CrossSectionFactoryRegistry(), and Instance().


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