G4UIbatch Class Reference

#include <G4UIbatch.hh>

Inheritance diagram for G4UIbatch:

G4UIsession G4coutDestination

Public Member Functions

 G4UIbatch (const char *fileName, G4UIsession *prevSession=0)
 ~G4UIbatch ()
G4UIsessionGetPreviousSession () const
virtual G4UIsessionSessionStart ()
virtual void PauseSessionStart (const G4String &Prompt)

Detailed Description

Definition at line 51 of file G4UIbatch.hh.


Constructor & Destructor Documentation

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 (  ) 

Definition at line 87 of file G4UIbatch.cc.

00089 {
00090   if(isOpened) macroStream.close();
00091 }


Member Function Documentation

G4UIsession * G4UIbatch::GetPreviousSession (  )  const [inline]

Definition at line 81 of file G4UIbatch.hh.

00082 {
00083   return previousSession;
00084 }

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 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:36 2013 for Geant4 by  doxygen 1.4.7