Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4NavigationLevelRep.icc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4NavigationLevelRep inline implementation
0027 //
0028 // 1 October 1997, J.Apostolakis Initial version
0029 // ----------------------------------------------------------------------
0030 
0031 extern G4GEOM_DLL G4Allocator<G4NavigationLevelRep>*& aNavigLevelRepAllocator();
0032 
0033 // Constructors
0034 //--------------
0035 
0036 inline
0037 G4NavigationLevelRep::G4NavigationLevelRep( G4VPhysicalVolume* pPhysVol,
0038                                       const G4AffineTransform& afTransform,
0039                                             EVolume            volTp,
0040                                             G4int              repNo )
0041    :  sTransform(afTransform),
0042       sPhysicalVolumePtr(pPhysVol),
0043       sReplicaNo(repNo),
0044       sVolumeType(volTp)
0045 {
0046 }
0047 
0048 inline
0049 G4NavigationLevelRep::G4NavigationLevelRep()
0050    :  sVolumeType(kReplica)
0051 {
0052 }
0053 
0054 inline
0055 G4NavigationLevelRep::G4NavigationLevelRep( G4VPhysicalVolume* pPhysVol,
0056                                       const G4AffineTransform& levelAbove,
0057                                       const G4AffineTransform& relativeCurrent,
0058                                             EVolume            volTp,
0059                                             G4int              repNo )
0060    :  sPhysicalVolumePtr(pPhysVol),
0061       sReplicaNo(repNo),
0062       sVolumeType(volTp)
0063 {
0064   sTransform.InverseProduct( levelAbove, relativeCurrent );
0065 }
0066 
0067 inline
0068 G4NavigationLevelRep::G4NavigationLevelRep( G4NavigationLevelRep& right )
0069    :  sTransform(right.sTransform), 
0070       sPhysicalVolumePtr(right.sPhysicalVolumePtr),
0071       sReplicaNo(right.sReplicaNo),
0072       sVolumeType(right.sVolumeType)
0073 {
0074 }
0075 
0076 // Destructor
0077 //--------------
0078 
0079 inline
0080 G4NavigationLevelRep::~G4NavigationLevelRep()
0081 {
0082 #ifdef DEBUG_NAVIG_LEVEL
0083   if(fCountRef>0)
0084   {
0085     G4Exception("G4NavigationLevelRep::~G4NavigationLevelRep()",
0086                 "GeomVol0003", FatalException,
0087                 "Deletion of data-level object with positive reference count.");
0088   } 
0089 #endif
0090 }
0091 
0092 // Operators
0093 // --------------
0094 
0095 inline
0096 G4NavigationLevelRep& 
0097 G4NavigationLevelRep::operator=( const G4NavigationLevelRep& right )
0098 {
0099   if ( &right != this )
0100   {
0101     sTransform = right.sTransform;  
0102     sPhysicalVolumePtr = right.sPhysicalVolumePtr;
0103     sVolumeType = right.sVolumeType;
0104     sReplicaNo =  right.sReplicaNo;
0105     fCountRef = right.fCountRef;
0106   }
0107   return *this;
0108 } 
0109 
0110 // Accessors
0111 // --------------
0112 
0113 inline
0114 G4VPhysicalVolume*
0115 G4NavigationLevelRep::GetPhysicalVolume()
0116 {
0117   return sPhysicalVolumePtr; 
0118 }
0119 
0120 inline
0121 const G4AffineTransform&
0122 G4NavigationLevelRep::GetTransform() const 
0123 {
0124   return sTransform; 
0125 } 
0126 
0127 inline
0128 const G4AffineTransform*
0129 G4NavigationLevelRep::GetTransformPtr() const 
0130 {
0131   return &sTransform; 
0132 } 
0133 
0134 inline
0135 EVolume G4NavigationLevelRep::GetVolumeType() const 
0136 {
0137   return sVolumeType; 
0138 }
0139 
0140 inline
0141 G4int G4NavigationLevelRep::GetReplicaNo() const 
0142 {
0143   return sReplicaNo; 
0144 }
0145 
0146 inline
0147 void G4NavigationLevelRep::AddAReference() 
0148 {
0149   ++fCountRef; 
0150 }
0151 
0152 inline
0153 G4bool G4NavigationLevelRep::RemoveAReference() 
0154 {
0155   return( --fCountRef <= 0 ); 
0156 }
0157 
0158 // There is no provision that this class is subclassed.
0159 // If it is subclassed & new data members are added then the
0160 // following "new" & "delete" will fail and give errors. 
0161 //
0162 inline
0163 void* G4NavigationLevelRep::operator new(size_t)
0164 {
0165   if (aNavigLevelRepAllocator() == nullptr)
0166   {
0167     aNavigLevelRepAllocator() = new G4Allocator<G4NavigationLevelRep>;
0168   }
0169   return (void *) aNavigLevelRepAllocator()->MallocSingle();
0170 }
0171 
0172 inline
0173 void G4NavigationLevelRep::operator delete(void* aLevelRep)
0174 {
0175   aNavigLevelRepAllocator()->FreeSingle((G4NavigationLevelRep *) aLevelRep);
0176 }