Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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::G4UIExecutive ( G4int  argc,
char **  argv,
const G4String type = "" 
)

Definition at line 90 of file G4UIExecutive.cc.

91 : selected(kNone), session(NULL), shell(NULL), isGUI(false)
92{
93 G4cout << "Available UI session types: [ ";
94 if ( qt_build ) G4cout << "Qt, ";
95 if ( xm_build ) G4cout << "Xm, ";
96 if ( win32_build) G4cout << "Win32, ";
97 if ( wt_build ) G4cout << "Wt, ";
98 G4cout << "GAG, ";
99 if (tcsh_build ) G4cout << "tcsh, ";
100 G4cout << "csh ]" << G4endl;
101
102 // selecting session type...
103 // 1st priority : in case argumant specified
104 G4String stype = type;
105 stype.toLower(); // session type is case-insensitive.
106 if (type != "") SelectSessionByArg(stype);
107
108 // 2nd priority : refer environment variables (as backword compatibility)
109 if ( selected == kNone ) SelectSessionByEnv();
110
111 // 3rd priority : refer $HOME/.g4session
112 if ( selected == kNone ) {
113 G4String appinput = argv[0];
114 G4String appname = "";
115 size_t islash = appinput.find_last_of("/\\");
116 if (islash == G4String::npos)
117 appname = appinput;
118 else
119 appname = appinput(islash+1, appinput.size()-islash-1);
120
121 SelectSessionByFile(appname);
122 }
123
124 // 4th, best guess of session type
125 if ( selected == kNone) SelectSessionByBestGuess();
126
127 // instantiate a session...
128 switch ( selected ) {
129 case kQt:
130#if defined(G4UI_BUILD_QT_SESSION)
131 session = new G4UIQt(argc, argv);
132 isGUI = true;
133#endif
134 break;
135 case kXm:
136#if defined(G4UI_BUILD_XM_SESSION)
137 session = new G4UIXm(argc, argv);
138 isGUI = true;
139#endif
140 break;
141 case kWin32:
142#if defined(G4UI_BUILD_WIN32_SESSION)
143 DISCARD_PARAMETER(argc);
144 DISCARD_PARAMETER(argv);
145 session = new G4UIWin32();
146#endif
147 break;
148 case kWt:
149#if defined(G4UI_BUILD_WT_SESSION)
150 //session = new G4UIWt(argc, argv);
151 //isGUI = true;
152#endif
153 break;
154 case kGag:
155 DISCARD_PARAMETER(argc);
156 DISCARD_PARAMETER(argv);
157 session = new G4UIGAG();
158 isGUI = true;
159 break;
160 case kTcsh:
161#ifndef WIN32
162 DISCARD_PARAMETER(argc);
163 DISCARD_PARAMETER(argv);
164 shell = new G4UItcsh;
165 session = new G4UIterminal(shell);
166#endif
167 break;
168 case kCsh:
169 DISCARD_PARAMETER(argc);
170 DISCARD_PARAMETER(argv);
171 shell = new G4UIcsh;
172 session = new G4UIterminal(shell);
173 default:
174 break;
175 }
176
177 // fallback (csh)
178 if ( session == NULL ) {
179 G4Exception("G4UIExecutive::G4UIExecutive()",
180 "UI0002",
182 "Specified session type is not build in your system,\n"
183 "or no session type is specified.\n"
184 "A fallback session type is used.");
185
186 selected = kCsh;
187 DISCARD_PARAMETER(argc);
188 DISCARD_PARAMETER(argv);
189 shell = new G4UIcsh;
190 session = new G4UIterminal(shell);
191 }
192}
@ JustWarning
#define DISCARD_PARAMETER(p)
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
void toLower()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ ~G4UIExecutive()

G4UIExecutive::~G4UIExecutive ( )

Definition at line 195 of file G4UIExecutive.cc.

196{
197 if ( selected != kWt ) delete session;
198}

Member Function Documentation

◆ GetSession()

G4UIsession * G4UIExecutive::GetSession ( ) const
inline

Definition at line 92 of file G4UIExecutive.hh.

93{
94 return session;
95}

◆ IsGUI()

G4bool G4UIExecutive::IsGUI ( ) const
inline

Definition at line 97 of file G4UIExecutive.hh.

98{
99 return isGUI;
100}

◆ SessionStart()

void G4UIExecutive::SessionStart ( )

Definition at line 303 of file G4UIExecutive.cc.

304{
305 session-> SessionStart();
306}

Referenced by SessionStart().

◆ SetLsColor()

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

Definition at line 296 of file G4UIExecutive.cc.

298{
299 if(shell) shell-> SetLsColor(dirColor, cmdColor);
300}
void SetLsColor(TermColorIndex dirColor, TermColorIndex cmdColor)

Referenced by SetLsColor().

◆ SetPrompt()

void G4UIExecutive::SetPrompt ( const G4String prompt)

Definition at line 290 of file G4UIExecutive.cc.

291{
292 if(shell) shell-> SetPrompt(prompt);
293}
void SetPrompt(const G4String &prompt)

Referenced by SetPrompt().


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