#include <G4UIbatch.hh>
Inheritance diagram for G4UIbatch:
Public Member Functions | |
G4UIbatch (const char *fileName, G4UIsession *prevSession=0) | |
~G4UIbatch () | |
G4UIsession * | GetPreviousSession () const |
virtual G4UIsession * | SessionStart () |
virtual void | PauseSessionStart (const G4String &Prompt) |
Definition at line 51 of file G4UIbatch.hh.
G4UIbatch::G4UIbatch | ( | const char * | fileName, | |
G4UIsession * | prevSession = 0 | |||
) |
Definition at line 69 of file G4UIbatch.cc.
References G4cerr, G4endl, and G4UImanager::GetUIpointer().
00070 : previousSession(prevSession), isOpened(false) 00072 { 00073 macroStream.open(fileName, std::ios::in); 00074 if(macroStream.fail()) { 00075 G4cerr << "***** Can not open a macro file <" 00076 << fileName << ">" 00077 << G4endl; 00078 } else { 00079 isOpened= true; 00080 } 00081 00082 G4UImanager::GetUIpointer()-> SetSession(this); 00083 }
G4UIbatch::~G4UIbatch | ( | ) |
G4UIsession * G4UIbatch::GetPreviousSession | ( | ) | const [inline] |
void G4UIbatch::PauseSessionStart | ( | const G4String & | Prompt | ) | [virtual] |
Reimplemented from G4UIsession.
Definition at line 227 of file G4UIbatch.cc.
References G4cout, G4endl, and SessionStart().
00229 { 00230 G4cout << "Pause session <" << Prompt << "> start." << G4endl; 00231 00232 SessionStart(); 00233 00234 G4cout << "Pause session <" << Prompt << "> Terminate." << G4endl; 00235 }
G4UIsession * G4UIbatch::SessionStart | ( | ) | [virtual] |
Reimplemented from G4UIsession.
Definition at line 194 of file G4UIbatch.cc.
References fCommandSucceeded, G4cerr, G4cout, G4endl, and G4UImanager::GetUIpointer().
Referenced by PauseSessionStart().
00196 { 00197 if(!isOpened) return previousSession; 00198 00199 while(1) { 00200 G4String newCommand = ReadCommand(); 00201 00202 if(newCommand == "exit") { 00203 break; 00204 } 00205 00206 // just echo something 00207 if( newCommand[(size_t)0] == '#') { 00208 if(G4UImanager::GetUIpointer()-> GetVerboseLevel()==2) { 00209 G4cout << newCommand << G4endl; 00210 } 00211 continue; 00212 } 00213 00214 // execute command 00215 G4int rc= ExecCommand(newCommand); 00216 if(rc != fCommandSucceeded) { 00217 G4cerr << G4endl << "***** Batch is interrupted!! *****" << G4endl; 00218 break; 00219 } 00220 } 00221 00222 return previousSession; 00223 }