Geant4 11.1.1
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 () override
 
 G4UImanager (const G4UImanager &)=delete
 
const G4UImanageroperator= (const G4UImanager &)=delete
 
G4bool operator== (const G4UImanager &) const =delete
 
G4bool operator!= (const G4UImanager &) const =delete
 
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)
 
G4UIcommandFindCommand (const char *aCommand)
 
G4UIcommandFindCommand (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)
 
G4bool Notify (G4ApplicationState requestedState) override
 
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
 
void SetMasterUIManager (G4bool val)
 
void SetIgnoreCmdNotFound (G4bool val)
 
std::vector< G4String > * GetCommandStack ()
 
void RegisterBridge (G4UIbridge *brg)
 
void SetUpForAThread (G4int tId)
 
void SetUpForSpecialThread (const G4String &aPrefix)
 
G4int GetThreadID () const
 
void SetCoutFileName (const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
 
void SetCerrFileName (const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
 
void SetThreadPrefixString (const G4String &prefix="W")
 
void SetThreadUseBuffer (G4bool flg=true)
 
void SetThreadIgnore (G4int tid=0)
 
void SetThreadIgnoreInit (G4bool flg=true)
 
G4MTcoutDestinationGetThreadCout ()
 
G4int GetLastReturnCode () const
 
bool IsLastCommandOutputTreated ()
 
void SetLastCommandOutputTreated ()
 
- Public Member Functions inherited from G4VStateDependent
 G4VStateDependent (G4bool bottom=false)
 
virtual ~G4VStateDependent ()
 
G4bool operator== (const G4VStateDependent &right) const
 
G4bool operator!= (const G4VStateDependent &right) const
 
virtual G4bool Notify (G4ApplicationState requestedState)=0
 

Static Public Member Functions

static G4UImanagerGetUIpointer ()
 
static G4UImanagerGetMasterUIpointer ()
 
static void UseDoublePrecisionStr (G4bool val)
 
static G4bool DoublePrecisionStr ()
 

Protected Member Functions

 G4UImanager ()
 

Detailed Description

Definition at line 57 of file G4UImanager.hh.

Constructor & Destructor Documentation

◆ ~G4UImanager()

G4UImanager::~G4UImanager ( )
override

Definition at line 116 of file G4UImanager.cc.

117{
118 if(bridges != nullptr)
119 {
120 for(auto bridge : *bridges)
121 {
122 delete bridge;
123 }
124 delete bridges;
125 }
126 SetCoutDestination(nullptr);
127 histVec.clear();
128 if(saveHistory)
129 {
130 historyFile.close();
131 }
132 delete CoutMessenger;
133 delete ProfileMessenger;
134 delete UnitsMessenger;
135 delete UImessenger;
136 delete treeTop;
137 delete aliasList;
138 fUImanagerHasBeenKilled() = true;
139 fUImanager() = nullptr;
140 if(commandStack != nullptr)
141 {
142 commandStack->clear();
143 delete commandStack;
144 }
145 if(threadID >= 0)
146 {
147 delete threadCout;
149 threadID = -1;
150 }
151}
void G4iosFinalization()
Definition: G4ios.cc:118
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:747

◆ G4UImanager() [1/2]

G4UImanager::G4UImanager ( const G4UImanager )
delete

◆ G4UImanager() [2/2]

G4UImanager::G4UImanager ( )
protected

Definition at line 97 of file G4UImanager.cc.

98 : G4VStateDependent(true)
99{
100 treeTop = new G4UIcommandTree("/");
101 aliasList = new G4UIaliasList;
103 commandStack = new std::vector<G4String>;
104}

Referenced by GetUIpointer().

Member Function Documentation

◆ AddNewCommand()

void G4UImanager::AddNewCommand ( G4UIcommand newCommand)

Definition at line 277 of file G4UImanager.cc.

278{
279 treeTop->AddNewCommand(newCommand);
280 if(fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0)
281 {
282 fMasterUImanager()->AddWorkerCommand(newCommand);
283 }
284}
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
G4int G4GetThreadId()
Definition: G4Threading.cc:122

◆ ApplyCommand() [1/2]

G4int G4UImanager::ApplyCommand ( const char *  aCommand)

Definition at line 495 of file G4UImanager.cc.

496{
497 G4String aCommand = SolveAlias(aCmd);
498 if(aCommand.empty())
499 {
500 return fAliasNotFound;
501 }
502 if(verboseLevel != 0)
503 {
504 if(isMaster)
505 {
506 fLastCommandOutputTreated = false;
507 }
508 G4cout << aCommand << G4endl;
509 }
510 G4String commandString;
511 G4String commandParameter;
512
513 std::size_t i = aCommand.find(" ");
514 if(i != std::string::npos)
515 {
516 commandString = aCommand.substr(0, i);
517 commandParameter = aCommand.substr(i + 1, aCommand.length() - (i + 1));
518 }
519 else
520 {
521 commandString = aCommand;
522 }
523
524 // remove doubled slash
525 std::size_t len = commandString.length();
526 std::size_t ll = 0;
527 G4String a1;
528 G4String a2;
529 while(ll < len - 1)
530 {
531 if(commandString.substr(ll, 2) == "//")
532 {
533 if(ll == 0)
534 {
535 // Safe because index argument always 0
536 commandString.erase(ll, 1);
537 }
538 else
539 {
540 a1 = commandString.substr(0, ll);
541 a2 = commandString.substr(ll + 1, len - ll - 1);
542 commandString = a1 + a2;
543 }
544 --len;
545 }
546 else
547 {
548 ++ll;
549 }
550 }
551
552 if(isMaster && bridges != nullptr)
553 {
554 for(auto bridge : *bridges)
555 {
556 G4int leng = bridge->DirLength();
557 if(commandString.substr(0, leng) == bridge->DirName())
558 {
559 return bridge->LocalUI()->ApplyCommand(commandString + " " +
560 commandParameter);
561 }
562 }
563 }
564
565 G4UIcommand* targetCommand = treeTop->FindPath(commandString);
566 if(targetCommand == nullptr)
567 {
568 if(ignoreCmdNotFound)
569 {
570 if(stackCommandsForBroadcast)
571 {
572 commandStack->push_back(commandString + " " + commandParameter);
573 }
574 return fCommandSucceeded;
575 }
576 else
577 {
578 return fCommandNotFound;
579 }
580 }
581
582 if(stackCommandsForBroadcast && targetCommand->ToBeBroadcasted())
583 {
584 commandStack->push_back(commandString + " " + commandParameter);
585 }
586
587 if(!(targetCommand->IsAvailable()))
588 {
590 }
591
592 if(saveHistory)
593 {
594 historyFile << aCommand << G4endl;
595 }
596 if(G4int(histVec.size()) >= maxHistSize)
597 {
598 histVec.erase(histVec.begin());
599 }
600 histVec.push_back(aCommand);
601
602 targetCommand->ResetFailure();
603 G4int commandFailureCode = targetCommand->DoIt(commandParameter);
604 if(commandFailureCode == 0)
605 {
606 G4int additionalFailureCode = targetCommand->IfCommandFailed();
607 if(additionalFailureCode > 0)
608 {
610 msg << targetCommand->GetFailureDescription() << "\n"
611 << "Error code : " << additionalFailureCode;
612 G4Exception("G4UImanager::ApplyCommand", "UIMAN0123", JustWarning, msg);
613 commandFailureCode += additionalFailureCode;
614 }
615 }
616 return commandFailureCode;
617}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
int G4int
Definition: G4Types.hh:85
@ fCommandNotFound
@ fAliasNotFound
@ fIllegalApplicationState
@ fCommandSucceeded
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4UIcommand * FindPath(const char *commandPath) const
G4bool ToBeBroadcasted() const
Definition: G4UIcommand.hh:173
G4int IfCommandFailed()
Definition: G4UIcommand.hh:189
virtual G4int DoIt(G4String parameterList)
Definition: G4UIcommand.cc:146
void ResetFailure()
Definition: G4UIcommand.hh:191
G4bool IsAvailable()
Definition: G4UIcommand.cc:342
const G4String & GetFailureDescription()
Definition: G4UIcommand.hh:190
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:430

Referenced by G4UIbridge::ApplyCommand(), ApplyCommand(), G4RunManagerKernel::BuildPhysicsTables(), G4TheMTRayTracer::CreateBitMap(), G4WorkerRunManager::DoWork(), G4VBasicShell::ExecuteCommand(), G4RunManager::GeometryHasBeenModified(), G4TaskRunManagerKernel::InitializeWorker(), G4VVisCommand::InterpolateViews(), G4QTabWidget::paintEvent(), G4RunManager::ProcessOneEvent(), G4WorkerRunManager::ProcessOneEvent(), G4WorkerTaskRunManager::ProcessOneEvent(), G4WorkerTaskRunManager::ProcessUI(), G4VVisCommand::RefreshIfRequired(), G4RunManager::ReinitializeGeometry(), G4TaskRunManager::RequestWorkersProcessCommandsStack(), G4RunManager::rndmSaveThisEvent(), G4WorkerRunManager::rndmSaveThisEvent(), G4MTRunManager::rndmSaveThisRun(), G4RunManager::rndmSaveThisRun(), G4WorkerRunManager::rndmSaveThisRun(), G4VVisCommandGeometrySet::Set(), G4OpticalParametersMessenger::SetNewValue(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4EmExtraParametersMessenger::SetNewValue(), G4EmLowEParametersMessenger::SetNewValue(), G4EmParametersMessenger::SetNewValue(), G4VisCommandList::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandOpen::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4UIcontrolMessenger::SetNewValue(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4TrackingMessenger::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4ToolsSGSceneHandler::SetPlotterHistograms(), G4VViewer::SetTouchable(), G4TheMTRayTracer::Trace(), and G4TheRayTracer::Trace().

◆ ApplyCommand() [2/2]

G4int G4UImanager::ApplyCommand ( const G4String aCommand)

Definition at line 489 of file G4UImanager.cc.

490{
491 return ApplyCommand(aCmd.data());
492}
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:495

◆ CreateHTML()

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

Definition at line 792 of file G4UImanager.cc.

793{
794 G4UIcommandTree* tr = FindDirectory(dir);
795 if(tr != nullptr)
796 {
797 tr->CreateHTML();
798 }
799 else
800 {
801 G4cerr << "Directory <" << dir << "> is not found." << G4endl;
802 }
803}
G4GLOB_DLL std::ostream G4cerr
void CreateHTML(const G4String &="")

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ DoublePrecisionStr()

G4bool G4UImanager::DoublePrecisionStr ( )
static

Definition at line 160 of file G4UImanager.cc.

161{
162 return doublePrecisionStr;
163}

Referenced by G4UIcommand::ConvertToString(), and G4UIcontrolMessenger::GetCurrentValue().

◆ ExecuteMacroFile()

void G4UImanager::ExecuteMacroFile ( const char *  fileName)

Definition at line 309 of file G4UImanager.cc.

310{
311 G4UIsession* batchSession = new G4UIbatch(fileName, session);
312 session = batchSession;
313 lastRC = 0;
314 G4UIsession* previousSession = session->SessionStart();
315 lastRC = session->GetLastReturnCode();
316 delete session;
317 session = previousSession;
318}

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

◆ FindCommand() [1/2]

G4UIcommand * G4UImanager::FindCommand ( const char *  aCommand)

Definition at line 627 of file G4UImanager.cc.

628{
629 G4String aCommand = SolveAlias(aCmd);
630 if(aCommand.empty())
631 { return nullptr; }
632
633 G4String commandString;
634
635 std::size_t i = aCommand.find(" ");
636 if(i != std::string::npos)
637 { commandString = aCommand.substr(0, i); }
638 else
639 { commandString = aCommand; }
640
641 return treeTop->FindPath(commandString);
642}

Referenced by FindCommand().

◆ FindCommand() [2/2]

G4UIcommand * G4UImanager::FindCommand ( const G4String aCommand)

Definition at line 621 of file G4UImanager.cc.

622{
623 return FindCommand(aCmd.data());
624}
G4UIcommand * FindCommand(const char *aCommand)
Definition: G4UImanager.cc:627

◆ FindMacroPath()

G4String G4UImanager::FindMacroPath ( const G4String fname) const

Definition at line 845 of file G4UImanager.cc.

846{
847 G4String macrofile = fname;
848
849 for(const auto& searchDir : searchDirs)
850 {
851 G4String fullpath = searchDir + "/" + fname;
852 if(FileFound(fullpath))
853 {
854 macrofile = fullpath;
855 break;
856 }
857 }
858 return macrofile;
859}

Referenced by G4UIQt::AddIcon(), G4UIQt::AddViewerTabFromFile(), Foreach(), and G4UIcontrolMessenger::SetNewValue().

◆ Foreach()

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

Definition at line 405 of file G4UImanager.cc.

407{
408 G4String candidatesString = candidates;
409 G4Tokenizer parameterToken(candidatesString);
410 G4String cd;
411 while(!((cd = parameterToken()).empty()))
412 {
413 G4String vl = variableName;
414 vl += " ";
415 vl += cd;
416 SetAlias(vl);
418 if(lastRC != 0)
419 {
421 ed << "Loop aborted due to a command execution error - "
422 << "error code " << lastRC;
423 G4Exception("G4UImanager::Foreach", "UIMAN0201", JustWarning, ed);
424 break;
425 }
426 }
427}
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:309
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:754
G4String FindMacroPath(const G4String &fname) const
Definition: G4UImanager.cc:845

Referenced by ForeachS(), and Loop().

◆ ForeachS()

void G4UImanager::ForeachS ( const char *  valueList)

Definition at line 371 of file G4UImanager.cc.

372{
373 G4String vl = valueList;
374 G4Tokenizer parameterToken(vl);
375 G4String mf = parameterToken();
376 G4String vn = parameterToken();
377 G4String c1 = parameterToken();
378 G4String ca;
379 while(!((ca = parameterToken()).empty()))
380 {
381 c1 += " ";
382 c1 += ca;
383 }
384
385 G4String aliasValue = c1;
386 if(aliasValue[0] == '"')
387 {
388 G4String strippedValue;
389 if(aliasValue.back() == '"')
390 {
391 strippedValue = aliasValue.substr(1, aliasValue.length() - 2);
392 }
393 else
394 {
395 strippedValue = aliasValue.substr(1, aliasValue.length() - 1);
396 }
397 aliasValue = strippedValue;
398 }
399
400 // Foreach(mf,vn,c1);
401 Foreach(mf, vn, aliasValue);
402}
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
Definition: G4UImanager.cc:405

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetCommandStack()

std::vector< G4String > * G4UImanager::GetCommandStack ( )

Definition at line 862 of file G4UImanager.cc.

863{
864 std::vector<G4String>* returnValue = commandStack;
865 commandStack = new std::vector<G4String>;
866 return returnValue;
867}

Referenced by G4MTRunManager::PrepareCommandsStack().

◆ GetCurrentDoubleValue() [1/2]

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

Definition at line 250 of file G4UImanager.cc.

253{
254 G4String targetParameter =
255 GetCurrentStringValue(aCommand, aParameterName, reGet);
256 G4double value;
257 const char* t = targetParameter;
258 std::istringstream is(t);
259 is >> value;
260 return value;
261}
double G4double
Definition: G4Types.hh:83
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:179

◆ GetCurrentDoubleValue() [2/2]

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

Definition at line 264 of file G4UImanager.cc.

266{
267 G4String targetParameter =
268 GetCurrentStringValue(aCommand, parameterNumber, reGet);
269 G4double value;
270 const char* t = targetParameter;
271 std::istringstream is(t);
272 is >> value;
273 return value;
274}

◆ GetCurrentIntValue() [1/2]

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

Definition at line 224 of file G4UImanager.cc.

226{
227 G4String targetParameter =
228 GetCurrentStringValue(aCommand, aParameterName, reGet);
229 G4int value;
230 const char* t = targetParameter;
231 std::istringstream is(t);
232 is >> value;
233 return value;
234}

◆ GetCurrentIntValue() [2/2]

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

Definition at line 237 of file G4UImanager.cc.

239{
240 G4String targetParameter =
241 GetCurrentStringValue(aCommand, parameterNumber, reGet);
242 G4int value;
243 const char* t = targetParameter;
244 std::istringstream is(t);
245 is >> value;
246 return value;
247}

Referenced by G4TheMTRayTracer::Trace(), and G4TheRayTracer::Trace().

◆ GetCurrentStringValue() [1/2]

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

Definition at line 205 of file G4UImanager.cc.

208{
209 if(reGet || savedCommand == nullptr)
210 {
211 G4String parameterValues = GetCurrentValues(aCommand);
212 }
213 for(G4int i = 0; i < (G4int)savedCommand->GetParameterEntries(); ++i)
214 {
215 if(aParameterName == savedCommand->GetParameter(i)->GetParameterName())
216 {
217 return GetCurrentStringValue(aCommand, i + 1, false);
218 }
219 }
220 return G4String();
221}
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:139
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:140
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:166
const G4String & GetParameterName() const

◆ GetCurrentStringValue() [2/2]

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

Definition at line 179 of file G4UImanager.cc.

181{
182 if(reGet || savedCommand == nullptr)
183 {
184 savedParameters = GetCurrentValues(aCommand);
185 }
186 G4Tokenizer savedToken(savedParameters);
187 G4String token;
188 for(G4int i_thParameter = 0; i_thParameter < parameterNumber; ++i_thParameter)
189 {
190 token = savedToken();
191 if(token.empty())
192 {
193 return G4String();
194 }
195 if(token[(size_t) 0] == '"')
196 {
197 token.append(" ");
198 token.append(savedToken("\""));
199 }
200 }
201 return token;
202}

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

◆ GetCurrentValues()

G4String G4UImanager::GetCurrentValues ( const char *  aCommand)

Definition at line 166 of file G4UImanager.cc.

167{
168 G4String theCommand = aCommand;
169 savedCommand = treeTop->FindPath(theCommand);
170 if(savedCommand == nullptr)
171 {
172 G4cerr << "command not found" << G4endl;
173 return G4String();
174 }
175 return savedCommand->GetCurrentValue();
176}
G4String GetCurrentValue()
Definition: G4UIcommand.cc:281

Referenced by GetCurrentStringValue(), G4UIcontrolMessenger::SetNewValue(), G4ToolsSGSceneHandler::SetPlotterHistograms(), and G4VBasicShell::ShowCurrent().

◆ GetG4UIWindow()

G4UIsession * G4UImanager::GetG4UIWindow ( ) const
inline

Definition at line 188 of file G4UImanager.hh.

188{ return g4UIWindow; }

Referenced by G4OpenGLQtViewer::CreateMainWindow(), G4VtkQtViewer::CreateMainWindow(), and G4ToolsSGQtViewer::Initialise().

◆ GetLastReturnCode()

G4int G4UImanager::GetLastReturnCode ( ) const
inline

Definition at line 254 of file G4UImanager.hh.

254{ return lastRC; }

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetMacroSearchPath()

const G4String & G4UImanager::GetMacroSearchPath ( ) const
inline

Definition at line 215 of file G4UImanager.hh.

215{ return searchPath; }

Referenced by G4UIcontrolMessenger::GetCurrentValue().

◆ GetMasterUIpointer()

G4UImanager * G4UImanager::GetMasterUIpointer ( )
static

Definition at line 91 of file G4UImanager.cc.

92{
93 return fMasterUImanager();
94}

Referenced by G4UIbridge::G4UIbridge().

◆ GetMaxHistSize()

G4int G4UImanager::GetMaxHistSize ( ) const
inline

Definition at line 212 of file G4UImanager.hh.

212{ return maxHistSize; }

Referenced by G4UIcontrolMessenger::GetCurrentValue().

◆ GetNumberOfHistory()

G4int G4UImanager::GetNumberOfHistory ( ) const
inline

Definition at line 201 of file G4UImanager.hh.

201{ return G4int(histVec.size()); }

Referenced by G4VBasicShell::ApplyShellCommand().

◆ GetPauseAtBeginOfEvent()

G4bool G4UImanager::GetPauseAtBeginOfEvent ( ) const
inline

Definition at line 178 of file G4UImanager.hh.

178{ return pauseAtBeginOfEvent; }

◆ GetPauseAtEndOfEvent()

G4bool G4UImanager::GetPauseAtEndOfEvent ( ) const
inline

Definition at line 180 of file G4UImanager.hh.

180{ return pauseAtEndOfEvent; }

◆ GetPreviousCommand()

G4String G4UImanager::GetPreviousCommand ( G4int  i) const
inline

Definition at line 202 of file G4UImanager.hh.

203 {
204 G4String st;
205 if(i >= 0 && i < G4int(histVec.size()))
206 {
207 st = histVec[i];
208 }
209 return st;
210 }

Referenced by G4VBasicShell::ApplyShellCommand().

◆ GetSession()

◆ GetThreadCout()

G4MTcoutDestination * G4UImanager::GetThreadCout ( )
inline

Definition at line 249 of file G4UImanager.hh.

249{ return threadCout; }

◆ GetThreadID()

G4int G4UImanager::GetThreadID ( ) const
inline

Definition at line 239 of file G4UImanager.hh.

239{ return threadID; }

◆ GetTree()

◆ GetUIpointer()

G4UImanager * G4UImanager::GetUIpointer ( )
static

Definition at line 77 of file G4UImanager.cc.

78{
79 if(fUImanager() == nullptr)
80 {
81 if(!fUImanagerHasBeenKilled())
82 {
83 fUImanager() = new G4UImanager;
84 fUImanager()->CreateMessenger();
85 }
86 }
87 return fUImanager();
88}

Referenced by G4UIQt::AddButton(), G4UIQt::AddIcon(), G4UIcommandTree::AddNewCommand(), G4UIQt::AddViewerTabFromFile(), G4OpenInventorQtExaminerViewer::afterRealizeHook(), G4VBasicShell::ApplyShellCommand(), G4RunManagerKernel::BuildPhysicsTables(), G4VVisCommand::CheckSceneAndNotifyHandlers(), G4VBasicShell::Complete(), G4TaskRunManager::CreateAndStartWorkers(), G4TheMTRayTracer::CreateBitMap(), G4CascadeParamMessenger::CreateDirectory(), G4UImessenger::CreateDirectory(), G4OpenGLQtViewer::CreateMainWindow(), G4VtkQtViewer::CreateMainWindow(), G4WorkerRunManager::DoWork(), G4VBasicShell::ExecuteCommand(), G4VBasicShell::FindCommand(), G4VBasicShell::FindDirectory(), G4MTRunManager::G4MTRunManager(), G4TaskRunManager::G4TaskRunManager(), G4UIbatch::G4UIbatch(), G4UIQt::G4UIQt(), G4UIterminal::G4UIterminal(), G4UIWin32::G4UIWin32(), G4UIXm::G4UIXm(), G4VisCommandDrawLogicalVolume::G4VisCommandDrawLogicalVolume(), G4VisCommandDrawVolume::G4VisCommandDrawVolume(), G4VisCommandOpen::G4VisCommandOpen(), G4VisCommandSceneAddMagneticField::G4VisCommandSceneAddMagneticField(), G4WorkerRunManager::G4WorkerRunManager(), G4RunManager::GeometryHasBeenModified(), G4VisManager::GeometryHasChanged(), G4VUIshell::GetCommandTree(), G4UIcontrolMessenger::GetCurrentValue(), G4OpenInventorQtViewer::Initialise(), G4Qt3DViewer::Initialise(), G4ToolsSGQtViewer::Initialise(), G4TaskRunManagerKernel::InitializeWorker(), G4VVisCommand::InterpolateViews(), G4OpenGLQt::IsUISessionCompatible(), G4OpenGLXm::IsUISessionCompatible(), G4OpenInventor::IsUISessionCompatible(), G4Qt3D::IsUISessionCompatible(), G4ToolsSGQtGLES::IsUISessionCompatible(), G4VtkQt::IsUISessionCompatible(), G4VisManager::NotifyHandlers(), G4QTabWidget::paintEvent(), G4MTRunManager::PrepareCommandsStack(), G4RunManager::ProcessOneEvent(), G4WorkerRunManager::ProcessOneEvent(), G4WorkerTaskRunManager::ProcessOneEvent(), G4WorkerTaskRunManager::ProcessUI(), G4UIQt::ReceiveG4cout(), G4VVisCommand::RefreshIfRequired(), G4RunManager::ReinitializeGeometry(), G4TaskRunManager::RequestWorkersProcessCommandsStack(), G4RunManager::rndmSaveThisEvent(), G4WorkerRunManager::rndmSaveThisEvent(), G4MTRunManager::rndmSaveThisRun(), G4RunManager::rndmSaveThisRun(), G4WorkerRunManager::rndmSaveThisRun(), G4UIbatch::SessionStart(), G4VVisCommandGeometrySet::Set(), G4OpticalParametersMessenger::SetNewValue(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4LocalThreadCoutMessenger::SetNewValue(), G4EmExtraParametersMessenger::SetNewValue(), G4EmLowEParametersMessenger::SetNewValue(), G4EmParametersMessenger::SetNewValue(), G4VisCommandList::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandReviewPlots::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandOpen::SetNewValue(), G4VisCommandPlot::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4UIcontrolMessenger::SetNewValue(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4RunMessenger::SetNewValue(), G4TrackingMessenger::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4ToolsSGSceneHandler::SetPlotterHistograms(), G4VViewer::SetTouchable(), G4VBasicShell::ShowCurrent(), G4MTRunManagerKernel::StartThread(), G4VBasicShell::TerminalHelp(), G4TheMTRayTracer::Trace(), G4TheRayTracer::Trace(), G4OpenGLQtViewer::updateViewerPropertiesTableWidget(), G4RunManagerKernel::~G4RunManagerKernel(), G4UIcommand::~G4UIcommand(), G4UIQt::~G4UIQt(), G4UIterminal::~G4UIterminal(), G4UIWin32::~G4UIWin32(), G4UIXm::~G4UIXm(), and G4VisManager::~G4VisManager().

◆ GetVerboseLevel()

◆ IsLastCommandOutputTreated()

bool G4UImanager::IsLastCommandOutputTreated ( )
inline

Definition at line 256 of file G4UImanager.hh.

256{ return fLastCommandOutputTreated; }

Referenced by G4UIQt::ReceiveG4cout().

◆ ListAlias()

void G4UImanager::ListAlias ( )

Definition at line 786 of file G4UImanager.cc.

787{
788 aliasList->List();
789}

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ ListCommands()

void G4UImanager::ListCommands ( const char *  direc)

Definition at line 680 of file G4UImanager.cc.

681{
682 G4UIcommandTree* comTree = FindDirectory(direct);
683 if(comTree != nullptr)
684 {
685 comTree->List();
686 }
687 else
688 {
689 G4cout << direct << " is not found." << G4endl;
690 }
691}
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 342 of file G4UImanager.cc.

345{
346 G4String cd;
347 if(stepSize > 0)
348 {
349 for(G4double d = initialValue; d <= finalValue; d += stepSize)
350 {
351 std::ostringstream os;
352 os << d;
353 cd += os.str();
354 cd += " ";
355 }
356 }
357 else
358 {
359 for(G4double d = initialValue; d >= finalValue; d += stepSize)
360 {
361 std::ostringstream os;
362 os << d;
363 cd += os.str();
364 cd += " ";
365 }
366 }
367 Foreach(macroFile, variableName, cd);
368}

Referenced by LoopS().

◆ LoopS()

void G4UImanager::LoopS ( const char *  valueList)

Definition at line 321 of file G4UImanager.cc.

322{
323 G4String vl = valueList;
324 G4Tokenizer parameterToken(vl);
325 G4String mf = parameterToken();
326 G4String vn = parameterToken();
327 G4String c1 = parameterToken();
328 c1 += " ";
329 c1 += parameterToken();
330 c1 += " ";
331 c1 += parameterToken();
332 const char* t1 = c1;
333 std::istringstream is(t1);
334 G4double d1;
335 G4double d2;
336 G4double d3;
337 is >> d1 >> d2 >> d3;
338 Loop(mf, vn, d1, d2, d3);
339}
void Loop(const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
Definition: G4UImanager.cc:342

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ Notify()

G4bool G4UImanager::Notify ( G4ApplicationState  requestedState)
overridevirtual

Implements G4VStateDependent.

Definition at line 723 of file G4UImanager.cc.

724{
725 if(pauseAtBeginOfEvent)
726 {
727 if(requestedState == G4State_EventProc &&
728 G4StateManager::GetStateManager()->GetPreviousState() ==
730 {
731 PauseSession("BeginOfEvent");
732 }
733 }
734 if(pauseAtEndOfEvent)
735 {
736 if(requestedState == G4State_GeomClosed &&
737 G4StateManager::GetStateManager()->GetPreviousState() ==
739 {
740 PauseSession("EndOfEvent");
741 }
742 }
743 return true;
744}
@ G4State_EventProc
@ G4State_GeomClosed
static G4StateManager * GetStateManager()

◆ operator!=()

G4bool G4UImanager::operator!= ( const G4UImanager ) const
delete

◆ operator=()

const G4UImanager & G4UImanager::operator= ( const G4UImanager )
delete

◆ operator==()

G4bool G4UImanager::operator== ( const G4UImanager ) const
delete

◆ ParseMacroSearchPath()

void G4UImanager::ParseMacroSearchPath ( )

Definition at line 806 of file G4UImanager.cc.

807{
808 searchDirs.clear();
809
810 std::size_t idxfirst = 0;
811 std::size_t idxend = 0;
812 G4String pathstring = "";
813 while((idxend = searchPath.find(':', idxfirst)) != G4String::npos)
814 {
815 pathstring = searchPath.substr(idxfirst, idxend - idxfirst);
816 if(!pathstring.empty())
817 {
818 searchDirs.push_back(pathstring);
819 }
820 idxfirst = idxend + 1;
821 }
822
823 pathstring = searchPath.substr(idxfirst, searchPath.size() - idxfirst);
824 if(!pathstring.empty())
825 {
826 searchDirs.push_back(pathstring);
827 }
828}

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ RegisterBridge()

void G4UImanager::RegisterBridge ( G4UIbridge brg)

Definition at line 870 of file G4UImanager.cc.

871{
872 if(brg->LocalUI() == this)
873 {
874 G4Exception("G4UImanager::RegisterBridge()", "UI7002", FatalException,
875 "G4UIBridge cannot bridge between same object.");
876 }
877 else
878 {
879 bridges->push_back(brg);
880 }
881}
@ FatalException
G4UImanager * LocalUI() const
Definition: G4UIbridge.hh:55

Referenced by G4UIbridge::G4UIbridge().

◆ RemoveAlias()

void G4UImanager::RemoveAlias ( const char *  aliasName)

Definition at line 778 of file G4UImanager.cc.

779{
780 G4String aL = aliasName;
781 G4String targetAlias = G4StrUtil::strip_copy(aL);
782 aliasList->RemoveAlias(targetAlias);
783}
void RemoveAlias(const char *aliasName)
G4String strip_copy(G4String str, char ch=' ')
Return copy of string with leading and trailing characters removed.

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ RemoveCommand()

void G4UImanager::RemoveCommand ( G4UIcommand aCommand)

Definition at line 293 of file G4UImanager.cc.

294{
295 treeTop->RemoveCommand(aCommand);
296 if(fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0)
297 {
298 fMasterUImanager()->RemoveWorkerCommand(aCommand);
299 }
300}
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)

Referenced by G4UIcommand::~G4UIcommand().

◆ SetAlias()

void G4UImanager::SetAlias ( const char *  aliasLine)

Definition at line 754 of file G4UImanager.cc.

755{
756 G4String aLine = aliasLine;
757 std::size_t i = aLine.find(" ");
758 G4String aliasName = aLine.substr(0, i);
759 G4String aliasValue = aLine.substr(i + 1, aLine.length() - (i + 1));
760 if(aliasValue[0] == '"')
761 {
762 G4String strippedValue;
763 if(aliasValue.back() == '"')
764 {
765 strippedValue = aliasValue.substr(1, aliasValue.length() - 2);
766 }
767 else
768 {
769 strippedValue = aliasValue.substr(1, aliasValue.length() - 1);
770 }
771 aliasValue = strippedValue;
772 }
773
774 aliasList->ChangeAlias(aliasName, aliasValue);
775}
void ChangeAlias(const char *aliasName, const char *aliasValue)

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

◆ SetCerrFileName()

void G4UImanager::SetCerrFileName ( const G4String fileN = "G4cerr.txt",
G4bool  ifAppend = true 
)

Definition at line 925 of file G4UImanager.cc.

926{
927 // for sequential mode, ignore this method.
928 if(threadID < 0)
929 {
930 return;
931 }
932
933 if(fileN == "**Screen**")
934 {
935 threadCout->SetCerrFileName(fileN, ifAppend);
936 }
937 else
938 {
939 std::stringstream fn;
940 fn << "G4W_" << threadID << "_" << fileN;
941 threadCout->SetCerrFileName(fn.str(), ifAppend);
942 }
943}
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetCoutDestination()

void G4UImanager::SetCoutDestination ( G4UIsession *const  value)

Definition at line 747 of file G4UImanager.cc.

748{
751}
G4GLOB_DLL G4strstreambuf G4coutbuf
Definition: G4ios.cc:114
G4GLOB_DLL G4strstreambuf G4cerrbuf
Definition: G4ios.cc:115
void SetDestination(G4coutDestination *dest)

Referenced by G4UImanager(), G4UIQt::G4UIQt(), G4UIWin32::G4UIWin32(), G4UIXm::G4UIXm(), ~G4UImanager(), G4UIQt::~G4UIQt(), G4UIWin32::~G4UIWin32(), G4UIXm::~G4UIXm(), and G4VisManager::~G4VisManager().

◆ SetCoutFileName()

void G4UImanager::SetCoutFileName ( const G4String fileN = "G4cout.txt",
G4bool  ifAppend = true 
)

Definition at line 904 of file G4UImanager.cc.

905{
906 // for sequential mode, ignore this method.
907 if(threadID < 0)
908 {
909 return;
910 }
911
912 if(fileN == "**Screen**")
913 {
914 threadCout->SetCoutFileName(fileN, ifAppend);
915 }
916 else
917 {
918 std::stringstream fn;
919 fn << "G4W_" << threadID << "_" << fileN;
920 threadCout->SetCoutFileName(fn.str(), ifAppend);
921 }
922}
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetG4UIWindow()

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

Definition at line 191 of file G4UImanager.hh.

191{ g4UIWindow = value; }

Referenced by G4UIQt::G4UIQt(), G4UIWin32::G4UIWin32(), G4UIQt::~G4UIQt(), and G4UIWin32::~G4UIWin32().

◆ SetIgnoreCmdNotFound()

void G4UImanager::SetIgnoreCmdNotFound ( G4bool  val)
inline

Definition at line 229 of file G4UImanager.hh.

229{ ignoreCmdNotFound = val; }

Referenced by G4WorkerRunManager::G4WorkerRunManager().

◆ SetLastCommandOutputTreated()

void G4UImanager::SetLastCommandOutputTreated ( )
inline

Definition at line 257 of file G4UImanager.hh.

257{ fLastCommandOutputTreated = true; }

Referenced by G4UIQt::ReceiveG4cout().

◆ SetMacroSearchPath()

void G4UImanager::SetMacroSearchPath ( const G4String path)
inline

Definition at line 214 of file G4UImanager.hh.

214{ searchPath = path; }

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ SetMasterUIManager()

void G4UImanager::SetMasterUIManager ( G4bool  val)
inline

Definition at line 219 of file G4UImanager.hh.

220 {
221 isMaster = val;
222 stackCommandsForBroadcast = val;
223 if(val && (bridges == nullptr))
224 {
225 bridges = new std::vector<G4UIbridge*>;
226 fMasterUImanager() = this;
227 }
228 }

Referenced by G4MTRunManager::G4MTRunManager(), and G4TaskRunManager::G4TaskRunManager().

◆ SetMaxHistSize()

void G4UImanager::SetMaxHistSize ( G4int  mx)
inline

Definition at line 211 of file G4UImanager.hh.

211{ maxHistSize = mx; }

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ SetPauseAtBeginOfEvent()

void G4UImanager::SetPauseAtBeginOfEvent ( G4bool  vl)
inline

Definition at line 177 of file G4UImanager.hh.

177{ pauseAtBeginOfEvent = vl; }

Referenced by G4RunMessenger::SetNewValue().

◆ SetPauseAtEndOfEvent()

void G4UImanager::SetPauseAtEndOfEvent ( G4bool  vl)
inline

Definition at line 179 of file G4UImanager.hh.

179{ pauseAtEndOfEvent = vl; }

Referenced by G4RunMessenger::SetNewValue().

◆ SetSession()

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

◆ SetThreadIgnore()

void G4UImanager::SetThreadIgnore ( G4int  tid = 0)

Definition at line 968 of file G4UImanager.cc.

969{
970 // for sequential mode, ignore this method.
971 if(threadID < 0)
972 {
973 igThreadID = tid;
974 return;
975 }
976 threadCout->SetIgnoreCout(tid);
977}
void SetIgnoreCout(G4int tid=0)

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadIgnoreInit()

void G4UImanager::SetThreadIgnoreInit ( G4bool  flg = true)

Definition at line 980 of file G4UImanager.cc.

981{
982 // for sequential mode, ignore this method.
983 if(threadID < 0)
984 {
985 return;
986 }
987 threadCout->SetIgnoreInit(flg);
988}
void SetIgnoreInit(G4bool val=true)

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadPrefixString()

void G4UImanager::SetThreadPrefixString ( const G4String prefix = "W")

Definition at line 946 of file G4UImanager.cc.

947{
948 // for sequential mode, ignore this method.
949 if(threadID < 0)
950 {
951 return;
952 }
953 threadCout->SetPrefixString(s);
954}
void SetPrefixString(const G4String &wd="G4WT")

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadUseBuffer()

void G4UImanager::SetThreadUseBuffer ( G4bool  flg = true)

Definition at line 957 of file G4UImanager.cc.

958{
959 // for sequential mode, ignore this method.
960 if(threadID < 0)
961 {
962 return;
963 }
964 threadCout->EnableBuffering(flg);
965}
void EnableBuffering(G4bool flag=true)

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetUpForAThread()

void G4UImanager::SetUpForAThread ( G4int  tId)

Definition at line 884 of file G4UImanager.cc.

885{
886 threadID = tId;
888 threadCout = new G4MTcoutDestination(threadID);
889 threadCout->SetIgnoreCout(igThreadID);
890}
void G4iosInitialization()
Definition: G4ios.cc:117

Referenced by G4TaskRunManagerKernel::InitializeWorker(), and G4MTRunManagerKernel::StartThread().

◆ SetUpForSpecialThread()

void G4UImanager::SetUpForSpecialThread ( const G4String aPrefix)

Definition at line 893 of file G4UImanager.cc.

894{
898 threadCout = new G4MTcoutDestination(threadID);
899 threadCout->SetPrefixString(pref);
900 threadCout->SetIgnoreCout(igThreadID);
901}
void G4SetThreadId(G4int aNewValue)
Definition: G4Threading.cc:125

◆ SetVerboseLevel()

◆ SolveAlias()

G4String G4UImanager::SolveAlias ( const char *  aCmd)

Definition at line 430 of file G4UImanager.cc.

431{
432 G4String aCommand = aCmd;
433 std::size_t ia = aCommand.find("{");
434 std::size_t iz = aCommand.find("#");
435 while((ia != std::string::npos) &&
436 ((iz == std::string::npos) || (ia < iz)))
437 {
438 G4int ibx = -1;
439 while(ibx < 0)
440 {
441 std::size_t ib = aCommand.find("}");
442 if(ib == std::string::npos)
443 {
444 G4cerr << aCommand << G4endl;
445 for(std::size_t i = 0; i < ia; ++i)
446 {
447 G4cerr << " ";
448 }
449 G4cerr << "^" << G4endl;
450 G4cerr << "Unmatched alias parenthesis -- command ignored" << G4endl;
451 G4String nullStr;
452 return nullStr;
453 }
454 G4String ps = aCommand.substr(ia + 1, aCommand.length() - (ia + 1));
455 std::size_t ic = ps.find("{");
456 std::size_t id = ps.find("}");
457 if(ic != std::string::npos && ic < id)
458 {
459 ia += ic + 1;
460 }
461 else
462 {
463 ibx = (G4int)ib;
464 }
465 }
466 //--- Here ia represents the position of innermost "{"
467 //--- and ibx represents corresponding "}"
468 G4String subs;
469 if(ia > 0)
470 {
471 subs = aCommand.substr(0, ia);
472 }
473 G4String alis = aCommand.substr(ia + 1, ibx - ia - 1);
474 G4String rems = aCommand.substr(ibx + 1, aCommand.length() - ibx);
475 G4String* alVal = aliasList->FindAlias(alis);
476 if(alVal == nullptr)
477 {
478 G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
479 G4String nullStr;
480 return nullStr;
481 }
482 aCommand = subs + (*alVal) + rems;
483 ia = aCommand.find("{");
484 }
485 return aCommand;
486}
G4String * FindAlias(const char *aliasName)

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

◆ StoreHistory() [1/2]

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

Definition at line 645 of file G4UImanager.cc.

646{
647 StoreHistory(true, fileName);
648}
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:645

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

◆ StoreHistory() [2/2]

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

Definition at line 651 of file G4UImanager.cc.

652{
653 if(historySwitch)
654 {
655 if(saveHistory)
656 {
657 historyFile.close();
658 }
659 historyFile.open((char*) fileName);
660 saveHistory = true;
661 }
662 else
663 {
664 historyFile.close();
665 saveHistory = false;
666 }
667 saveHistory = historySwitch;
668}

◆ UseDoublePrecisionStr()

void G4UImanager::UseDoublePrecisionStr ( G4bool  val)
static

Definition at line 154 of file G4UImanager.cc.

155{
156 doublePrecisionStr = val;
157}

Referenced by G4UIcontrolMessenger::SetNewValue().


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