Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UImanager Class Reference

#include <G4UImanager.hh>

+ Inheritance diagram for G4UImanager:

Public Member Functions

 ~G4UImanager ()
 
G4String GetCurrentValues (const char *aCommand)
 
void AddNewCommand (G4UIcommand *newCommand)
 
void RemoveCommand (G4UIcommand *aCommand)
 
void ExecuteMacroFile (const char *fileName)
 
void Loop (const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
 
void Foreach (const char *macroFile, const char *variableName, const char *candidates)
 
G4int ApplyCommand (const char *aCommand)
 
G4int ApplyCommand (const G4String &aCommand)
 
void StoreHistory (const char *fileName="G4history.macro")
 
void StoreHistory (G4bool historySwitch, const char *fileName="G4history.macro")
 
void ListCommands (const char *direc)
 
void SetAlias (const char *aliasLine)
 
void RemoveAlias (const char *aliasName)
 
void ListAlias ()
 
G4String SolveAlias (const char *aCmd)
 
void CreateHTML (const char *dir="/")
 
void LoopS (const char *valueList)
 
void ForeachS (const char *valueList)
 
virtual G4bool Notify (G4ApplicationState requestedState)
 
G4String GetCurrentStringValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4int GetCurrentIntValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4double GetCurrentDoubleValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4String GetCurrentStringValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
G4int GetCurrentIntValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
G4double GetCurrentDoubleValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
void SetPauseAtBeginOfEvent (G4bool vl)
 
G4bool GetPauseAtBeginOfEvent () const
 
void SetPauseAtEndOfEvent (G4bool vl)
 
G4bool GetPauseAtEndOfEvent () const
 
G4UIcommandTreeGetTree () const
 
G4UIsessionGetSession () const
 
G4UIsessionGetG4UIWindow () const
 
void SetSession (G4UIsession *const value)
 
void SetG4UIWindow (G4UIsession *const value)
 
void SetCoutDestination (G4UIsession *const value)
 
void SetVerboseLevel (G4int val)
 
G4int GetVerboseLevel () const
 
G4int GetNumberOfHistory () const
 
G4String GetPreviousCommand (G4int i) const
 
void SetMaxHistSize (G4int mx)
 
G4int GetMaxHistSize () const
 
void SetMacroSearchPath (const G4String &path)
 
const G4StringGetMacroSearchPath () const
 
void ParseMacroSearchPath ()
 
G4String FindMacroPath (const G4String &fname) const
 
- Public Member Functions inherited from G4VStateDependent
 G4VStateDependent (G4bool bottom=false)
 
virtual ~G4VStateDependent ()
 
G4int operator== (const G4VStateDependent &right) const
 
G4int operator!= (const G4VStateDependent &right) const
 
virtual G4bool Notify (G4ApplicationState requestedState)=0
 

Static Public Member Functions

static G4UImanagerGetUIpointer ()
 

Protected Member Functions

 G4UImanager ()
 

Detailed Description

Definition at line 53 of file G4UImanager.hh.

Constructor & Destructor Documentation

◆ G4UImanager()

G4UImanager::G4UImanager ( )
protected

Definition at line 64 of file G4UImanager.cc.

65 : G4VStateDependent(true),
66 UImessenger(0), UnitsMessenger(0)
67{
68 savedCommand = 0;
69 treeTop = new G4UIcommandTree("/");
70 aliasList = new G4UIaliasList;
71 G4String nullString;
72 savedParameters = nullString;
73 verboseLevel = 0;
74 saveHistory = false;
75 session = NULL;
76 g4UIWindow = NULL;
77 SetCoutDestination(session);
78 pauseAtBeginOfEvent = false;
79 pauseAtEndOfEvent = false;
80 maxHistSize = 20;
81 searchPath="";
82}
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:517

Referenced by GetUIpointer().

◆ ~G4UImanager()

G4UImanager::~G4UImanager ( )

Definition at line 90 of file G4UImanager.cc.

91{
93 histVec.clear();
94 if(saveHistory) historyFile.close();
95 delete UImessenger;
96 delete UnitsMessenger;
97 delete treeTop;
98 delete aliasList;
99 fUImanagerHasBeenKilled = true;
100 fUImanager = NULL;
101}

Member Function Documentation

◆ AddNewCommand()

void G4UImanager::AddNewCommand ( G4UIcommand newCommand)

Definition at line 220 of file G4UImanager.cc.

221{
222 treeTop->AddNewCommand( newCommand );
223}
void AddNewCommand(G4UIcommand *newCommand)

◆ ApplyCommand() [1/2]

G4int G4UImanager::ApplyCommand ( const char *  aCommand)

Definition at line 369 of file G4UImanager.cc.

370{
371 G4String aCommand = SolveAlias(aCmd);
372 if(aCommand.isNull()) return fAliasNotFound;
373 if(verboseLevel) G4cout << aCommand << G4endl;
374 G4String commandString;
375 G4String commandParameter;
376
377 G4int i = aCommand.index(" ");
378 if( i != G4int(std::string::npos) )
379 {
380 commandString = aCommand(0,i);
381 commandParameter = aCommand(i+1,aCommand.length()-(i+1));
382 }
383 else
384 {
385 commandString = aCommand;
386 }
387
388 // remove doubled slash
389 G4int len = commandString.length();
390 G4int ll = 0;
391 G4String a1;
392 G4String a2;
393 while(ll<len-1)
394 {
395 if(commandString(ll,2)=="//")
396 {
397 if(ll==0)
398 { commandString.remove(ll,1); }
399 else
400 {
401 a1 = commandString(0,ll);
402 a2 = commandString(ll+1,len-ll-1);
403 commandString = a1+a2;
404 }
405 len--;
406 }
407 else
408 { ll++; }
409 }
410
411 G4UIcommand * targetCommand = treeTop->FindPath( commandString );
412 if( targetCommand == NULL )
413 { return fCommandNotFound; }
414
415 if(!(targetCommand->IsAvailable()))
416 { return fIllegalApplicationState; }
417
418 if(saveHistory) historyFile << aCommand << G4endl;
419 if( G4int(histVec.size()) >= maxHistSize )
420 { histVec.erase(histVec.begin()); }
421 histVec.push_back(aCommand);
422 return targetCommand->DoIt( commandParameter );
423}
int G4int
Definition: G4Types.hh:66
@ fCommandNotFound
@ fAliasNotFound
@ fIllegalApplicationState
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4String & remove(str_size)
str_size index(const char *, G4int pos=0) const
G4bool isNull() const
G4UIcommand * FindPath(const char *commandPath) const
virtual G4int DoIt(G4String parameterList)
Definition: G4UIcommand.cc:104
G4bool IsAvailable()
Definition: G4UIcommand.cc:269
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:316

Referenced by G4IonTable::AddProcessManager(), ApplyCommand(), G4VBasicShell::ExecuteCommand(), G4RunManager::ProcessOneEvent(), G4VVisCommandViewer::RefreshIfRequired(), G4RunManager::rndmSaveThisEvent(), G4RunManager::rndmSaveThisRun(), G4VVisCommandGeometrySet::Set(), G4EnergyLossMessenger::SetNewValue(), G4UIcontrolMessenger::SetNewValue(), G4VisCommandList::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandOpen::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4TrackingMessenger::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), and G4TheRayTracer::Trace().

