00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // class G4SmartVoxelProxy 00030 // 00031 // Class description: 00032 // 00033 // Class for proxying smart voxels. The class represents either a header 00034 // (in turn refering to more VoxelProxies) or a node. If created as a node, 00035 // calls to GetHeader cause an exception, and likewise GetNode when a header. 00036 // 00037 // Note that the proxy does NOT gain deletion responsibility for proxied 00038 // objects. 00039 00040 // History: 00041 // 12.07.95 P.Kent Initial version 00042 // 03.08.95 P.Kent Updated to become non abstract class, removing 00043 // HeaderProxy and NodeProxy derived classes 00044 // -------------------------------------------------------------------- 00045 #ifndef G4SMARTVOXELPROXY_HH 00046 #define G4SMARTVOXELPROXY_HH 00047 00048 #include "G4Types.hh" 00049 #include <assert.h> 00050 00051 class G4SmartVoxelNode; 00052 class G4SmartVoxelHeader; 00053 00054 class G4SmartVoxelProxy 00055 { 00056 00057 public: // with description 00058 00059 G4SmartVoxelProxy(G4SmartVoxelHeader *pHeader) 00060 : fHeader(pHeader), fNode(0) {} 00061 // Proxy for the specified header. 00062 00063 G4SmartVoxelProxy(G4SmartVoxelNode *pNode) 00064 : fHeader(0), fNode(pNode) {} 00065 // Proxy for the specified node. 00066 00067 ~G4SmartVoxelProxy(); 00068 // Destructor - do nothing. Not responsible for proxied objects. 00069 00070 G4bool IsHeader() const; 00071 // Return true if proxying for a header, else false. 00072 00073 G4bool IsNode() const; 00074 // Return true if proxying for a node, else false. 00075 00076 G4SmartVoxelNode* GetNode() const; 00077 // Return ptr to proxied node, else call G4Exception. 00078 00079 G4SmartVoxelHeader* GetHeader() const; 00080 // Return ptr to proxied header, else call G4Exception 00081 00082 G4bool operator == (const G4SmartVoxelProxy& v) const; 00083 // Equality operator. 00084 // True when objects share same address. 00085 00086 private: 00087 00088 G4SmartVoxelHeader* fHeader; 00089 G4SmartVoxelNode* fNode; 00090 }; 00091 00092 #include "G4SmartVoxelProxy.icc" 00093 00094 #endif