#include <G4PhysicsConstructorRegistry.hh>
Public Member Functions | |
~G4PhysicsConstructorRegistry () | |
void | Register (G4VPhysicsConstructor *) |
void | DeRegister (G4VPhysicsConstructor *) |
void | Clean () |
void | AddFactory (G4String, G4VBasePhysConstrFactory *) |
G4VPhysicsConstructor * | GetPhysicsConstructor (const G4String &name) |
Static Public Member Functions | |
static G4PhysicsConstructorRegistry * | Instance () |
Definition at line 57 of file G4PhysicsConstructorRegistry.hh.
G4PhysicsConstructorRegistry::~G4PhysicsConstructorRegistry | ( | ) |
Definition at line 61 of file G4PhysicsConstructorRegistry.cc.
References Clean().
00062 { 00063 Clean(); 00064 }
void G4PhysicsConstructorRegistry::AddFactory | ( | G4String | , | |
G4VBasePhysConstrFactory * | ||||
) |
Definition at line 107 of file G4PhysicsConstructorRegistry.cc.
Referenced by G4PhysicsConstructorFactory< T >::G4PhysicsConstructorFactory().
void G4PhysicsConstructorRegistry::Clean | ( | ) |
Definition at line 66 of file G4PhysicsConstructorRegistry.cc.
References CLHEP::detail::n.
Referenced by ~G4PhysicsConstructorRegistry().
00067 { 00068 size_t n = physConstr.size(); 00069 if(n > 0) { 00070 for (size_t i=0; i<n; ++i) { 00071 if(physConstr[i]) { 00072 G4VPhysicsConstructor* p = physConstr[i]; 00073 physConstr[i] = 0; 00074 delete p; 00075 } 00076 } 00077 physConstr.clear(); 00078 } 00079 }
void G4PhysicsConstructorRegistry::DeRegister | ( | G4VPhysicsConstructor * | ) |
Definition at line 93 of file G4PhysicsConstructorRegistry.cc.
References CLHEP::detail::n.
00094 { 00095 if(!p) return; 00096 size_t n = physConstr.size(); 00097 if(n > 0) { 00098 for (size_t i=0; i<n; ++i) { 00099 if(physConstr[i] == p) { 00100 physConstr[i] = 0; 00101 return; 00102 } 00103 } 00104 } 00105 }
G4VPhysicsConstructor * G4PhysicsConstructorRegistry::GetPhysicsConstructor | ( | const G4String & | name | ) |
Definition at line 112 of file G4PhysicsConstructorRegistry.cc.
References FatalException, G4endl, and G4Exception().
00113 { 00114 // check if factory exists... 00115 // 00116 if (factories.find(name)!=factories.end()) 00117 { 00118 // we could store the list of called factories in some vector and 00119 // before returning we can could first check if this physics constructor was already instantiated 00120 // if yes, we can throw an exception saying that this physics can been already registered 00121 00122 return factories[name]->Instantiate(); 00123 } 00124 else 00125 { 00126 G4ExceptionDescription ED; 00127 ED << "The factory for the physics constructor ["<< name << "] does not exist!" << G4endl; 00128 G4Exception("G4PhysicsConstructorRegistry::GetPhysicsConstructor", "PhysicsList001", FatalException, ED); 00129 return 0; 00130 } 00131 }
G4PhysicsConstructorRegistry * G4PhysicsConstructorRegistry::Instance | ( | ) | [static] |
Definition at line 49 of file G4PhysicsConstructorRegistry.cc.
Referenced by G4PhysicsConstructorFactory< T >::G4PhysicsConstructorFactory().
00050 { 00051 if(0 == theInstance) { 00052 static G4PhysicsConstructorRegistry manager; 00053 theInstance = &manager; 00054 } 00055 return theInstance; 00056 }
void G4PhysicsConstructorRegistry::Register | ( | G4VPhysicsConstructor * | ) |
Definition at line 81 of file G4PhysicsConstructorRegistry.cc.
References CLHEP::detail::n.
00082 { 00083 if(!p) return; 00084 size_t n = physConstr.size(); 00085 if(n > 0) { 00086 for (size_t i=0; i<n; ++i) { 00087 if(physConstr[i] == p) { return; } 00088 } 00089 } 00090 physConstr.push_back(p); 00091 }