Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4LogicalVolumeStore Class Reference

#include <G4LogicalVolumeStore.hh>

Inheritance diagram for G4LogicalVolumeStore:
Collaboration diagram for G4LogicalVolumeStore:

Public Member Functions

G4LogicalVolumeGetVolume (const G4String &name, G4bool verbose=true) const
 
virtual ~G4LogicalVolumeStore ()
 

Static Public Member Functions

static void Register (G4LogicalVolume *pVolume)
 
static void DeRegister (G4LogicalVolume *pVolume)
 
static G4LogicalVolumeStoreGetInstance ()
 
static void SetNotifier (G4VStoreNotifier *pNotifier)
 
static void Clean ()
 

Protected Member Functions

 G4LogicalVolumeStore ()
 

Detailed Description

Definition at line 62 of file G4LogicalVolumeStore.hh.

Constructor & Destructor Documentation

G4LogicalVolumeStore::~G4LogicalVolumeStore ( )
virtual

Definition at line 64 of file G4LogicalVolumeStore.cc.

65 {
66  Clean();
67 }

Here is the call graph for this function:

G4LogicalVolumeStore::G4LogicalVolumeStore ( )
protected

Definition at line 54 of file G4LogicalVolumeStore.cc.

55  : std::vector<G4LogicalVolume*>()
56 {
57  reserve(100);
58 }

Member Function Documentation

void G4LogicalVolumeStore::Clean ( )
static

Definition at line 73 of file G4LogicalVolumeStore.cc.

74 {
75  // Do nothing if geometry is closed
76  //
77  if (G4GeometryManager::GetInstance()->IsGeometryClosed())
78  {
79  G4cout << "WARNING - Attempt to delete the logical volume store"
80  << " while geometry closed !" << G4endl;
81  return;
82  }
83 
84  // Locks store for deletion of volumes. De-registration will be
85  // performed at this stage. G4LogicalVolumes will not de-register themselves.
86  //
87  locked = true;
88 
89  size_t i=0;
91 
92 #ifdef G4GEOMETRY_VOXELDEBUG
93  G4cout << "Deleting Logical Volumes ... ";
94 #endif
95 
96  for(iterator pos=store->begin(); pos!=store->end(); pos++)
97  {
98  if (fgNotifier) { fgNotifier->NotifyDeRegistration(); }
99  if (*pos) { (*pos)->Lock(); delete *pos; }
100  i++;
101  }
102 
103 #ifdef G4GEOMETRY_VOXELDEBUG
104  if (store->size() < i-1)
105  { G4cout << "No volumes deleted. Already deleted by user ?" << G4endl; }
106  else
107  { G4cout << i-1 << " volumes deleted !" << G4endl; }
108 #endif
109 
110  locked = false;
111  store->clear();
112 }
virtual void NotifyDeRegistration()=0
G4GLOB_DLL std::ostream G4cout
static G4LogicalVolumeStore * GetInstance()
static G4GeometryManager * GetInstance()
#define G4endl
Definition: G4ios.hh:61
static const G4double pos

Here is the call graph for this function:

Here is the caller graph for this function:

void G4LogicalVolumeStore::DeRegister ( G4LogicalVolume pVolume)
static

Definition at line 138 of file G4LogicalVolumeStore.cc.

139 {
140  if (!locked) // Do not de-register if locked !
141  {
142  if (fgNotifier) { fgNotifier->NotifyDeRegistration(); }
143  for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
144  {
145  if (**i==*pVolume)
146  {
147  GetInstance()->erase(i);
148  break;
149  }
150  }
151  }
152 }
virtual void NotifyDeRegistration()=0
static G4LogicalVolumeStore * GetInstance()

Here is the call graph for this function:

Here is the caller graph for this function:

G4LogicalVolumeStore * G4LogicalVolumeStore::GetInstance ( )
static

Definition at line 181 of file G4LogicalVolumeStore.cc.

182 {
183  static G4LogicalVolumeStore worldStore;
184  if (!fgInstance)
185  {
186  fgInstance = &worldStore;
187  }
188  return fgInstance;
189 }

Here is the caller graph for this function:

G4LogicalVolume * G4LogicalVolumeStore::GetVolume ( const G4String name,
G4bool  verbose = true 
) const

Definition at line 159 of file G4LogicalVolumeStore.cc.

160 {
161  for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
162  {
163  if ((*i)->GetName() == name) { return *i; }
164  }
165  if (verbose)
166  {
167  std::ostringstream message;
168  message << "Volume NOT found in store !" << G4endl
169  << " Volume " << name << " NOT found in store !" << G4endl
170  << " Returning NULL pointer.";
171  G4Exception("G4LogicalVolumeStore::GetVolume()",
172  "GeomMgt1001", JustWarning, message);
173  }
174  return 0;
175 }
const XML_Char * name
Definition: expat.h:151
static G4LogicalVolumeStore * GetInstance()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4LogicalVolumeStore::Register ( G4LogicalVolume pVolume)
static

Definition at line 128 of file G4LogicalVolumeStore.cc.

129 {
130  GetInstance()->push_back(pVolume);
131  if (fgNotifier) { fgNotifier->NotifyRegistration(); }
132 }
static G4LogicalVolumeStore * GetInstance()
virtual void NotifyRegistration()=0

Here is the call graph for this function:

Here is the caller graph for this function:

void G4LogicalVolumeStore::SetNotifier ( G4VStoreNotifier pNotifier)
static

Definition at line 118 of file G4LogicalVolumeStore.cc.

119 {
120  GetInstance();
121  fgNotifier = pNotifier;
122 }
static G4LogicalVolumeStore * GetInstance()

Here is the call graph for this function:


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