#include <G4SolidStore.hh>
Public Member Functions | |
G4VSolid * | GetSolid (const G4String &name, G4bool verbose=true) const |
virtual | ~G4SolidStore () |
Static Public Member Functions | |
static void | Register (G4VSolid *pSolid) |
static void | DeRegister (G4VSolid *pSolid) |
static G4SolidStore * | GetInstance () |
static void | SetNotifier (G4VStoreNotifier *pNotifier) |
static void | Clean () |
Protected Member Functions | |
G4SolidStore () |
Definition at line 62 of file G4SolidStore.hh.
G4SolidStore::~G4SolidStore | ( | ) | [virtual] |
G4SolidStore::G4SolidStore | ( | ) | [protected] |
void G4SolidStore::Clean | ( | ) | [static] |
Definition at line 73 of file G4SolidStore.cc.
References G4cout, G4endl, GetInstance(), and G4GeometryManager::GetInstance().
Referenced by G4GDMLMessenger::SetNewValue(), and ~G4SolidStore().
00074 { 00075 // Do nothing if geometry is closed 00076 // 00077 if (G4GeometryManager::GetInstance()->IsGeometryClosed()) 00078 { 00079 G4cout << "WARNING - Attempt to delete the solid store" 00080 << " while geometry closed !" << G4endl; 00081 return; 00082 } 00083 00084 // Locks store for deletion of solids. De-registration will be 00085 // performed at this stage. G4VSolids will not de-register themselves. 00086 // 00087 locked = true; 00088 00089 size_t i=0; 00090 G4SolidStore* store = GetInstance(); 00091 00092 #ifdef G4GEOMETRY_VOXELDEBUG 00093 G4cout << "Deleting Solids ... "; 00094 #endif 00095 00096 for(iterator pos=store->begin(); pos!=store->end(); pos++) 00097 { 00098 if (fgNotifier) { fgNotifier->NotifyDeRegistration(); } 00099 if (*pos) { delete *pos; } 00100 i++; 00101 } 00102 00103 #ifdef G4GEOMETRY_VOXELDEBUG 00104 if (store->size() < i-1) 00105 { G4cout << "No solids deleted. Already deleted by user ?" << G4endl; } 00106 else 00107 { G4cout << i-1 << " solids deleted !" << G4endl; } 00108 #endif 00109 00110 locked = false; 00111 store->clear(); 00112 }
void G4SolidStore::DeRegister | ( | G4VSolid * | pSolid | ) | [static] |
Definition at line 138 of file G4SolidStore.cc.
References GetInstance().
Referenced by G4SurfaceVoxelizer::G4SurfaceVoxelizer(), and G4VSolid::~G4VSolid().
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==*pSolid) 00146 { 00147 GetInstance()->erase(i); 00148 break; 00149 } 00150 } 00151 } 00152 }
G4SolidStore * G4SolidStore::GetInstance | ( | ) | [static] |
Definition at line 179 of file G4SolidStore.cc.
Referenced by Clean(), DeRegister(), G4SurfaceVoxelizer::G4SurfaceVoxelizer(), G4VSolid::G4VSolid(), GetSolid(), G4GDMLReadSolids::GetSolid(), Register(), SetNotifier(), G4GeometryManager::SetWorldMaximumExtent(), G4GDMLRead::StripNames(), and G4VSolid::~G4VSolid().
00180 { 00181 static G4SolidStore worldStore; 00182 if (!fgInstance) 00183 { 00184 fgInstance = &worldStore; 00185 } 00186 return fgInstance; 00187 }
Definition at line 158 of file G4SolidStore.cc.
References G4endl, G4Exception(), GetInstance(), and JustWarning.
Referenced by G4GDMLReadSolids::GetSolid().
00159 { 00160 for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++) 00161 { 00162 if ((*i)->GetName() == name) { return *i; } 00163 } 00164 if (verbose) 00165 { 00166 std::ostringstream message; 00167 message << "Solid " << name << " not found in store !" << G4endl 00168 << "Returning NULL pointer."; 00169 G4Exception("G4SolidStore::GetSolid()", 00170 "GeomMgt1001", JustWarning, message); 00171 } 00172 return 0; 00173 }
void G4SolidStore::Register | ( | G4VSolid * | pSolid | ) | [static] |
Definition at line 128 of file G4SolidStore.cc.
References GetInstance(), and G4VNotifier::NotifyRegistration().
Referenced by G4VSolid::G4VSolid().
00129 { 00130 GetInstance()->push_back(pSolid); 00131 if (fgNotifier) { fgNotifier->NotifyRegistration(); } 00132 }
void G4SolidStore::SetNotifier | ( | G4VStoreNotifier * | pNotifier | ) | [static] |
Definition at line 118 of file G4SolidStore.cc.
References GetInstance().
00119 { 00120 GetInstance(); 00121 fgNotifier = pNotifier; 00122 }