◆ ApplyCommand() [2/2]

G4int G4UImanager::ApplyCommand ( const G4String aCommand)

Definition at line 364 of file G4UImanager.cc.

365{
366 return ApplyCommand(aCmd.data());
367}
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:369

◆ CreateHTML()

void G4UImanager::CreateHTML ( const char *  dir = "/")

Definition at line 554 of file G4UImanager.cc.

555{
556 G4UIcommandTree* tr = FindDirectory(dir);
557 if(tr!=0)
558 { tr->CreateHTML(); }
559 else
560 { G4cerr << "Directory <" << dir << "> is not found." << G4endl; }
561}
G4DLLIMPORT std::ostream G4cerr

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ ExecuteMacroFile()

void G4UImanager::ExecuteMacroFile ( const char *  fileName)

Definition at line 230 of file G4UImanager.cc.

231{
232 G4UIsession* batchSession = new G4UIbatch(fileName,session);
233 session = batchSession;
234 G4UIsession* previousSession = session->SessionStart();
235 delete session;
236 session = previousSession;
237}
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:38

Referenced by Foreach(), and G4UIcontrolMessenger::SetNewValue().

◆ FindMacroPath()

G4String G4UImanager::FindMacroPath ( const G4String fname) const

Definition at line 593 of file G4UImanager.cc.

