Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:10:00

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 // Author: Paul Kent (CERN), 12.07.1995 - Initial version
0038 // --------------------------------------------------------------------
0039 #ifndef G4SMARTVOXELPROXY_HH
0040 #define G4SMARTVOXELPROXY_HH
0041 
0042 #include <assert.h>
0043 
0044 #include "geomwdefs.hh"
0045 #include "G4Types.hh"
0046 
0047 class G4SmartVoxelNode;
0048 class G4SmartVoxelHeader;
0049 
0050 /**
0051  * @brief G4SmartVoxelProxy is a class for proxying smart voxels. The class
0052  * represents either a header (in turn referring to more VoxelProxies) or a
0053  * node. If created as a node, calls to GetHeader() cause an exception, and
0054  * likewise GetNode() when a header.
0055  */
0056 
0057 class G4SmartVoxelProxy 
0058 {
0059   public:
0060 
0061     /**
0062      * Constructs a Proxy for the specified header.
0063      *  @param[in] pHeader Pointer to the voxel header.
0064      */
0065     inline G4SmartVoxelProxy(G4SmartVoxelHeader* pHeader);
0066 
0067     /**
0068      * Constructs a Proxy for the specified node.
0069      *  @param[in] pNode Pointer to the voxel node.
0070      */
0071     inline G4SmartVoxelProxy(G4SmartVoxelNode* pNode);
0072 
0073     /**
0074      * Default destructor. Not responsible for proxied objects.
0075      */
0076     ~G4SmartVoxelProxy() = default;
0077 
0078     /**
0079      * Equality operator. True when objects share the same address.
0080      */
0081     inline G4bool operator == (const G4SmartVoxelProxy& v) const;
0082 
0083     /**
0084      * Returns true if proxying for a header, else false.
0085      */
0086     inline G4bool IsHeader() const;
0087 
0088     /**
0089      * Returns true if proxying for a node, else false.
0090      */
0091     inline G4bool IsNode() const;
0092 
0093     /**
0094      * Returns the pointer to the proxied node, else throws a G4Exception.
0095      */
0096     inline G4SmartVoxelNode* GetNode() const;
0097  
0098     /**
0099      * Returns the pointer to the proxied header, else throws a G4Exception.
0100      */
0101     inline G4SmartVoxelHeader* GetHeader() const;
0102 
0103   private:
0104 
0105     G4SmartVoxelHeader* fHeader = nullptr;
0106     G4SmartVoxelNode* fNode = nullptr;
0107 };
0108 
0109 #include "G4SmartVoxelProxy.icc"
0110 
0111 #endif