Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ElementDataRegistry Class Reference

#include <G4ElementDataRegistry.hh>

Public Member Functions

 ~G4ElementDataRegistry ()
void RegisterMe (G4ElementData *p)
void RemoveMe (G4ElementData *p)
const std::vector< G4ElementData * > & GetElementData () const
G4ElementDataGetElementDataByName (const G4String &)
G4ElementDataNewElementData (const G4String &, G4int length)

Static Public Member Functions

static G4ElementDataRegistryInstance ()

Detailed Description

Definition at line 37 of file G4ElementDataRegistry.hh.

Constructor & Destructor Documentation

◆ ~G4ElementDataRegistry()

G4ElementDataRegistry::~G4ElementDataRegistry ( )

Definition at line 51 of file G4ElementDataRegistry.cc.

52{
53 for (auto const & ptr : elmdata) {
54 delete ptr;
55 }
56 elmdata.clear();
57}

Member Function Documentation

◆ GetElementData()

const std::vector< G4ElementData * > & G4ElementDataRegistry::GetElementData ( ) const
inline

Definition at line 49 of file G4ElementDataRegistry.hh.

49 {
50 return elmdata;
51 }

◆ GetElementDataByName()

G4ElementData * G4ElementDataRegistry::GetElementDataByName ( const G4String & nam)

Definition at line 87 of file G4ElementDataRegistry.cc.

88{
89 G4ElementData* ptr = nullptr;
90 for (auto const & p : elmdata) {
91 if (p->GetName() == nam) {
92 ptr = p;
93 break;
94 }
95 }
96 return ptr;
97}

◆ Instance()

G4ElementDataRegistry * G4ElementDataRegistry::Instance ( )
static

Definition at line 40 of file G4ElementDataRegistry.cc.

41{
42 if (instance == nullptr) {
43 static G4ElementDataRegistry manager;
44 instance = &manager;
45 }
46 return instance;
47}

Referenced by G4CrossSectionHP::G4CrossSectionHP(), G4ElementData::G4ElementData(), G4EmElementXS::G4EmElementXS(), G4MuPairProductionModel::Initialise(), and G4RiGeMuPairProductionModel::Initialise().

◆ NewElementData()

G4ElementData * G4ElementDataRegistry::NewElementData ( const G4String & nam,
G4int length )

Definition at line 102 of file G4ElementDataRegistry.cc.

103{
104 for (auto const & p : elmdata) {
105 if (p->GetName() == nam) {
106 return p;
107 }
108 }
109 auto ptr = new G4ElementData(n);
110 ptr->SetName(nam);
111 return ptr;
112}

◆ RegisterMe()

void G4ElementDataRegistry::RegisterMe ( G4ElementData * p)

Definition at line 66 of file G4ElementDataRegistry.cc.

67{
68 for (auto const & ptr : elmdata) { if (ptr == p) { return; } }
69 elmdata.push_back(p);
70}

◆ RemoveMe()

void G4ElementDataRegistry::RemoveMe ( G4ElementData * p)

Definition at line 74 of file G4ElementDataRegistry.cc.

75{
76 if (nullptr == p) { return; }
77 for (std::size_t i=0; i<elmdata.size(); ++i) {
78 if (p == elmdata[i]) {
79 elmdata[i] = nullptr;
80 return;
81 }
82 }
83}

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