594{
595 G4String macrofile = fname;
596
597 for (size_t i = 0; i < searchDirs.size(); i++) {
598 G4String fullpath = searchDirs[i] + "/" + fname;
599 if ( FileFound(fullpath) ) {
600 macrofile = fullpath;
601 break;
602 }
603 }
604
605 return macrofile;
606}

◆ Foreach()

void G4UImanager::Foreach ( const char *  macroFile,
const char *  variableName,
const char *  candidates 
)

Definition at line 299 of file G4UImanager.cc.

301{
302 G4String candidatesString = candidates;
303 G4Tokenizer parameterToken( candidatesString );
304 G4String cd;
305 while(!((cd=parameterToken()).isNull()))
306 {
307 G4String vl = variableName;
308 vl += " ";
309 vl += cd;
310 SetAlias(vl);
311 ExecuteMacroFile(macroFile);
312 }
313}
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:230
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:523

Referenced by ForeachS(), and Loop().

◆ ForeachS()

void G4UImanager::ForeachS ( const char *  valueList)

Definition at line 283 of file G4UImanager.cc.

284{
285 G4String vl = valueList;
286 G4Tokenizer parameterToken(vl);
287 G4String mf = parameterToken();
288 G4String vn = parameterToken();
289 G4String c1 = parameterToken();
290 G4String ca;
291 while(!((ca=parameterToken()).isNull()))
292 {
293 c1 += " ";
294 c1 += ca;
295 }
296 Foreach(mf,vn,c1);
297}
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:299

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentDoubleValue() [1/2]

G4double G4UImanager::GetCurrentDoubleValue ( const char *  aCommand,
const char *  aParameterName,
G4bool  reGet = true 
)

Definition at line 196 of file G4UImanager.cc.

198{
199 G4String targetParameter =
200 GetCurrentStringValue( aCommand, aParameterName, reGet );
201 G4double value;
202 const char* t = targetParameter;
203 std::istringstream is(t);
204 is >> value;
205 return value;
206}
double G4double
Definition: G4Types.hh:64
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:134

◆ GetCurrentDoubleValue() [2/2]

G4double G4UImanager::GetCurrentDoubleValue ( const char *  aCommand,
G4int  parameterNumber = 1,
G4bool  reGet = true 
)

Definition at line 208 of file G4UImanager.cc.

210{
211 G4String targetParameter =
212 GetCurrentStringValue( aCommand, parameterNumber, reGet );
213 G4double value;
214 const char* t = targetParameter;
215 std::istringstream is(t);
216 is >> value;
217 return value;
218}

◆ GetCurrentIntValue() [1/2]

G4int G4UImanager::GetCurrentIntValue ( const char *  aCommand,
const char *  aParameterName,
G4bool  reGet = true 
)

Definition at line 172 of file G4UImanager.cc.

174{
175 G4String targetParameter =
176 GetCurrentStringValue( aCommand, aParameterName, reGet );
177 G4int value;
178 const char* t = targetParameter;
179 std::istringstream is(t);
180 is >> value;
181 return value;
182}

◆ GetCurrentIntValue() [2/2]

G4int G4UImanager::GetCurrentIntValue ( const char *  aCommand,
G4int  parameterNumber = 1,
G4bool  reGet = true 
)

Definition at line 184 of file G4UImanager.cc.

186{
187 G4String targetParameter =
188 GetCurrentStringValue( aCommand, parameterNumber, reGet );
189 G4int value;
190 const char* t = targetParameter;
191 std::istringstream is(t);
192 is >> value;
193 return value;
194}

Referenced by G4TheRayTracer::Trace().

◆ GetCurrentStringValue() [1/2]

G4String G4UImanager::GetCurrentStringValue ( const char *  aCommand,
const char *  aParameterName,
G4bool  reGet = true 
)

Definition at line 156 of file G4UImanager.cc.

