Geant4 11.2.2
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 &)
 

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}

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}

Referenced by G4MuPairProductionModel::Initialise().

◆ 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(), G4MuPairProductionModel::Initialise(), and G4ElementData::~G4ElementData().

◆ RegisterMe()

void G4ElementDataRegistry::RegisterMe ( G4ElementData * p)

Definition at line 65 of file G4ElementDataRegistry.cc.

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

Referenced by G4ElementData::G4ElementData().

◆ 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}

Referenced by G4ElementData::~G4ElementData().


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