Geant4-11
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//
27// ====================================================================
28// G4UIterminal.cc
29//
30// Description:
31//
32// This class inherits the class G4UIsession.
33// This is the class to use a character-terminal sesion.
34//
35// Usage:
36// G4UIsession* terminalSession = new G4UIterminal;
37// or G4UIsession* terminalSession = new G4UIterminal(new your-shell);
38//
39// A character-terminal session "terminalSession" is instantiated.
40// G4cout stream is redirected by default to the constructed instance.
41//
42// terminalSession-> SessionStart(); // "terminalSession" is started.
43// delete terminalSession; // "terminalSession" is deleted.
44//
45//
46// In default(no arguments are given), csh-like shell is instantiated.
47// If you want to use another shell (e.g. tcsh-like), you can give
48// your favorite shell in an argument of the constructor.
49//
50// Which shell? / How to define your own shell?
51// Currently two kinds of shells,
52// G4UIcsh / G4UItcsh
53// , are presented.
54// They inherit the abstract base class, G4VUIshell.
55// In order to define your own shell,
56// - Define your own shell class derived from G4VUIshell.
57// - Implement GetCommandLine() method (pure virtual).
58// - Add more functionality, if need.
59//
60// For more detail, see source codes.
61// ====================================================================
62#ifndef G4UIterminal_h
63#define G4UIterminal_h 1
64
65#include <fstream>
66#include "G4UImanager.hh"
67#include "G4VBasicShell.hh"
68#include "G4VUIshell.hh"
69
71private:
73 // shell
75
76 // program states
79
80public:
81 G4UIterminal(G4VUIshell* aShell=0, G4bool qsig=true);
83
84 void SetPrompt(const G4String& prompt);
85
86private:
87 virtual void ExecuteCommand(const G4String& aCommand);
88 virtual G4bool GetHelpChoice(G4int& aInt);
89 virtual void ExitHelp() const;
90 G4String GetCommand(const char* msg=0);
91
92public:
93 // These methods are implementation of corresponding virtual methods
94 // of G4UIsession class.
95 virtual G4UIsession* SessionStart();
96 virtual void PauseSessionStart(const G4String& msg);
97 virtual G4int ReceiveG4cout(const G4String& coutString);
98 virtual G4int ReceiveG4cerr(const G4String& cerrString);
99};
100
101#endif
102
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4VUIshell * shell
Definition: G4UIterminal.hh:74
void SetPrompt(const G4String &prompt)
virtual G4bool GetHelpChoice(G4int &aInt)
virtual G4int ReceiveG4cout(const G4String &coutString)
G4String GetCommand(const char *msg=0)
G4UIterminal(G4VUIshell *aShell=0, G4bool qsig=true)
Definition: G4UIterminal.cc:90
G4UImanager * UI
Definition: G4UIterminal.hh:72
virtual void PauseSessionStart(const G4String &msg)
virtual G4UIsession * SessionStart()
virtual void ExitHelp() const
virtual void ExecuteCommand(const G4String &aCommand)
virtual G4int ReceiveG4cerr(const G4String &cerrString)