158{
159 if(reGet || savedCommand == NULL)
160 {
161 G4String parameterValues = GetCurrentValues( aCommand );
162 }
163 for(G4int i=0;i<savedCommand->GetParameterEntries();i++)
164 {
165 if( aParameterName ==
166 savedCommand->GetParameter(i)->GetParameterName() )
167 return GetCurrentStringValue(aCommand,i+1,false);
168 }
169 return G4String();
170}
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:140
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:138
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:122
G4String GetParameterName() const

◆ GetCurrentStringValue() [2/2]

G4String G4UImanager::GetCurrentStringValue ( const char *  aCommand,
G4int  parameterNumber = 1,
G4bool  reGet = true 
)

Definition at line 134 of file G4UImanager.cc.

136{
137 if(reGet || savedCommand == NULL)
138 {
139 savedParameters = GetCurrentValues( aCommand );
140 }
141 G4Tokenizer savedToken( savedParameters );
142 G4String token;
143 for(G4int i_thParameter=0;i_thParameter<parameterNumber;i_thParameter++)
144 {
145 token = savedToken();
146 if( token.isNull() ) return G4String();
147 if( token[(size_t)0] == '"' )
148 {
149 token.append(" ");
150 token.append(savedToken("\""));
151 }
152 }
153 return token;
154}
G4String & append(const G4String &)

Referenced by GetCurrentDoubleValue(), GetCurrentIntValue(), and GetCurrentStringValue().

◆ GetCurrentValues()

G4String G4UImanager::GetCurrentValues ( const char *  aCommand)

Definition at line 122 of file G4UImanager.cc.

123{
124 G4String theCommand = aCommand;
125 savedCommand = treeTop->FindPath( theCommand );
126 if( savedCommand == NULL )
127 {
128 G4cerr << "command not found" << G4endl;
129 return G4String();
130 }
131 return savedCommand->GetCurrentValue();
132}
G4String GetCurrentValue()
Definition: G4UIcommand.cc:214

Referenced by GetCurrentStringValue(), and G4VBasicShell::ShowCurrent().

◆ GetG4UIWindow()

G4UIsession * G4UImanager::GetG4UIWindow ( ) const
inline

Definition at line 201 of file G4UImanager.hh.

202 { return g4UIWindow; }

◆ GetMacroSearchPath()

const G4String & G4UImanager::GetMacroSearchPath ( ) const
inline

Definition at line 236 of file G4UImanager.hh.

237 { return searchPath; }

◆ GetMaxHistSize()

G4int G4UImanager::GetMaxHistSize ( ) const
inline

Definition at line 231 of file G4UImanager.hh.

232 { return maxHistSize; }

Referenced by G4UIcontrolMessenger::GetCurrentValue().

◆ GetNumberOfHistory()

G4int G4UImanager::GetNumberOfHistory ( ) const
inline

Definition at line 220 of file G4UImanager.hh.

221 { return histVec.size(); }

Referenced by G4VBasicShell::ApplyShellCommand(), G4UIGAG::GetCommand(), and G4UIGainServer::GetCommand().

◆ GetPauseAtBeginOfEvent()

G4bool G4UImanager::GetPauseAtBeginOfEvent ( ) const
inline

Definition at line 185 of file G4UImanager.hh.

186 { return pauseAtBeginOfEvent; }

◆ GetPauseAtEndOfEvent()

G4bool G4UImanager::GetPauseAtEndOfEvent ( ) const
inline

Definition at line 189 of file G4UImanager.hh.

190 { return pauseAtEndOfEvent; }

◆ GetPreviousCommand()

G4String G4UImanager::GetPreviousCommand ( G4int  i) const
inline

Definition at line 222 of file G4UImanager.hh.

223 {
224 G4String st;
225 if(i>=0 && i<G4int(histVec.size()))
226 { st = histVec[i]; }
227 return st;
228 }

Referenced by G4VBasicShell::ApplyShellCommand(), G4UIGAG::GetCommand(), and G4UIGainServer::GetCommand().

◆ GetSession()

G4UIsession * G4UImanager::GetSession ( ) const
inline

Definition at line 199 of file G4UImanager.hh.

200 { return session; }

Referenced by G4VisCommandReviewKeptEvents::SetNewValue().

◆ GetTree()

◆ GetUIpointer()

