Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AttDefStore Namespace Reference

Functions

std::map< G4String, G4AttDef > * GetInstance (const G4String &storeKey, G4bool &isNew)
 
G4bool GetStoreKey (const std::map< G4String, G4AttDef > *definitions, G4String &key)
 

Variables

std::map< G4String, std::map< G4String, G4AttDef > * > * m_defsmaps = 0
 
G4Mutex mutex = G4MUTEX_INITIALIZER
 

Function Documentation

◆ GetInstance()

std::map< G4String, G4AttDef > * G4AttDefStore::GetInstance ( const G4String storeKey,
G4bool isNew 
)

Definition at line 40 of file G4AttDefStore.cc.

41{
42 G4AutoLock al(&mutex);
43
44 if (!m_defsmaps)
45 m_defsmaps = new std::map<G4String,std::map<G4String,G4AttDef>*>;
46
47 // Allocate the new map if not existing already
48 // and return it to the caller
49 //
50 std::map<G4String,G4AttDef>* definitions;
51 std::map<G4String,std::map<G4String,G4AttDef>*>::iterator iDefinitions =
52 m_defsmaps->find(storeKey);
53
54 if (iDefinitions == m_defsmaps->end())
55 {
56 isNew = true;
57 definitions = new std::map<G4String,G4AttDef>;
58 (*m_defsmaps)[storeKey] = definitions;
59 }
60 else
61 {
62 isNew = false;
63 definitions = iDefinitions->second;
64 }
65 return definitions;
66}
std::map< G4String, std::map< G4String, G4AttDef > * > * m_defsmaps

Referenced by G4RichTrajectory::GetAttDefs(), G4RichTrajectoryPoint::GetAttDefs(), G4SmoothTrajectory::GetAttDefs(), G4SmoothTrajectoryPoint::GetAttDefs(), G4Trajectory::GetAttDefs(), G4TrajectoryPoint::GetAttDefs(), G4PhysicalVolumeModel::GetAttDefs(), and G4TrajectoriesModel::GetAttDefs().

◆ GetStoreKey()

G4bool G4AttDefStore::GetStoreKey ( const std::map< G4String, G4AttDef > *  definitions,
G4String key 
)

Definition at line 68 of file G4AttDefStore.cc.

70{
71 G4AutoLock al(&mutex);
72
73 if (!m_defsmaps)
74 m_defsmaps = new std::map<G4String,std::map<G4String,G4AttDef>*>;
75 std::map<G4String,std::map<G4String,G4AttDef>*>::const_iterator i;
76 for (i = m_defsmaps->begin(); i != m_defsmaps->end(); ++i)
77 {
78 if (i->second == definitions)
79 {
80 key = i->first;
81 return true;
82 }
83 }
84
85 return false;
86}
std::size_t first(char) const

Referenced by operator<<().

Variable Documentation

◆ m_defsmaps

std::map< G4String, std::map< G4String, G4AttDef > * > * G4AttDefStore::m_defsmaps = 0

Definition at line 35 of file G4AttDefStore.cc.

Referenced by GetInstance(), and GetStoreKey().

◆ mutex

G4Mutex G4AttDefStore::mutex = G4MUTEX_INITIALIZER

Definition at line 37 of file G4AttDefStore.cc.