|
||||
File indexing completed on 2025-01-18 09:59:16
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 // 0027 // ==================================================================== 0028 // G4UIterminal.cc 0029 // 0030 // Description: 0031 // 0032 // This class inherits the class G4UIsession. 0033 // This is the class to use a character-terminal sesion. 0034 // 0035 // Usage: 0036 // G4UIsession* terminalSession = new G4UIterminal; 0037 // or G4UIsession* terminalSession = new G4UIterminal(new your-shell); 0038 // 0039 // A character-terminal session "terminalSession" is instantiated. 0040 // G4cout stream is redirected by default to the constructed instance. 0041 // 0042 // terminalSession-> SessionStart(); // "terminalSession" is started. 0043 // delete terminalSession; // "terminalSession" is deleted. 0044 // 0045 // 0046 // In default(no arguments are given), csh-like shell is instantiated. 0047 // If you want to use another shell (e.g. tcsh-like), you can give 0048 // your favorite shell in an argument of the constructor. 0049 // 0050 // Which shell? / How to define your own shell? 0051 // Currently two kinds of shells, 0052 // G4UIcsh / G4UItcsh 0053 // , are presented. 0054 // They inherit the abstract base class, G4VUIshell. 0055 // In order to define your own shell, 0056 // - Define your own shell class derived from G4VUIshell. 0057 // - Implement GetCommandLine() method (pure virtual). 0058 // - Add more functionality, if need. 0059 // 0060 // For more detail, see source codes. 0061 // ==================================================================== 0062 #ifndef G4UIterminal_h 0063 #define G4UIterminal_h 1 0064 0065 #include "G4UImanager.hh" 0066 #include "G4VBasicShell.hh" 0067 #include "G4VUIshell.hh" 0068 0069 #include <fstream> 0070 0071 class G4UIterminal : public G4VBasicShell 0072 { 0073 public: 0074 G4UIterminal(G4VUIshell* aShell = nullptr, G4bool qsig = true); 0075 ~G4UIterminal() override; 0076 0077 void SetPrompt(const G4String& prompt); 0078 0079 // These methods are implementation of corresponding virtual methods 0080 // of G4UIsession class. 0081 G4UIsession* SessionStart() override; 0082 void PauseSessionStart(const G4String& msg) override; 0083 G4int ReceiveG4debug(const G4String& debugString) override; 0084 G4int ReceiveG4cout(const G4String& coutString) override; 0085 G4int ReceiveG4cerr(const G4String& cerrString) override; 0086 0087 private: 0088 void ExecuteCommand(const G4String& aCommand) override; 0089 G4bool GetHelpChoice(G4int& aInt) override; 0090 void ExitHelp() const override; 0091 G4String GetCommand(const char* msg = nullptr); 0092 0093 private: 0094 G4UImanager* UI; 0095 // shell 0096 G4VUIshell* shell; 0097 0098 // program states 0099 G4bool iExit; 0100 G4bool iCont; 0101 }; 0102 0103 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |