2// ********************************************************************
3// * License and Disclaimer *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
26// G4NavigationLevelRep inline implementation
28// 1 October 1997, J.Apostolakis Initial version
29// ----------------------------------------------------------------------
31extern G4GEOM_DLL G4Allocator<G4NavigationLevelRep>*& aNavigLevelRepAllocator();
37G4NavigationLevelRep::G4NavigationLevelRep( G4VPhysicalVolume* pPhysVol,
38 const G4AffineTransform& afTransform,
41 : sTransform(afTransform),
42 sPhysicalVolumePtr(pPhysVol),
49G4NavigationLevelRep::G4NavigationLevelRep()
56G4NavigationLevelRep::G4NavigationLevelRep( G4VPhysicalVolume* pPhysVol,
57 const G4AffineTransform& levelAbove,
58 const G4AffineTransform& relativeCurrent,
61 : sPhysicalVolumePtr(pPhysVol),
65 sTransform.InverseProduct( levelAbove, relativeCurrent );
69G4NavigationLevelRep::G4NavigationLevelRep( G4NavigationLevelRep& right )
70 : sTransform(right.sTransform),
71 sPhysicalVolumePtr(right.sPhysicalVolumePtr),
72 sReplicaNo(right.sReplicaNo),
73 sVolumeType(right.sVolumeType)
81G4NavigationLevelRep::~G4NavigationLevelRep()
83#ifdef DEBUG_NAVIG_LEVEL
86 G4Exception("G4NavigationLevelRep::~G4NavigationLevelRep()",
87 "GeomVol0003", FatalException,
88 "Deletion of data-level object with positive reference count.");
98G4NavigationLevelRep::operator=( const G4NavigationLevelRep& right )
100 if ( &right != this )
102 sTransform = right.sTransform;
103 sPhysicalVolumePtr = right.sPhysicalVolumePtr;
104 sVolumeType = right.sVolumeType;
105 sReplicaNo = right.sReplicaNo;
106 fCountRef = right.fCountRef;
116G4NavigationLevelRep::GetPhysicalVolume()
118 return sPhysicalVolumePtr;
122const G4AffineTransform&
123G4NavigationLevelRep::GetTransform() const
129const G4AffineTransform*
130G4NavigationLevelRep::GetTransformPtr() const
136EVolume G4NavigationLevelRep::GetVolumeType() const
142G4int G4NavigationLevelRep::GetReplicaNo() const
148void G4NavigationLevelRep::AddAReference()
154G4bool G4NavigationLevelRep::RemoveAReference()
156 return( --fCountRef <= 0 );
159// There is no provision that this class is subclassed.
160// If it is subclassed & new data members are added then the
161// following "new" & "delete" will fail and give errors.
164void* G4NavigationLevelRep::operator new(size_t)
166 if (aNavigLevelRepAllocator() == nullptr)
168 aNavigLevelRepAllocator() = new G4Allocator<G4NavigationLevelRep>;
170 return (void *) aNavigLevelRepAllocator()->MallocSingle();
174void G4NavigationLevelRep::operator delete(void* aLevelRep)
176 aNavigLevelRepAllocator()->FreeSingle((G4NavigationLevelRep *) aLevelRep);