#include <G4LogicalVolumeStore.hh>
Public Member Functions | |
G4LogicalVolume * | GetVolume (const G4String &name, G4bool verbose=true) const |
virtual | ~G4LogicalVolumeStore () |
Static Public Member Functions | |
static void | Register (G4LogicalVolume *pVolume) |
static void | DeRegister (G4LogicalVolume *pVolume) |
static G4LogicalVolumeStore * | GetInstance () |
static void | SetNotifier (G4VStoreNotifier *pNotifier) |
static void | Clean () |
Protected Member Functions | |
G4LogicalVolumeStore () |
Definition at line 62 of file G4LogicalVolumeStore.hh.
G4LogicalVolumeStore::~G4LogicalVolumeStore | ( | ) | [virtual] |
Definition at line 64 of file G4LogicalVolumeStore.cc.
References Clean().
00065 { 00066 Clean(); 00067 }
G4LogicalVolumeStore::G4LogicalVolumeStore | ( | ) | [protected] |
void G4LogicalVolumeStore::Clean | ( | ) | [static] |
Definition at line 73 of file G4LogicalVolumeStore.cc.
References G4cout, G4endl, GetInstance(), and G4GeometryManager::GetInstance().
Referenced by G4GDMLMessenger::SetNewValue(), and ~G4LogicalVolumeStore().
00074 { 00075 // Do nothing if geometry is closed 00076 // 00077 if (G4GeometryManager::GetInstance()->IsGeometryClosed()) 00078 { 00079 G4cout << "WARNING - Attempt to delete the logical volume store" 00080 << " while geometry closed !" << G4endl; 00081 return; 00082 } 00083 00084 // Locks store for deletion of volumes. De-registration will be 00085 // performed at this stage. G4LogicalVolumes will not de-register themselves. 00086 // 00087 locked = true; 00088 00089 size_t i=0; 00090 G4LogicalVolumeStore* store = GetInstance(); 00091 00092 #ifdef G4GEOMETRY_VOXELDEBUG 00093 G4cout << "Deleting Logical Volumes ... "; 00094 #endif 00095 00096 for(iterator pos=store->begin(); pos!=store->end(); pos++) 00097 { 00098 if (fgNotifier) { fgNotifier->NotifyDeRegistration(); } 00099 if (*pos) { (*pos)->Lock(); delete *pos; } 00100 i++; 00101 } 00102 00103 #ifdef G4GEOMETRY_VOXELDEBUG 00104 if (store->size() < i-1) 00105 { G4cout << "No volumes deleted. Already deleted by user ?" << G4endl; } 00106 else 00107 { G4cout << i-1 << " volumes deleted !" << G4endl; } 00108 #endif 00109 00110 locked = false; 00111 store->clear(); 00112 }
void G4LogicalVolumeStore::DeRegister | ( | G4LogicalVolume * | pVolume | ) | [static] |
Definition at line 138 of file G4LogicalVolumeStore.cc.
References GetInstance().
Referenced by G4LogicalVolume::~G4LogicalVolume().
00139 { 00140 if (!locked) // Do not de-register if locked ! 00141 { 00142 if (fgNotifier) { fgNotifier->NotifyDeRegistration(); } 00143 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++) 00144 { 00145 if (**i==*pVolume) 00146 { 00147 GetInstance()->erase(i); 00148 break; 00149 } 00150 } 00151 } 00152 }
G4LogicalVolumeStore * G4LogicalVolumeStore::GetInstance | ( | ) | [static] |
Definition at line 181 of file G4LogicalVolumeStore.cc.
Referenced by checkVol(), Clean(), DeRegister(), G4RadioactiveDecay::DeselectAVolume(), G4Region::GetParentRegion(), GetVolume(), G4GDMLReadStructure::GetVolume(), Register(), G4RadioactiveDecay::SelectAllVolumes(), G4RadioactiveDecay::SelectAVolume(), G4VVisCommandGeometrySet::Set(), G4VisCommandSceneAddLogicalVolume::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandGeometryList::SetNewValue(), G4GDMLMessenger::SetNewValue(), SetNotifier(), and G4GDMLRead::StripNames().
00182 { 00183 static G4LogicalVolumeStore worldStore; 00184 if (!fgInstance) 00185 { 00186 fgInstance = &worldStore; 00187 } 00188 return fgInstance; 00189 }
G4LogicalVolume * G4LogicalVolumeStore::GetVolume | ( | const G4String & | name, | |
G4bool | verbose = true | |||
) | const |
Definition at line 159 of file G4LogicalVolumeStore.cc.
References G4endl, G4Exception(), GetInstance(), and JustWarning.
Referenced by G4GDMLReadStructure::GetVolume(), and G4GDMLMessenger::SetNewValue().
00160 { 00161 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++) 00162 { 00163 if ((*i)->GetName() == name) { return *i; } 00164 } 00165 if (verbose) 00166 { 00167 std::ostringstream message; 00168 message << "Volume NOT found in store !" << G4endl 00169 << " Volume " << name << " NOT found in store !" << G4endl 00170 << " Returning NULL pointer."; 00171 G4Exception("G4LogicalVolumeStore::GetVolume()", 00172 "GeomMgt1001", JustWarning, message); 00173 } 00174 return 0; 00175 }
void G4LogicalVolumeStore::Register | ( | G4LogicalVolume * | pVolume | ) | [static] |
Definition at line 128 of file G4LogicalVolumeStore.cc.
References GetInstance(), and G4VNotifier::NotifyRegistration().
Referenced by G4LogicalVolume::G4LogicalVolume().
00129 { 00130 GetInstance()->push_back(pVolume); 00131 if (fgNotifier) { fgNotifier->NotifyRegistration(); } 00132 }
void G4LogicalVolumeStore::SetNotifier | ( | G4VStoreNotifier * | pNotifier | ) | [static] |
Definition at line 118 of file G4LogicalVolumeStore.cc.
References GetInstance().
00119 { 00120 GetInstance(); 00121 fgNotifier = pNotifier; 00122 }