Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UIterminal Class Reference

#include <G4UIterminal.hh>

+ Inheritance diagram for G4UIterminal:

Public Member Functions

 G4UIterminal (G4VUIshell *aShell=nullptr, G4bool qsig=true)
 
 ~G4UIterminal () override
 
void SetPrompt (const G4String &prompt)
 
G4UIsessionSessionStart () override
 
void PauseSessionStart (const G4String &msg) override
 
G4int ReceiveG4debug (const G4String &debugString) override
 
G4int ReceiveG4cout (const G4String &coutString) override
 
G4int ReceiveG4cerr (const G4String &cerrString) override
 
- Public Member Functions inherited from G4VBasicShell
 G4VBasicShell ()
 
 ~G4VBasicShell () override
 
- Public Member Functions inherited from G4UIsession
 G4UIsession ()
 
 G4UIsession (G4int iBatch)
 
 ~G4UIsession () override
 
G4int GetLastReturnCode () const
 
- Public Member Functions inherited from G4coutDestination
 G4coutDestination ()=default
 
virtual ~G4coutDestination ()=default
 
void AddDebugTransformer (const Transformer &t)
 
void AddDebugTransformer (Transformer &&t)
 
void AddCoutTransformer (const Transformer &t)
 
void AddCoutTransformer (Transformer &&t)
 
void AddCerrTransformer (const Transformer &t)
 
void AddCerrTransformer (Transformer &&t)
 
virtual void ResetTransformers ()
 
G4int ReceiveG4debug_ (const G4String &msg)
 
G4int ReceiveG4cout_ (const G4String &msg)
 
G4int ReceiveG4cerr_ (const G4String &msg)
 

Additional Inherited Members

- Public Types inherited from G4coutDestination
using Transformer = std::function<G4bool(G4String&)>
 
- Static Public Member Functions inherited from G4UIsession
static G4int InSession ()
 
- Protected Member Functions inherited from G4VBasicShell
G4String ModifyToFullPathCommand (const char *aCommandLine) const
 
G4String GetCurrentWorkingDirectory () const
 
G4bool ChangeDirectory (const char *newDir)
 
G4UIcommandTreeFindDirectory (const char *dirName) const
 
G4UIcommandFindCommand (const char *commandName) const
 
G4String Complete (const G4String &)
 
G4String FindMatchingPath (G4UIcommandTree *, const G4String &)
 
void ApplyShellCommand (const G4String &, G4bool &, G4bool &)
 
void ShowCurrent (const G4String &) const
 
void ChangeDirectoryCommand (const G4String &)
 
void ListDirectory (const G4String &) const
 
void TerminalHelp (const G4String &)
 
- Protected Attributes inherited from G4UIsession
G4int ifBatch = 0
 
G4int lastRC = 0
 
- Protected Attributes inherited from G4coutDestination
std::vector< TransformertransformersDebug
 
std::vector< TransformertransformersCout
 
std::vector< TransformertransformersCerr
 
- Static Protected Attributes inherited from G4UIsession
static G4ICOMS_DLL G4int inSession = 0
 
- Static Protected Attributes inherited from G4coutDestination
static G4MTGLOB_DLL G4coutDestinationmasterG4coutDestination = nullptr
 

Detailed Description

Definition at line 71 of file G4UIterminal.hh.

Constructor & Destructor Documentation

◆ G4UIterminal()

G4UIterminal::G4UIterminal ( G4VUIshell * aShell = nullptr,
G4bool qsig = true )

Definition at line 89 of file G4UIterminal.cc.

91{
93 UI->SetSession(this);
94 UI->SetCoutDestination(this);
95
96 iExit = false;
97 iCont = false;
98
99 if (aShell != nullptr)
100 shell = aShell;
101 else
102 shell = new G4UIcsh;
103 theshell = shell; // locally stored for the signal handler
104
105 // add signal handler
106 if (qsig) {
107#ifndef WIN32
108 signal(SIGINT, SignalHandler);
109#endif
110 }
111}
void SetCoutDestination(G4UIsession *const value)
static G4UImanager * GetUIpointer()
void SetSession(G4UIsession *const value)

◆ ~G4UIterminal()

G4UIterminal::~G4UIterminal ( )
override

Definition at line 114 of file G4UIterminal.cc.

116{
117 delete shell;
118
119 if (G4UImanager::GetUIpointer() != nullptr) {
120 UI->SetSession(nullptr);
121 UI->SetCoutDestination(nullptr);
122 }
123}

Member Function Documentation

◆ PauseSessionStart()

void G4UIterminal::PauseSessionStart ( const G4String & msg)
overridevirtual

Implements G4VBasicShell.

Definition at line 147 of file G4UIterminal.cc.

149{
150 iCont = true;
151
152 G4String newCommand = GetCommand(msg);
153 while (iCont) {
154 ExecuteCommand(newCommand);
155 newCommand = GetCommand(msg);
156 }
157}

◆ ReceiveG4cerr()

G4int G4UIterminal::ReceiveG4cerr ( const G4String & cerrString)
overridevirtual

Reimplemented from G4UIsession.

Definition at line 324 of file G4UIterminal.cc.

326{
327 std::cerr << cerrString << std::flush;
328 return 0;
329}

◆ ReceiveG4cout()

G4int G4UIterminal::ReceiveG4cout ( const G4String & coutString)
overridevirtual

Reimplemented from G4UIsession.

Definition at line 316 of file G4UIterminal.cc.

318{
319 std::cout << coutString << std::flush;
320 return 0;
321}

◆ ReceiveG4debug()

G4int G4UIterminal::ReceiveG4debug ( const G4String & debugString)
overridevirtual

Reimplemented from G4UIsession.

Definition at line 308 of file G4UIterminal.cc.

310{
311 std::cout << debugString << std::flush;
312 return 0;
313}

◆ SessionStart()

G4UIsession * G4UIterminal::SessionStart ( )
overridevirtual

Implements G4VBasicShell.

Definition at line 133 of file G4UIterminal.cc.

135{
136 iExit = true;
137
138 G4String newCommand = GetCommand();
139 while (iExit) {
140 ExecuteCommand(newCommand);
141 newCommand = GetCommand();
142 }
143 return nullptr;
144}

◆ SetPrompt()

void G4UIterminal::SetPrompt ( const G4String & prompt)

Definition at line 126 of file G4UIterminal.cc.

128{
129 shell->SetPrompt(prompt);
130}
void SetPrompt(const G4String &prompt)

The documentation for this class was generated from the following files: