G4UIExecutive Class Reference

#include <G4UIExecutive.hh>


Public Member Functions

 G4UIExecutive (G4int argc, char **argv, const G4String &type="")
 ~G4UIExecutive ()
G4UIsessionGetSession () const
G4bool IsGUI () const
void SetPrompt (const G4String &prompt)
void SetLsColor (TermColorIndex dirColor, TermColorIndex cmdColor)
void SessionStart ()


Detailed Description

Definition at line 60 of file G4UIExecutive.hh.


Constructor & Destructor Documentation

G4UIExecutive::G4UIExecutive ( G4int  argc,
char **  argv,
const G4String type = "" 
)

Definition at line 90 of file G4UIExecutive.cc.

References DISCARD_PARAMETER, G4cout, G4endl, G4Exception(), JustWarning, and G4String::toLower().

00091   : selected(kNone), session(NULL), shell(NULL), isGUI(false)
00092 {
00093   G4cout << "Available UI session types: [ ";
00094   if ( qt_build ) G4cout << "Qt, ";
00095   if ( xm_build ) G4cout << "Xm, ";
00096   if ( win32_build) G4cout << "Win32, ";
00097   if ( wt_build ) G4cout << "Wt, ";
00098   G4cout << "GAG, ";
00099   if (tcsh_build ) G4cout << "tcsh, ";
00100   G4cout << "csh ]" << G4endl;
00101 
00102   // selecting session type...
00103   // 1st priority : in case argumant specified
00104   G4String stype = type;
00105   stype.toLower();   // session type is case-insensitive.
00106   if (type != "") SelectSessionByArg(stype);
00107 
00108   // 2nd priority : refer environment variables (as backword compatibility)
00109   if ( selected == kNone ) SelectSessionByEnv();
00110 
00111   // 3rd priority : refer $HOME/.g4session
00112   if ( selected == kNone ) {
00113     G4String appinput = argv[0];
00114     G4String appname = "";
00115     size_t islash = appinput.find_last_of("/\\");
00116     if (islash == G4String::npos) 
00117       appname = appinput;
00118     else 
00119       appname = appinput(islash+1, appinput.size()-islash-1);
00120 
00121     SelectSessionByFile(appname);
00122   }
00123 
00124   // 4th, best guess of session type  
00125   if ( selected == kNone) SelectSessionByBestGuess();
00126     
00127   // instantiate a session...
00128   switch ( selected ) {
00129   case kQt:
00130 #if defined(G4UI_BUILD_QT_SESSION)
00131     session = new G4UIQt(argc, argv);
00132     isGUI = true;
00133 #endif
00134     break;
00135   case kXm:
00136 #if defined(G4UI_BUILD_XM_SESSION)
00137     session = new G4UIXm(argc, argv);
00138     isGUI = true;
00139 #endif
00140     break;
00141   case kWin32:
00142 #if defined(G4UI_BUILD_WIN32_SESSION)
00143     DISCARD_PARAMETER(argc);
00144     DISCARD_PARAMETER(argv);
00145     session = new G4UIWin32();
00146 #endif
00147     break;
00148   case kWt:
00149 #if defined(G4UI_BUILD_WT_SESSION)
00150     //session = new G4UIWt(argc, argv);
00151     //isGUI = true;
00152 #endif
00153     break;
00154   case kGag:
00155     DISCARD_PARAMETER(argc);
00156     DISCARD_PARAMETER(argv);
00157     session = new G4UIGAG();
00158     isGUI = true;
00159     break;
00160  case kTcsh:
00161 #ifndef WIN32
00162     DISCARD_PARAMETER(argc);
00163     DISCARD_PARAMETER(argv);
00164     shell = new G4UItcsh;
00165     session = new G4UIterminal(shell);
00166 #endif
00167     break;
00168   case kCsh:
00169     DISCARD_PARAMETER(argc);
00170     DISCARD_PARAMETER(argv);
00171     shell = new G4UIcsh;
00172     session = new G4UIterminal(shell);    
00173   default:
00174     break;
00175   }
00176 
00177   // fallback (csh)
00178   if ( session == NULL ) {
00179     G4Exception("G4UIExecutive::G4UIExecutive()", 
00180                 "UI0002",
00181                 JustWarning,
00182                 "Specified session type is not build in your system,\n"
00183                 "or no session type is specified.\n"
00184                 "A fallback session type is used.");
00185 
00186     selected = kCsh;
00187     DISCARD_PARAMETER(argc);
00188     DISCARD_PARAMETER(argv);
00189     shell = new G4UIcsh;
00190     session = new G4UIterminal(shell);
00191   }
00192 }

G4UIExecutive::~G4UIExecutive (  ) 

Definition at line 195 of file G4UIExecutive.cc.

00196 {
00197   if ( selected != kWt ) delete session;
00198 }


Member Function Documentation

G4UIsession * G4UIExecutive::GetSession (  )  const [inline]

Definition at line 92 of file G4UIExecutive.hh.

00093 {
00094   return session;
00095 }

G4bool G4UIExecutive::IsGUI (  )  const [inline]

Definition at line 97 of file G4UIExecutive.hh.

00098 {
00099   return isGUI;
00100 }

void G4UIExecutive::SessionStart (  ) 

Definition at line 303 of file G4UIExecutive.cc.

00304 {
00305   session-> SessionStart();
00306 }

void G4UIExecutive::SetLsColor ( TermColorIndex  dirColor,
TermColorIndex  cmdColor 
)

Definition at line 296 of file G4UIExecutive.cc.

00298 {
00299   if(shell) shell-> SetLsColor(dirColor, cmdColor);
00300 }

void G4UIExecutive::SetPrompt ( const G4String prompt  ) 

Definition at line 290 of file G4UIExecutive.cc.

00291 {
00292   if(shell) shell-> SetPrompt(prompt);
00293 }


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