Geant4_10
G4UIterminal.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4UIterminal.hh 66892 2013-01-17 10:57:59Z gunter $
27 //
28 // ====================================================================
29 // G4UIterminal.cc
30 //
31 // Description:
32 //
33 // This class inherits the class G4UIsession.
34 // This is the class to use a character-terminal sesion.
35 //
36 // Usage:
37 // G4UIsession* terminalSession = new G4UIterminal;
38 // or G4UIsession* terminalSession = new G4UIterminal(new your-shell);
39 //
40 // A character-terminal session "terminalSession" is instantiated.
41 // G4cout stream is redirected by default to the constructed instance.
42 //
43 // terminalSession-> SessionStart(); // "terminalSession" is started.
44 // delete terminalSession; // "terminalSession" is deleted.
45 //
46 //
47 // In default(no arguments are given), csh-like shell is instantiated.
48 // If you want to use another shell (e.g. tcsh-like), you can give
49 // your favorite shell in an argument of the constructor.
50 //
51 // Which shell? / How to define your own shell?
52 // Currently two kinds of shells,
53 // G4UIcsh / G4UItcsh
54 // , are presented.
55 // They inherit the abstract base class, G4VUIshell.
56 // In order to define your own shell,
57 // - Define your own shell class derived from G4VUIshell.
58 // - Implement GetCommandLine() method (pure virtual).
59 // - Add more functionality, if need.
60 //
61 // For more detail, see source codes.
62 // ====================================================================
63 #ifndef G4UIterminal_h
64 #define G4UIterminal_h 1
65 
66 #include <fstream>
67 #include "G4UImanager.hh"
68 #include "G4VBasicShell.hh"
69 #include "G4VUIshell.hh"
70 
71 class G4UIterminal : public G4VBasicShell {
72 private:
73  G4UImanager* UI;
74  // shell
75  G4VUIshell* shell;
76 
77  // program states
78  G4bool iExit;
79  G4bool iCont;
80 
81 public:
82  G4UIterminal(G4VUIshell* aShell=0, G4bool qsig=true);
83  ~G4UIterminal();
84 
85  void SetPrompt(const G4String& prompt);
86 
87 private:
88  virtual void ExecuteCommand(const G4String& aCommand);
89  virtual G4bool GetHelpChoice(G4int& aInt);
90  virtual void ExitHelp() const;
91  G4String GetCommand(const char* msg=0);
92 
93 public:
94  // These methods are implementation of corresponding virtual methods
95  // of G4UIsession class.
96  virtual G4UIsession* SessionStart();
97  virtual void PauseSessionStart(const G4String& msg);
98  virtual G4int ReceiveG4cout(const G4String& coutString);
99  virtual G4int ReceiveG4cerr(const G4String& cerrString);
100 };
101 
102 #endif
103 
virtual G4int ReceiveG4cout(const G4String &coutString)
virtual G4int ReceiveG4cerr(const G4String &cerrString)
int G4int
Definition: G4Types.hh:78
void SetPrompt(const G4String &prompt)
virtual void PauseSessionStart(const G4String &msg)
bool G4bool
Definition: G4Types.hh:79
G4UIterminal(G4VUIshell *aShell=0, G4bool qsig=true)
Definition: G4UIterminal.cc:91
virtual G4UIsession * SessionStart()