Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4CrossSectionDataSetRegistry Class Reference

#include <G4CrossSectionDataSetRegistry.hh>

Public Member Functions

 ~G4CrossSectionDataSetRegistry ()
 
void Register (G4VCrossSectionDataSet *)
 
void DeRegister (G4VCrossSectionDataSet *)
 
void Clean ()
 
G4VCrossSectionDataSetGetCrossSectionDataSet (const G4String &name, G4bool warning=true)
 

Static Public Member Functions

static
G4CrossSectionDataSetRegistry
Instance ()
 

Detailed Description

Definition at line 56 of file G4CrossSectionDataSetRegistry.hh.

Constructor & Destructor Documentation

G4CrossSectionDataSetRegistry::~G4CrossSectionDataSetRegistry ( )

Definition at line 89 of file G4CrossSectionDataSetRegistry.cc.

References Clean().

Member Function Documentation

void G4CrossSectionDataSetRegistry::Clean ( )

Definition at line 94 of file G4CrossSectionDataSetRegistry.cc.

References n.

Referenced by ~G4CrossSectionDataSetRegistry(), and G4HadronicProcessStore::~G4HadronicProcessStore().

95 {
96  size_t n = xSections.size();
97  if(n > 0) {
98  for (size_t i=0; i<n; ++i) {
99  if(xSections[i]) {
100  G4VCrossSectionDataSet* p = xSections[i];
101  xSections[i] = 0;
102  delete p;
103  }
104  }
105  xSections.clear();
106  }
107 }
const char * p
Definition: xmltok.h:285
const G4int n
void G4CrossSectionDataSetRegistry::DeRegister ( G4VCrossSectionDataSet p)

Definition at line 121 of file G4CrossSectionDataSetRegistry.cc.

References n.

Referenced by G4VCrossSectionDataSet::~G4VCrossSectionDataSet().

122 {
123  if(!p) return;
124  size_t n = xSections.size();
125  if(n > 0) {
126  for (size_t i=0; i<n; ++i) {
127  if(xSections[i] == p) {
128  xSections[i] = 0;
129  return;
130  }
131  }
132  }
133 }
const G4int n
G4VCrossSectionDataSet * G4CrossSectionDataSetRegistry::GetCrossSectionDataSet ( const G4String name,
G4bool  warning = true 
)

Definition at line 140 of file G4CrossSectionDataSetRegistry.cc.

References G4CrossSectionFactoryRegistry::GetFactory(), G4VCrossSectionDataSet::GetName(), G4CrossSectionFactoryRegistry::Instance(), G4VBaseXSFactory::Instantiate(), and n.

Referenced by G4BGGNucleonInelasticXS::BuildPhysicsTable(), G4BGGNucleonElasticXS::BuildPhysicsTable(), G4HadronPhysicsFTFP_BERT_HP::ConstructProcess(), G4HadronPhysicsFTFP_BERT::ConstructProcess(), G4HadronPhysicsShielding::ConstructProcess(), G4HadronPhysicsFTFP_BERT_TRV::ConstructProcess(), G4BertiniKaonBuilder::G4BertiniKaonBuilder(), G4ChipsComponentXS::G4ChipsComponentXS(), G4ChipsElasticModel::G4ChipsElasticModel(), G4ChipsKaonZeroElasticXS::G4ChipsKaonZeroElasticXS(), G4ChipsKaonZeroInelasticXS::G4ChipsKaonZeroInelasticXS(), G4HyperonFTFPBuilder::G4HyperonFTFPBuilder(), and G4QuasiElRatios::G4QuasiElRatios().

141 {
142  size_t n = xSections.size();
143 
144  for (size_t i=0; i<n; ++i)
145  {
146  if(xSections[i])
147  {
148  G4VCrossSectionDataSet* p = xSections[i];
149  if (p->GetName() == name) return p;
150  }
151  }
152  // check if factory exists...
153  //
155  //This thorws if factory is not found, add second parameter to false to avoid this
156  G4VBaseXSFactory* factory = factories->GetFactory(name, warning );
157  if ( factory )
158  return factory->Instantiate();
159  else
160  return static_cast<G4VCrossSectionDataSet*>(0);
161 }
const char * p
Definition: xmltok.h:285
const XML_Char * name
const G4String & GetName() const
virtual G4VCrossSectionDataSet * Instantiate()=0
G4VBaseXSFactory * GetFactory(const G4String &name, G4bool abortIfNotFound=true) const
const G4int n
static G4CrossSectionFactoryRegistry * Instance()
G4CrossSectionDataSetRegistry * G4CrossSectionDataSetRegistry::Instance ( void  )
static

Definition at line 77 of file G4CrossSectionDataSetRegistry.cc.

References G4ThreadLocal.

Referenced by G4FTFBinaryKaonBuilder::Build(), G4QGSBinaryKaonBuilder::Build(), G4QGSPPiKBuilder::Build(), G4QGSBinaryPiKBuilder::Build(), G4BGGNucleonInelasticXS::BuildPhysicsTable(), G4BGGNucleonElasticXS::BuildPhysicsTable(), DMXPhysicsList::ConstructHad(), G4HadronDElasticPhysics::ConstructProcess(), G4HadronInelasticQBBC::ConstructProcess(), G4HadronElasticPhysics::ConstructProcess(), G4HadronPhysicsFTFP_BERT_HP::ConstructProcess(), G4HadronPhysicsShielding::ConstructProcess(), G4HadronPhysicsFTFP_BERT::ConstructProcess(), G4HadronPhysicsFTFP_BERT_TRV::ConstructProcess(), GammaRayTelIonPhysics::ConstructProcess(), GammaRayTelHadronPhysics::ConstructProcess(), G4BertiniKaonBuilder::G4BertiniKaonBuilder(), G4ChipsComponentXS::G4ChipsComponentXS(), G4ChipsElasticModel::G4ChipsElasticModel(), G4ChipsKaonZeroElasticXS::G4ChipsKaonZeroElasticXS(), G4ChipsKaonZeroInelasticXS::G4ChipsKaonZeroInelasticXS(), G4ElectroVDNuclearModel::G4ElectroVDNuclearModel(), G4HyperonFTFPBuilder::G4HyperonFTFPBuilder(), G4QuasiElRatios::G4QuasiElRatios(), G4VCrossSectionDataSet::G4VCrossSectionDataSet(), G4HadronicProcessStore::~G4HadronicProcessStore(), and G4VCrossSectionDataSet::~G4VCrossSectionDataSet().

78 {
79  if(0 == theInstance) {
80  static G4ThreadLocal G4CrossSectionDataSetRegistry *manager_G4MT_TLS_ = 0 ; if (!manager_G4MT_TLS_) manager_G4MT_TLS_ = new G4CrossSectionDataSetRegistry ; G4CrossSectionDataSetRegistry &manager = *manager_G4MT_TLS_;
81  theInstance = &manager;
82  }
83  return theInstance;
84 }
#define G4ThreadLocal
Definition: tls.hh:52
void G4CrossSectionDataSetRegistry::Register ( G4VCrossSectionDataSet p)

Definition at line 109 of file G4CrossSectionDataSetRegistry.cc.

References n.

Referenced by G4VCrossSectionDataSet::G4VCrossSectionDataSet().

110 {
111  if(!p) return;
112  size_t n = xSections.size();
113  if(n > 0) {
114  for (size_t i=0; i<n; ++i) {
115  if(xSections[i] == p) { return; }
116  }
117  }
118  xSections.push_back(p);
119 }
const G4int n

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