Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4UIbatch Class Reference

#include <G4UIbatch.hh>

Inheritance diagram for G4UIbatch:
Collaboration diagram for G4UIbatch:

Public Member Functions

 G4UIbatch (const char *fileName, G4UIsession *prevSession=0)
 
 ~G4UIbatch ()
 
G4UIsessionGetPreviousSession () const
 
virtual G4UIsessionSessionStart ()
 
virtual void PauseSessionStart (const G4String &Prompt)
 
- Public Member Functions inherited from G4UIsession
 G4UIsession ()
 
 G4UIsession (G4int iBatch)
 
virtual ~G4UIsession ()
 
virtual G4int ReceiveG4cout (const G4String &coutString)
 
virtual G4int ReceiveG4cerr (const G4String &cerrString)
 
- Public Member Functions inherited from G4coutDestination
 G4coutDestination ()
 
virtual ~G4coutDestination ()
 

Additional Inherited Members

- Static Public Member Functions inherited from G4UIsession
static G4int InSession ()
 
- Protected Attributes inherited from G4UIsession
G4int ifBatch
 
- Static Protected Attributes inherited from G4UIsession
static G4int inSession = 0
 
- Static Protected Attributes inherited from G4coutDestination
static G4coutDestinationmasterG4coutDestination = 0
 

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.

70  : G4UIsession(1),
71  previousSession(prevSession), isOpened(false)
73 {
74  macroStream.open(fileName, std::ios::in);
75  if(macroStream.fail()) {
76  G4cerr << "ERROR: Can not open a macro file <"
77  << fileName << ">. Set macro path with \"/control/macroPath\" if needed."
78  << G4endl;
79  } else {
80  isOpened= true;
81  }
82 
83  G4UImanager::GetUIpointer()-> SetSession(this);
84 }
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

G4UIbatch::~G4UIbatch ( )

Definition at line 88 of file G4UIbatch.cc.

90 {
91  if(isOpened) macroStream.close();
92 }

Member Function Documentation

G4UIsession * G4UIbatch::GetPreviousSession ( ) const
inline

Definition at line 81 of file G4UIbatch.hh.

82 {
83  return previousSession;
84 }
void G4UIbatch::PauseSessionStart ( const G4String Prompt)
virtual

Reimplemented from G4UIsession.

Definition at line 228 of file G4UIbatch.cc.

230 {
231  G4cout << "Pause session <" << Prompt << "> start." << G4endl;
232 
233  SessionStart();
234 
235  G4cout << "Pause session <" << Prompt << "> Terminate." << G4endl;
236 }
virtual G4UIsession * SessionStart()
Definition: G4UIbatch.cc:195
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4UIsession * G4UIbatch::SessionStart ( )
virtual

Reimplemented from G4UIsession.

Definition at line 195 of file G4UIbatch.cc.

197 {
198  if(!isOpened) return previousSession;
199 
200  while(1) {
201  G4String newCommand = ReadCommand();
202 
203  if(newCommand == "exit") {
204  break;
205  }
206 
207  // just echo something
208  if( newCommand[(size_t)0] == '#') {
209  if(G4UImanager::GetUIpointer()-> GetVerboseLevel()==2) {
210  G4cout << newCommand << G4endl;
211  }
212  continue;
213  }
214 
215  // execute command
216  G4int rc= ExecCommand(newCommand);
217  if(rc != fCommandSucceeded) {
218  G4cerr << G4endl << "***** Batch is interrupted!! *****" << G4endl;
219  break;
220  }
221  }
222 
223  return previousSession;
224 }
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:


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