G4UImanager * G4UImanager::GetUIpointer ( )
static

Definition at line 51 of file G4UImanager.cc.

52{
53 if(!fUImanager)
54 {
55 if(!fUImanagerHasBeenKilled)
56 {
57 fUImanager = new G4UImanager;
58 fUImanager->CreateMessenger();
59 }
60 }
61 return fUImanager;
62}

Referenced by G4IonTable::AddProcessManager(), G4VBasicShell::ApplyShellCommand(), G4VBasicShell::Complete(), G4CascadeParamMessenger::CreateDirectory(), G4UImessenger::CreateDirectory(), G4VBasicShell::ExecuteCommand(), G4VBasicShell::FindCommand(), G4VBasicShell::FindDirectory(), G4UIbatch::G4UIbatch(), G4UIGAG::G4UIGAG(), G4UIGainServer::G4UIGainServer(), G4UIterminal::G4UIterminal(), G4VisManager::GeometryHasChanged(), G4VUIshell::GetCommandTree(), G4UIcontrolMessenger::GetCurrentValue(), G4VisManager::NotifyHandlers(), G4RunManager::ProcessOneEvent(), G4VVisCommandViewer::RefreshIfRequired(), G4RunManager::rndmSaveThisEvent(), G4RunManager::rndmSaveThisRun(), G4UIbatch::SessionStart(), G4VVisCommandGeometrySet::Set(), G4EnergyLossMessenger::SetNewValue(), G4UIcontrolMessenger::SetNewValue(), G4VisCommandList::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandOpen::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4RunMessenger::SetNewValue(), G4TrackingMessenger::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4VBasicShell::ShowCurrent(), G4VBasicShell::TerminalHelp(), G4TheRayTracer::Trace(), G4VVisCommand::UpdateVisManagerScene(), G4RunManagerKernel::~G4RunManagerKernel(), G4UIcommand::~G4UIcommand(), G4UIGAG::~G4UIGAG(), G4UIGainServer::~G4UIGainServer(), and G4UIterminal::~G4UIterminal().

◆ GetVerboseLevel()

◆ ListAlias()

void G4UImanager::ListAlias ( )

Definition at line 549 of file G4UImanager.cc.

550{
551 aliasList->List();
552}

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ ListCommands()

void G4UImanager::ListCommands ( const char *  direc)

Definition at line 450 of file G4UImanager.cc.

451{
452 G4UIcommandTree* comTree = FindDirectory(direct);
453 if(comTree)
454 { comTree->List(); }
455 else
456 { G4cout << direct << " is not found." << G4endl; }
457}
void List() const

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ Loop()

void G4UImanager::Loop ( const char *  macroFile,
const char *  variableName,
G4double  initialValue,
G4double  finalValue,
G4double  stepSize = 1.0 
)

Definition at line 259 of file G4UImanager.cc.

261{
262 G4String cd;
263 if (stepSize > 0) {
264 for(G4double d=initialValue;d<=finalValue;d+=stepSize)
265 {
266 std::ostringstream os;
267 os << d;
268 cd += os.str();
269 cd += " ";
270 }
271 } else {
272 for(G4double d=initialValue;d>=finalValue;d+=stepSize)
273 {
274 std::ostringstream os;
275 os << d;
276 cd += os.str();
277 cd += " ";
278 }
279 }
280 Foreach(macroFile,variableName,cd);
281}

Referenced by LoopS().

◆ LoopS()

void G4UImanager::LoopS ( const char *  valueList)

Definition at line 239 of file G4UImanager.cc.

