Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // =========================================== 27 // ==================================================================== 28 // G4UIExecutive.hh 28 // G4UIExecutive.hh 29 // 29 // 30 // This class helps automatic instantiation 30 // This class helps automatic instantiation of user session 31 // according to your environment variable li 31 // according to your environment variable like G4UI_USE_XXX. 32 // 32 // 33 // Usage in main(): 33 // Usage in main(): 34 // 34 // 35 // ... 35 // ... 36 // #include "G4UIExecutive.hh" 36 // #include "G4UIExecutive.hh" 37 // 37 // 38 // int main(int argc, char** argv) 38 // int main(int argc, char** argv) 39 // { 39 // { 40 // ... 40 // ... 41 // G4UIExecutive* myapp = new G4UIExecutiv 41 // G4UIExecutive* myapp = new G4UIExecutive(argc, argv); 42 // if (session->IsGUI()) 42 // if (session->IsGUI()) 43 // // Do any extra for a GUI session 43 // // Do any extra for a GUI session 44 // 44 // 45 // myapp-> SessionStart(); 45 // myapp-> SessionStart(); 46 // ... 46 // ... 47 // delete myapp; 47 // delete myapp; 48 // ... 48 // ... 49 // 49 // 50 // =========================================== 50 // ==================================================================== 51 #ifndef G4UI_EXECUTIVE_HH 51 #ifndef G4UI_EXECUTIVE_HH 52 #define G4UI_EXECUTIVE_HH 52 #define G4UI_EXECUTIVE_HH 53 53 54 #include "G4String.hh" << 55 #include "G4Types.hh" << 56 #include "G4VUIshell.hh" 54 #include "G4VUIshell.hh" 57 55 58 #include <map> 56 #include <map> 59 57 60 class G4UIsession; 58 class G4UIsession; 61 59 62 class G4UIExecutive 60 class G4UIExecutive 63 { 61 { 64 public: 62 public: 65 G4UIExecutive(G4int argc, char** argv, const 63 G4UIExecutive(G4int argc, char** argv, const G4String& type = ""); 66 ~G4UIExecutive(); 64 ~G4UIExecutive(); 67 65 68 G4UIsession* GetSession() const; 66 G4UIsession* GetSession() const; 69 67 70 G4bool IsGUI() const; 68 G4bool IsGUI() const; 71 69 72 void SetVerbose(G4bool val); 70 void SetVerbose(G4bool val); 73 71 74 void SetPrompt(const G4String& prompt); 72 void SetPrompt(const G4String& prompt); 75 void SetLsColor(TermColorIndex dirColor, Ter 73 void SetLsColor(TermColorIndex dirColor, TermColorIndex cmdColor); 76 74 77 void SessionStart(); 75 void SessionStart(); 78 76 79 private: 77 private: 80 void SelectSessionByArg(const G4String& styp 78 void SelectSessionByArg(const G4String& stype); 81 void SelectSessionByEnv(); 79 void SelectSessionByEnv(); 82 void SelectSessionByFile(const G4String& app 80 void SelectSessionByFile(const G4String& appname); 83 void SelectSessionByBestGuess(); 81 void SelectSessionByBestGuess(); 84 82 85 enum SessionType 83 enum SessionType 86 { 84 { 87 kNone, 85 kNone, 88 kQt, 86 kQt, 89 kXm, 87 kXm, 90 kWin32, 88 kWin32, 91 kTcsh, 89 kTcsh, 92 kCsh 90 kCsh 93 }; 91 }; 94 SessionType selected; 92 SessionType selected; 95 93 96 G4UIsession* session; 94 G4UIsession* session; 97 G4VUIshell* shell; 95 G4VUIshell* shell; 98 96 99 G4bool isGUI; 97 G4bool isGUI; 100 98 101 G4bool verbose; 99 G4bool verbose; 102 100 103 std::map<G4String, G4String> sessionMap; 101 std::map<G4String, G4String> sessionMap; 104 }; 102 }; 105 103 106 // =========================================== 104 // ==================================================================== 107 inline G4UIsession* G4UIExecutive::GetSession( 105 inline G4UIsession* G4UIExecutive::GetSession() const { return session; } 108 106 109 inline G4bool G4UIExecutive::IsGUI() const { r 107 inline G4bool G4UIExecutive::IsGUI() const { return isGUI; } 110 108 111 inline void G4UIExecutive::SetVerbose(G4bool v 109 inline void G4UIExecutive::SetVerbose(G4bool val) { verbose = val; } 112 110 113 #endif 111 #endif 114 112