#include <G4HadronicInteractionRegistry.hh>
Public Member Functions | |
~G4HadronicInteractionRegistry () | |
void | Clean () |
void | RegisterMe (G4HadronicInteraction *aModel) |
void | RemoveMe (G4HadronicInteraction *aModel) |
G4HadronicInteraction * | FindModel (const G4String &name) |
Static Public Member Functions | |
static G4HadronicInteractionRegistry * | Instance () |
Definition at line 43 of file G4HadronicInteractionRegistry.hh.
G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry | ( | ) |
Definition at line 48 of file G4HadronicInteractionRegistry.cc.
References Clean().
00049 { 00050 Clean(); 00051 }
void G4HadronicInteractionRegistry::Clean | ( | ) |
Definition at line 53 of file G4HadronicInteractionRegistry.cc.
Referenced by ~G4HadronicInteractionRegistry(), and G4HadronicProcessStore::~G4HadronicProcessStore().
00054 { 00055 size_t nModels = allModels.size(); 00056 //G4cout << "G4HadronicInteractionRegistry::Clean() start " << nModels << G4endl; 00057 if(0 < nModels) { 00058 for (size_t i=0; i<nModels; ++i) { 00059 if( allModels[i] ) { 00060 //G4cout << "delete " << i << G4endl; 00061 //G4cout << allModels[i]->GetModelName() << G4endl; 00062 G4HadronicInteraction * model = allModels[i]; 00063 allModels[i] = 0; 00064 delete model; 00065 } 00066 } 00067 allModels.clear(); 00068 } 00069 //G4cout << "G4HadronicInteractionRegistry::Clean() is done " << G4endl; 00070 }
G4HadronicInteraction * G4HadronicInteractionRegistry::FindModel | ( | const G4String & | name | ) |
Definition at line 104 of file G4HadronicInteractionRegistry.cc.
Referenced by G4HadronInelasticQBBC::ConstructProcess(), G4BinaryCascade::G4BinaryCascade(), G4BinaryLightIonReaction::G4BinaryLightIonReaction(), G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface(), G4HadronicAbsorptionFritiof::G4HadronicAbsorptionFritiof(), and G4MuMinusCapturePrecompound::G4MuMinusCapturePrecompound().
00105 { 00106 G4HadronicInteraction* model = 0; 00107 00108 size_t nModels = allModels.size(); 00109 for (size_t i=0; i<nModels; ++i) { 00110 G4HadronicInteraction* p = allModels[i]; 00111 if(p) { 00112 if (p->GetModelName() == name) { 00113 model = p; 00114 break; 00115 } 00116 } 00117 } 00118 return model; 00119 }
G4HadronicInteractionRegistry * G4HadronicInteractionRegistry::Instance | ( | ) | [static] |
Definition at line 36 of file G4HadronicInteractionRegistry.cc.
Referenced by G4HadronInelasticQBBC::ConstructProcess(), G4BinaryCascade::G4BinaryCascade(), G4BinaryLightIonReaction::G4BinaryLightIonReaction(), G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface(), G4HadronicAbsorptionFritiof::G4HadronicAbsorptionFritiof(), G4HadronicInteraction::G4HadronicInteraction(), G4MuMinusCapturePrecompound::G4MuMinusCapturePrecompound(), G4HadronicInteraction::~G4HadronicInteraction(), and G4HadronicProcessStore::~G4HadronicProcessStore().
00037 { 00038 if(0 == theInstance) { 00039 static G4HadronicInteractionRegistry manager; 00040 theInstance = &manager; 00041 } 00042 return theInstance; 00043 }
void G4HadronicInteractionRegistry::RegisterMe | ( | G4HadronicInteraction * | aModel | ) |
Definition at line 73 of file G4HadronicInteractionRegistry.cc.
Referenced by G4HadronicInteraction::G4HadronicInteraction().
00074 { 00075 if(!aModel) { return; } 00076 size_t nModels = allModels.size(); 00077 if(nModels > 0) { 00078 for (size_t i=0; i<nModels; ++i) { 00079 if( aModel == allModels[i] ) { return; } 00080 } 00081 } 00082 //G4cout << "Register model <" << aModel->GetModelName() 00083 //<< "> " << nModels+1 << G4endl; 00084 allModels.push_back(aModel); 00085 }
void G4HadronicInteractionRegistry::RemoveMe | ( | G4HadronicInteraction * | aModel | ) |
Definition at line 88 of file G4HadronicInteractionRegistry.cc.
Referenced by G4HadronicInteraction::~G4HadronicInteraction().
00089 { 00090 if(!aModel) { return; } 00091 size_t nModels = allModels.size(); 00092 if(0 == nModels) { return; } 00093 for (size_t i=0; i<nModels; ++i) { 00094 if( aModel == allModels[i] ) { 00095 //G4cout << "DeRegister model <" << aModel->GetModelName() 00096 //<< "> " << i << G4endl; 00097 allModels[i] = 0; 00098 return; 00099 } 00100 } 00101 }