240{
241 G4String vl = valueList;
242 G4Tokenizer parameterToken(vl);
243 G4String mf = parameterToken();
244 G4String vn = parameterToken();
245 G4String c1 = parameterToken();
246 c1 += " ";
247 c1 += parameterToken();
248 c1 += " ";
249 c1 += parameterToken();
250 const char* t1 = c1;
251 std::istringstream is(t1);
252 G4double d1;
253 G4double d2;
254 G4double d3;
255 is >> d1 >> d2 >> d3;
256 Loop(mf,vn,d1,d2,d3);
257}
void Loop(const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
Definition: G4UImanager.cc:259

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ Notify()

G4bool G4UImanager::Notify ( G4ApplicationState  requestedState)
virtual

Implements G4VStateDependent.

Definition at line 481 of file G4UImanager.cc.

482{
483 //G4cout << G4StateManager::GetStateManager()->GetStateString(requestedState) << " <--- " << G4StateManager::GetStateManager()->GetStateString(G4StateManager::GetStateManager()->GetPreviousState()) << G4endl;
484 if(pauseAtBeginOfEvent)
485 {
486 if(requestedState==G4State_EventProc &&
488 { PauseSession("BeginOfEvent"); }
489 }
490 if(pauseAtEndOfEvent)
491 {
492 if(requestedState==G4State_GeomClosed &&
494 { PauseSession("EndOfEvent"); }
495 }
496 return true;
497}
@ G4State_EventProc
@ G4State_GeomClosed
static G4StateManager * GetStateManager()

◆ ParseMacroSearchPath()

void G4UImanager::ParseMacroSearchPath ( )

Definition at line 563 of file G4UImanager.cc.

564{
565 searchDirs.clear();
566
567 size_t idxfirst = 0;
568 size_t idxend = 0;
569 G4String pathstring = "";
570 while( (idxend = searchPath.index(':', idxfirst)) != G4String::npos) {
571 pathstring = searchPath.substr(idxfirst, idxend-idxfirst);
572 if(pathstring.size() != 0) searchDirs.push_back(pathstring);
573 idxfirst = idxend + 1;
574 }
575
576 pathstring = searchPath.substr(idxfirst, searchPath.size()-idxfirst);
577 if(pathstring.size() != 0) searchDirs.push_back(pathstring);
578}

◆ RemoveAlias()

void G4UImanager::RemoveAlias ( const char *  aliasName)

Definition at line 542 of file G4UImanager.cc.

543{
544 G4String aL = aliasName;
545 G4String targetAlias = aL.strip(G4String::both);
546 aliasList->RemoveAlias(targetAlias);
547}
G4String strip(G4int strip_Type=trailing, char c=' ')
void RemoveAlias(const char *aliasName)

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ RemoveCommand()

void G4UImanager::RemoveCommand ( G4UIcommand aCommand)

Definition at line 225 of file G4UImanager.cc.

226{
227 treeTop->RemoveCommand( aCommand );
228}
void RemoveCommand(G4UIcommand *aCommand)

Referenced by G4UIcommand::~G4UIcommand().

◆ SetAlias()

void G4UImanager::SetAlias ( const char *  aliasLine)

Definition at line 523 of file G4UImanager.cc.

524{
525 G4String aLine = aliasLine;
526 G4int i = aLine.index(" ");
527 G4String aliasName = aLine(0,i);
528 G4String aliasValue = aLine(i+1,aLine.length()-(i+1));
529 if(aliasValue(0)=='"')
530 {
531 G4String strippedValue;
532 if(aliasValue(aliasValue.length()-1)=='"')
533 { strippedValue = aliasValue(1,aliasValue.length()-2); }
534 else
535 { strippedValue = aliasValue(1,aliasValue.length()-1); }
536 aliasValue = strippedValue;
537 }
538
539 aliasList->ChangeAlias(aliasName,aliasValue);
540}
void ChangeAlias(const char *aliasName, const char *aliasValue)

Referenced by Foreach(), and G4UIcontrolMessenger::SetNewValue().

◆ SetCoutDestination()

void G4UImanager::SetCoutDestination ( G4UIsession *const  value)

Definition at line 517 of file G4UImanager.cc.

518{
521}
G4DLLIMPORT G4strstreambuf G4coutbuf
Definition: G4ios.cc:42
G4DLLIMPORT G4strstreambuf G4cerrbuf
Definition: G4ios.cc:43
void SetDestination(G4coutDestination *dest)

Referenced by G4UIGAG::G4UIGAG(), G4UImanager(), G4UIGAG::~G4UIGAG(), G4UIGainServer::~G4UIGainServer(), and ~G4UImanager().

◆ SetG4UIWindow()

void G4UImanager::SetG4UIWindow ( G4UIsession *const  value)
inline

Definition at line 206 of file G4UImanager.hh.

207 { g4UIWindow = value; }

◆ SetMacroSearchPath()

void G4UImanager::SetMacroSearchPath ( const G4String path)
inline

Definition at line 234 of file G4UImanager.hh.

235 { searchPath = path; }

◆ SetMaxHistSize()

void G4UImanager::SetMaxHistSize ( G4int  mx)
inline

Definition at line 229 of file G4UImanager.hh.

230 { maxHistSize = mx; }

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ SetPauseAtBeginOfEvent()

void G4UImanager::SetPauseAtBeginOfEvent ( G4bool  vl)
inline

Definition at line 183 of file G4UImanager.hh.

184 { pauseAtBeginOfEvent = vl; }

Referenced by G4RunMessenger::SetNewValue().

◆ SetPauseAtEndOfEvent()

void G4UImanager::SetPauseAtEndOfEvent ( G4bool  vl)
inline

Definition at line 187 of file G4UImanager.hh.

188 { pauseAtEndOfEvent = vl; }

Referenced by G4RunMessenger::SetNewValue().

◆ SetSession()

void G4UImanager::SetSession ( G4UIsession *const  value)
inline

Definition at line 204 of file G4UImanager.hh.

205 { session = value; }

Referenced by G4UIGAG::G4UIGAG(), G4UIGAG::~G4UIGAG(), and G4UIGainServer::~G4UIGainServer().

◆ SetVerboseLevel()

◆ SolveAlias()

G4String G4UImanager::SolveAlias ( const char *  aCmd)

Definition at line 316 of file G4UImanager.cc.

317{
318 G4String aCommand = aCmd;
319 G4int ia = aCommand.index("{");
320 G4int iz = aCommand.index("#");
321 while((ia != G4int(std::string::npos))&&((iz==G4int(std::string::npos))||(ia<iz)))
322 {
323 G4int ibx = -1;
324 while(ibx<0)
325 {
326 G4int ib = aCommand.index("}");
327 if( ib == G4int(std::string::npos) )
328 {
329 G4cerr << aCommand << G4endl;
330 for(G4int i=0;i<ia;i++) G4cerr << " ";
331 G4cerr << "^" << G4endl;
332 G4cerr << "Unmatched alias parenthis -- command ignored" << G4endl;
333 G4String nullStr;
334 return nullStr;
335 }
336 G4String ps = aCommand(ia+1,aCommand.length()-(ia+1));
337 G4int ic = ps.index("{");
338 G4int id = ps.index("}");
339 if(ic!=G4int(std::string::npos) && ic < id)
340 { ia+=ic+1; }
341 else
342 { ibx = ib; }
343 }
344 //--- Here ia represents the position of innermost "{"
345 //--- and ibx represents corresponding "}"
346 G4String subs;
347 if(ia>0) subs = aCommand(0,ia);
348 G4String alis = aCommand(ia+1,ibx-ia-1);
349 G4String rems = aCommand(ibx+1,aCommand.length()-ibx);
350 // G4cout << "<" << subs << "> <" << alis << "> <" << rems << ">" << G4endl;
351 G4String* alVal = aliasList->FindAlias(alis);
352 if(!alVal)
353 {
354 G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
355 G4String nullStr;
356 return nullStr;
357 }
358 aCommand = subs+(*alVal)+rems;
359 ia = aCommand.index("{");
360 }
361 return aCommand;
362}
G4String * FindAlias(const char *aliasName)

Referenced by ApplyCommand(), and G4UIcontrolMessenger::SetNewValue().

◆ StoreHistory() [1/2]

void G4UImanager::StoreHistory ( const char *  fileName = "G4history.macro")

Definition at line 425 of file G4UImanager.cc.

426{ StoreHistory(true,fileName); }
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:425

Referenced by G4UIcontrolMessenger::SetNewValue(), and StoreHistory().

◆ StoreHistory() [2/2]

void G4UImanager::StoreHistory ( G4bool  historySwitch,
const char *  fileName = "G4history.macro" 
)

Definition at line 428 of file G4UImanager.cc.

429{
430 if(historySwitch)
431 {
432 if(saveHistory)
433 { historyFile.close(); }
434 historyFile.open((char*)fileName);
435 saveHistory = true;
436 }
437 else
438 {
439 historyFile.close();
440 saveHistory = false;
441 }
442 saveHistory = historySwitch;
443}

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