Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:42

0001 /*
0002  * Copyright (c) 2019 Opticks Team. All Rights Reserved.
0003  *
0004  * This file is part of Opticks
0005  * (see https://bitbucket.org/simoncblyth/opticks).
0006  *
0007  * Licensed under the Apache License, Version 2.0 (the "License"); 
0008  * you may not use this file except in compliance with the License.  
0009  * You may obtain a copy of the License at
0010  *
0011  *   http://www.apache.org/licenses/LICENSE-2.0
0012  *
0013  * Unless required by applicable law or agreed to in writing, software 
0014  * distributed under the License is distributed on an "AS IS" BASIS, 
0015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0016  * See the License for the specific language governing permissions and 
0017  * limitations under the License.
0018  */
0019 
0020 #pragma once
0021 
0022 #include <string>
0023 #include "plog/Severity.h"
0024 #include "SYSRAP_API_EXPORT.hh"
0025 
0026 /** 
0027 SOpticksKey : THIS IS VERY OLD WORKFLOW : TODO: ELIMINATE
0028 ===========================================================
0029 
0030 Used to communicate the geometry identity digest
0031 to be used by Opticks instanciation (especually OpticksResource)
0032 without changing the Opticks interface.
0033 
0034 This is for example used with direct G4 to Opticks running, 
0035 where the geometry is translated.
0036 
0037 This class is needed because the OPTICKS_KEY in the environment 
0038 is not always appropriate to use, eg when translating geometry which 
0039 generates a new OPTICKS_KEY 
0040 
0041 Users::
0042 
0043     epsilon:CSG blyth$ opticks-f SOpticksKey.hh 
0044     ./sysrap/CMakeLists.txt:    SOpticksKey.hh
0045     ./sysrap/SOpticksResource.cc:#include "SOpticksKey.hh"
0046     ./sysrap/SOpticksKey.cc:#include "SOpticksKey.hh"
0047 
0048     ./extg4/X4PhysicalVolume.cc:#include "SOpticksKey.hh"
0049     ./sysrap/tests/SOpticksResourceTest.cc:#include "SOpticksKey.hh"
0050     ./sysrap/tests/SOpticksKeyTest.cc:#include "SOpticksKey.hh"
0051     ./optickscore/OpticksResource.cc:#include "SOpticksKey.hh"
0052     ./optickscore/Opticks.cc:#include "SOpticksKey.hh"
0053     ./boostrap/tests/BOpticksKeyTest.cc:#include "SOpticksKey.hh"
0054     ./boostrap/BOpticks.cc:#include "SOpticksKey.hh"
0055     ./boostrap/BOpticksResource.cc:#include "SOpticksKey.hh"
0056     epsilon:opticks blyth$ 
0057 
0058 **/
0059 
0060 class SYSRAP_API SOpticksKey 
0061 {
0062      private:
0063        static const plog::Severity  LEVEL ; 
0064       public:
0065         static const char* G4LIVE ; 
0066         static const char* IDSTEM ; 
0067         static const char* IDFILE ; 
0068         static const char* IDSUBD ; 
0069         static int         LAYOUT ; 
0070         static const char* LAYOUT_ ; 
0071         static bool         IsSet();
0072         static const char*  Key(); 
0073         static SOpticksKey* GetKey();
0074         static bool         SetKey(const char* spec=nullptr) ;  
0075         static void         Desc() ;  
0076         static const char* StemName( const char* ext, const char* sep="." );
0077     public:
0078         const char* getSpec() const ; 
0079         const char* getExename() const ; 
0080         const char* getClass() const ; 
0081         const char* getVolname() const ; 
0082         const char* getDigest() const ; 
0083     public:
0084         const char* getIdname() const ; 
0085         const char* getIdfile() const ; 
0086         const char* getIdGDML() const ; 
0087         const char* getIdsubd() const ; 
0088         int         getLayout() const ; 
0089         const char* getIdPath(const char* base) const ; 
0090     public:
0091         std::string desc() const ; 
0092         bool isKeySource() const ;   // current executable is direct geocache creator
0093         std::string export_() const ;
0094     public:
0095         static bool IsLive() ;
0096         bool        isLive() const ; 
0097     private:
0098         SOpticksKey(const char* spec); 
0099         void setLive(bool live) ; 
0100     private:
0101         const char* m_spec   ; 
0102 
0103         const char* m_exename ; 
0104         const char* m_class   ; 
0105         const char* m_volname   ; 
0106         const char* m_digest ;
0107 
0108         const char* m_idname ; // eg OpNovice_World_g4live
0109         const char* m_idfile ; // eg g4ok.gltf
0110         const char* m_idgdml ; // eg g4ok.gdml
0111         const char* m_idsubd ; // eg g4ok_gltf
0112         int         m_layout ; 
0113 
0114         const char* m_current_exename ;
0115         bool        m_live ; 
0116      
0117 
0118 
0119         static SOpticksKey* fKey ; 
0120 
0121 };