Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:05

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 // G4SmartVoxelProxy
0027 //
0028 // Class description:
0029 //
0030 // Class for proxying smart voxels. The class represents either a header
0031 // (in turn refering to more VoxelProxies) or a node. If created as a node,
0032 // calls to GetHeader cause an exception, and likewise GetNode when a header.
0033 //
0034 // Note that the proxy does NOT gain deletion responsibility for proxied
0035 // objects.
0036 
0037 // 12.07.95, P.Kent - Initial version
0038 // --------------------------------------------------------------------
0039 #ifndef G4SMARTVOXELPROXY_HH
0040 #define G4SMARTVOXELPROXY_HH 1
0041 
0042 #include <assert.h>
0043 
0044 #include "geomwdefs.hh"
0045 #include "G4Types.hh"
0046 #include "G4Allocator.hh"
0047 
0048 class G4SmartVoxelNode;
0049 class G4SmartVoxelHeader;
0050 
0051 class G4SmartVoxelProxy 
0052 {
0053 
0054   public:
0055 
0056     G4SmartVoxelProxy(G4SmartVoxelHeader *pHeader)
0057       : fHeader(pHeader) {}
0058       // Proxy for the specified header.
0059 
0060     G4SmartVoxelProxy(G4SmartVoxelNode *pNode)
0061       : fNode(pNode) {}
0062       // Proxy for the specified node.
0063 
0064     ~G4SmartVoxelProxy() = default;
0065       // Destructor - do nothing. Not responsible for proxied objects.
0066 
0067     G4bool IsHeader() const;
0068       // Return true if proxying for a header, else false.
0069 
0070     G4bool IsNode() const;
0071       // Return true if proxying for a node, else false.
0072 
0073     G4SmartVoxelNode* GetNode() const;
0074       // Return ptr to proxied node, else call G4Exception.
0075 
0076     G4SmartVoxelHeader* GetHeader() const;
0077       // Return ptr to proxied header, else call G4Exception
0078 
0079     G4bool operator == (const G4SmartVoxelProxy& v) const;
0080       // Equality operator.
0081       // True when objects share same address.
0082 
0083     inline void* operator new(std::size_t);
0084       // Override "new" for "G4Allocator".
0085     inline void operator delete(void* aProxy);
0086       // Override "delete" for "G4Allocator".
0087 
0088   private:
0089 
0090     G4SmartVoxelHeader* fHeader = nullptr;
0091     G4SmartVoxelNode* fNode = nullptr;
0092 };
0093 
0094 #include "G4SmartVoxelProxy.icc"
0095 
0096 #endif