Geant4-11
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
G4UImanager Class Reference

#include <G4UImanager.hh>

Inheritance diagram for G4UImanager:
G4VStateDependent

Public Member Functions

void AddNewCommand (G4UIcommand *newCommand)
 
G4int ApplyCommand (const char *aCommand)
 
G4int ApplyCommand (const G4String &aCommand)
 
void CreateHTML (const char *dir="/")
 
void ExecuteMacroFile (const char *fileName)
 
G4UIcommandFindCommand (const char *aCommand)
 
G4UIcommandFindCommand (const G4String &aCommand)
 
G4String FindMacroPath (const G4String &fname) const
 
void Foreach (const char *macroFile, const char *variableName, const char *candidates)
 
void ForeachS (const char *valueList)
 
 G4UImanager (const G4UImanager &)=delete
 
std::vector< G4String > * GetCommandStack ()
 
G4double GetCurrentDoubleValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
G4double GetCurrentDoubleValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4int GetCurrentIntValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
G4int GetCurrentIntValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4String GetCurrentStringValue (const char *aCommand, const char *aParameterName, G4bool reGet=true)
 
G4String GetCurrentStringValue (const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
 
G4String GetCurrentValues (const char *aCommand)
 
G4UIsessionGetG4UIWindow () const
 
G4int GetLastReturnCode () const
 
const G4StringGetMacroSearchPath () const
 
G4int GetMaxHistSize () const
 
G4int GetNumberOfHistory () const
 
G4bool GetPauseAtBeginOfEvent () const
 
G4bool GetPauseAtEndOfEvent () const
 
G4String GetPreviousCommand (G4int i) const
 
G4UIsessionGetSession () const
 
G4MTcoutDestinationGetThreadCout ()
 
G4int GetThreadID () const
 
G4UIcommandTreeGetTree () const
 
G4int GetVerboseLevel () const
 
bool IsLastCommandOutputTreated ()
 
void ListAlias ()
 
void ListCommands (const char *direc)
 
void Loop (const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
 
void LoopS (const char *valueList)
 
virtual G4bool Notify (G4ApplicationState requestedState)
 
G4bool operator!= (const G4UImanager &) const =delete
 
G4bool operator!= (const G4VStateDependent &right) const
 
const G4UImanageroperator= (const G4UImanager &)=delete
 
G4bool operator== (const G4UImanager &) const =delete
 
G4bool operator== (const G4VStateDependent &right) const
 
void ParseMacroSearchPath ()
 
void RegisterBridge (G4UIbridge *brg)
 
void RemoveAlias (const char *aliasName)
 
void RemoveCommand (G4UIcommand *aCommand)
 
void SetAlias (const char *aliasLine)
 
void SetCerrFileName (const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
 
void SetCoutDestination (G4UIsession *const value)
 
void SetCoutFileName (const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
 
void SetG4UIWindow (G4UIsession *const value)
 
void SetIgnoreCmdNotFound (G4bool val)
 
void SetLastCommandOutputTreated ()
 
void SetMacroSearchPath (const G4String &path)
 
void SetMasterUIManager (G4bool val)
 
void SetMaxHistSize (G4int mx)
 
void SetPauseAtBeginOfEvent (G4bool vl)
 
void SetPauseAtEndOfEvent (G4bool vl)
 
void SetSession (G4UIsession *const value)
 
void SetThreadIgnore (G4int tid=0)
 
void SetThreadIgnoreInit (G4bool flg=true)
 
void SetThreadPrefixString (const G4String &prefix="W")
 
void SetThreadUseBuffer (G4bool flg=true)
 
void SetUpForAThread (G4int tId)
 
void SetUpForSpecialThread (G4String aPrefix)
 
void SetVerboseLevel (G4int val)
 
G4String SolveAlias (const char *aCmd)
 
void StoreHistory (const char *fileName="G4history.macro")
 
void StoreHistory (G4bool historySwitch, const char *fileName="G4history.macro")
 
 ~G4UImanager ()
 

Static Public Member Functions

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

Protected Member Functions

 G4UImanager ()
 

Private Member Functions

void AddWorkerCommand (G4UIcommand *newCommand)
 
void CreateMessenger ()
 
G4UIcommandTreeFindDirectory (const char *dirName)
 
void PauseSession (const char *msg)
 
void RemoveWorkerCommand (G4UIcommand *aCommand)
 

Static Private Member Functions

static G4ICOMS_DLL G4UImanager *& fMasterUImanager ()
 
static G4ICOMS_DLL G4UImanager *& fUImanager ()
 
static G4ICOMS_DLL G4boolfUImanagerHasBeenKilled ()
 

Private Attributes

G4UIaliasListaliasList = nullptr
 
std::vector< G4UIbridge * > * bridges = nullptr
 
std::vector< G4String > * commandStack = nullptr
 
G4LocalThreadCoutMessengerCoutMessenger = nullptr
 
G4bool fLastCommandOutputTreated = true
 
G4UIsessiong4UIWindow = nullptr
 
std::ofstream historyFile
 
std::vector< G4StringhistVec
 
G4bool ignoreCmdNotFound = false
 
G4bool isMaster = false
 
G4int lastRC = 0
 
G4int maxHistSize = 20
 
G4bool pauseAtBeginOfEvent = false
 
G4bool pauseAtEndOfEvent = false
 
G4ProfilerMessengerProfileMessenger = nullptr
 
G4UIcommandsavedCommand = nullptr
 
G4String savedParameters
 
G4bool saveHistory = false
 
std::vector< G4StringsearchDirs
 
G4String searchPath = ""
 
G4UIsessionsession = nullptr
 
G4bool stackCommandsForBroadcast = false
 
G4MTcoutDestinationthreadCout = nullptr
 
G4int threadID = -1
 
G4UIcommandTreetreeTop = nullptr
 
G4UIcontrolMessengerUImessenger = nullptr
 
G4UnitsMessengerUnitsMessenger = nullptr
 
G4int verboseLevel = 0
 

Static Private Attributes

static G4ICOMS_DLL G4bool doublePrecisionStr = false
 
static G4ICOMS_DLL G4int igThreadID = -1
 

Detailed Description

Definition at line 57 of file G4UImanager.hh.

Constructor & Destructor Documentation

◆ ~G4UImanager()

G4UImanager::~G4UImanager ( )

Definition at line 116 of file G4UImanager.cc.

117{
118 if(bridges != nullptr)
119 {
120 for(auto itr = bridges->cbegin(); itr != bridges->cend(); ++itr)
121 {
122 delete *itr;
123 }
124 delete bridges;
125 }
126 SetCoutDestination(nullptr);
127 histVec.clear();
128 if(saveHistory)
129 historyFile.close();
130 delete CoutMessenger;
131 delete ProfileMessenger;
132 delete UnitsMessenger;
133 delete UImessenger;
134 delete treeTop;
135 delete aliasList;
137 fUImanager() = nullptr;
138 if(commandStack != nullptr)
139 {
140 commandStack->clear();
141 delete commandStack;
142 }
143 if(threadID >= 0)
144 {
145 delete threadCout;
147 threadID = -1;
148 }
149}
void G4iosFinalization()
Definition: G4ios.cc:112
G4ProfilerMessenger * ProfileMessenger
Definition: G4UImanager.hh:283
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:727
G4UIaliasList * aliasList
Definition: G4UImanager.hh:290
std::vector< G4String > * commandStack
Definition: G4UImanager.hh:301
G4UIcommandTree * treeTop
Definition: G4UImanager.hh:277
G4UnitsMessenger * UnitsMessenger
Definition: G4UImanager.hh:281
std::vector< G4UIbridge * > * bridges
Definition: G4UImanager.hh:298
std::ofstream historyFile
Definition: G4UImanager.hh:287
G4bool saveHistory
Definition: G4UImanager.hh:288
std::vector< G4String > histVec
Definition: G4UImanager.hh:289
G4int threadID
Definition: G4UImanager.hh:303
static G4ICOMS_DLL G4UImanager *& fUImanager()
Definition: G4UImanager.cc:56
G4LocalThreadCoutMessenger * CoutMessenger
Definition: G4UImanager.hh:282
G4MTcoutDestination * threadCout
Definition: G4UImanager.hh:304
G4UIcontrolMessenger * UImessenger
Definition: G4UImanager.hh:280
static G4ICOMS_DLL G4bool & fUImanagerHasBeenKilled()
Definition: G4UImanager.cc:63

References aliasList, bridges, commandStack, CoutMessenger, fUImanager(), fUImanagerHasBeenKilled(), G4iosFinalization(), historyFile, histVec, ProfileMessenger, saveHistory, SetCoutDestination(), threadCout, threadID, treeTop, UImessenger, and UnitsMessenger.

◆ 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("/");
103 commandStack = new std::vector<G4String>;
104}
G4VStateDependent(G4bool bottom=false)

References aliasList, commandStack, SetCoutDestination(), and treeTop.

Referenced by GetUIpointer().

Member Function Documentation

◆ AddNewCommand()

void G4UImanager::AddNewCommand ( G4UIcommand newCommand)

Definition at line 271 of file G4UImanager.cc.

272{
273 treeTop->AddNewCommand(newCommand);
274 if(fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0)
275 {
276 fMasterUImanager()->AddWorkerCommand(newCommand);
277 }
278}
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
static G4ICOMS_DLL G4UImanager *& fMasterUImanager()
Definition: G4UImanager.cc:70
void AddWorkerCommand(G4UIcommand *newCommand)
Definition: G4UImanager.cc:281
G4int G4GetThreadId()
Definition: G4Threading.cc:122

References G4UIcommandTree::AddNewCommand(), AddWorkerCommand(), fMasterUImanager(), G4Threading::G4GetThreadId(), and treeTop.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ AddWorkerCommand()

void G4UImanager::AddWorkerCommand ( G4UIcommand newCommand)
private

Definition at line 281 of file G4UImanager.cc.

282{
283 treeTop->AddNewCommand(newCommand, true);
284}

References G4UIcommandTree::AddNewCommand(), and treeTop.

Referenced by AddNewCommand().

◆ ApplyCommand() [1/2]

G4int G4UImanager::ApplyCommand ( const char *  aCommand)

Definition at line 485 of file G4UImanager.cc.

486{
487 G4String aCommand = SolveAlias(aCmd);
488 if(aCommand.empty())
489 return fAliasNotFound;
490 if(verboseLevel) {
492 G4cout << aCommand << G4endl;
493 }
494 G4String commandString;
495 G4String commandParameter;
496
497 std::size_t i = aCommand.find(" ");
498 if(i != std::string::npos)
499 {
500 commandString = aCommand.substr(0, i);
501 commandParameter = aCommand.substr(i + 1, aCommand.length() - (i + 1));
502 }
503 else
504 {
505 commandString = aCommand;
506 }
507
508 // remove doubled slash
509 G4int len = commandString.length();
510 G4int ll = 0;
511 G4String a1;
512 G4String a2;
513 while(ll < len - 1)
514 {
515 if(commandString.substr(ll, 2) == "//")
516 {
517 if(ll == 0)
518 {
519 // Safe because index argument always 0
520 commandString.erase(ll, 1);
521 }
522 else
523 {
524 a1 = commandString.substr(0, ll);
525 a2 = commandString.substr(ll + 1, len - ll - 1);
526 commandString = a1 + a2;
527 }
528 --len;
529 }
530 else
531 {
532 ++ll;
533 }
534 }
535
536 if(isMaster && bridges != nullptr)
537 {
538 for(auto itr = bridges->cbegin(); itr != bridges->cend(); ++itr)
539 {
540 G4int leng = (*itr)->DirLength();
541 if(commandString.substr(0, leng) == (*itr)->DirName())
542 {
543 return (*itr)->LocalUI()->ApplyCommand(commandString + " " +
544 commandParameter);
545 }
546 }
547 }
548
549 G4UIcommand* targetCommand = treeTop->FindPath(commandString);
550 if(targetCommand == nullptr)
551 {
553 {
555 {
556 commandStack->push_back(commandString + " " + commandParameter);
557 }
558 return fCommandSucceeded;
559 }
560 else
561 {
562 return fCommandNotFound;
563 }
564 }
565
566 if(stackCommandsForBroadcast && targetCommand->ToBeBroadcasted())
567 {
568 commandStack->push_back(commandString + " " + commandParameter);
569 }
570
571 if(!(targetCommand->IsAvailable()))
572 {
574 }
575
576 if(saveHistory)
577 historyFile << aCommand << G4endl;
578 if(G4int(histVec.size()) >= maxHistSize)
579 {
580 histVec.erase(histVec.begin());
581 }
582 histVec.push_back(aCommand);
583
584 targetCommand->ResetFailure();
585 G4int commandFailureCode = targetCommand->DoIt(commandParameter);
586 if(commandFailureCode == 0)
587 {
588 G4int additionalFailureCode = targetCommand->IfCommandFailed();
589 if(additionalFailureCode > 0)
590 {
592 msg << targetCommand->GetFailureDescription() << "\n"
593 << "Error code : " << additionalFailureCode;
594 G4Exception("G4UImanager::ApplyCommand", "UIMAN0123", JustWarning, msg);
595 commandFailureCode += additionalFailureCode;
596 }
597 }
598 return commandFailureCode;
599}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
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:151
void ResetFailure()
Definition: G4UIcommand.hh:191
G4bool IsAvailable()
Definition: G4UIcommand.cc:343
const G4String & GetFailureDescription()
Definition: G4UIcommand.hh:190
G4int verboseLevel
Definition: G4UImanager.hh:286
G4bool ignoreCmdNotFound
Definition: G4UImanager.hh:299
G4bool fLastCommandOutputTreated
Definition: G4UImanager.hh:311
G4int maxHistSize
Definition: G4UImanager.hh:291
G4bool isMaster
Definition: G4UImanager.hh:297
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:424
G4bool stackCommandsForBroadcast
Definition: G4UImanager.hh:300

References bridges, commandStack, G4UIcommand::DoIt(), fAliasNotFound, fCommandNotFound, fCommandSucceeded, fIllegalApplicationState, G4UIcommandTree::FindPath(), fLastCommandOutputTreated, G4cout, G4endl, G4Exception(), G4UIcommand::GetFailureDescription(), historyFile, histVec, G4UIcommand::IfCommandFailed(), ignoreCmdNotFound, G4UIcommand::IsAvailable(), isMaster, JustWarning, maxHistSize, G4UIcommand::ResetFailure(), saveHistory, SolveAlias(), stackCommandsForBroadcast, G4UIcommand::ToBeBroadcasted(), treeTop, and verboseLevel.

Referenced by G4UIbridge::ApplyCommand(), ApplyCommand(), G4RunManagerKernel::BuildPhysicsTables(), G4UIQt::ChangeCursorAction(), G4UIQt::ChangePerspectiveOrtho(), G4UIQt::ChangeSurfaceStyle(), G4TheMTRayTracer::CreateBitMap(), G4WorkerRunManager::DoWork(), G4UIbatch::ExecCommand(), G4VBasicShell::ExecuteCommand(), G4RunManager::GeometryHasBeenModified(), G4TaskRunManagerKernel::InitializeWorker(), G4VVisCommand::InterpolateViews(), G4VisManager::IsValidView(), G4UIQt::OpenIconCallback(), 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(), G4UIQt::SaveIconCallback(), G4VVisCommandGeometrySet::Set(), G4OpticalParametersMessenger::SetNewValue(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4EmExtraParametersMessenger::SetNewValue(), G4EmLowEParametersMessenger::SetNewValue(), G4EmParametersMessenger::SetNewValue(), G4UIcontrolMessenger::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(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4TrackingMessenger::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4ToolsSGSceneHandler::SetPlotterHistograms(), G4VViewer::SetTouchable(), SignalHandler(), G4OpenGLQtViewer::tableWidgetViewerSetItemChanged(), G4OpenGLQtViewer::togglePicking(), G4TheMTRayTracer::Trace(), G4TheRayTracer::Trace(), and G4UIQt::VisParameterCallback().

◆ ApplyCommand() [2/2]

G4int G4UImanager::ApplyCommand ( const G4String aCommand)

Definition at line 479 of file G4UImanager.cc.

480{
481 return ApplyCommand(aCmd.data());
482}
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485

References ApplyCommand().

◆ CreateHTML()

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

Definition at line 772 of file G4UImanager.cc.

773{
775 if(tr != nullptr)
776 {
777 tr->CreateHTML();
778 }
779 else
780 {
781 G4cerr << "Directory <" << dir << "> is not found." << G4endl;
782 }
783}
G4GLOB_DLL std::ostream G4cerr
void CreateHTML(G4String="")
G4UIcommandTree * FindDirectory(const char *dirName)
Definition: G4UImanager.cc:674

References G4UIcommandTree::CreateHTML(), FindDirectory(), G4cerr, and G4endl.

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

◆ CreateMessenger()

void G4UImanager::CreateMessenger ( )
private

◆ DoublePrecisionStr()

G4bool G4UImanager::DoublePrecisionStr ( )
static

Definition at line 158 of file G4UImanager.cc.

159{
160 return doublePrecisionStr;
161}
static G4ICOMS_DLL G4bool doublePrecisionStr
Definition: G4UImanager.hh:307

References doublePrecisionStr.

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

◆ ExecuteMacroFile()

void G4UImanager::ExecuteMacroFile ( const char *  fileName)

Definition at line 303 of file G4UImanager.cc.

304{
305 G4UIsession* batchSession = new G4UIbatch(fileName, session);
306 session = batchSession;
307 lastRC = 0;
308 G4UIsession* previousSession = session->SessionStart();
309 lastRC = session->GetLastReturnCode();
310 delete session;
311 session = previousSession;
312}
G4UIsession * session
Definition: G4UImanager.hh:278

References lastRC, and session.

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

◆ FindCommand() [1/2]

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

Definition at line 609 of file G4UImanager.cc.

610{
611 G4String aCommand = SolveAlias(aCmd);
612 if(aCommand.empty())
613 { return nullptr; }
614
615 G4String commandString;
616
617 std::size_t i = aCommand.find(" ");
618 if(i != std::string::npos)
619 { commandString = aCommand.substr(0, i); }
620 else
621 { commandString = aCommand; }
622
623 return treeTop->FindPath(commandString);
624}

References G4UIcommandTree::FindPath(), SolveAlias(), and treeTop.

Referenced by FindCommand().

◆ FindCommand() [2/2]

G4UIcommand * G4UImanager::FindCommand ( const G4String aCommand)

Definition at line 603 of file G4UImanager.cc.

604{
605 return FindCommand(aCmd.data());
606}
G4UIcommand * FindCommand(const char *aCommand)
Definition: G4UImanager.cc:609

References FindCommand().

◆ FindDirectory()

G4UIcommandTree * G4UImanager::FindDirectory ( const char *  dirName)
private

Definition at line 674 of file G4UImanager.cc.

675{
676 G4String aDirName = dirName;
677 G4String targetDir = G4StrUtil::strip_copy(aDirName);
678 if(targetDir.back() != '/')
679 {
680 targetDir += "/";
681 }
682 G4UIcommandTree* comTree = treeTop;
683 if(targetDir == "/")
684 {
685 return comTree;
686 }
687 G4int idx = 1;
688 while(idx < G4int(targetDir.length()) - 1)
689 {
690 G4int i = targetDir.find("/", idx);
691 G4String targetDirString = targetDir.substr(0, i + 1);
692 comTree = comTree->GetTree(targetDirString);
693 if(comTree == nullptr)
694 {
695 return nullptr;
696 }
697 idx = i + 1;
698 }
699 return comTree;
700}
G4UIcommandTree * GetTree(G4int i)
G4String strip_copy(G4String str, char c=' ')
Return copy of string with leading and trailing characters removed.

References G4UIcommandTree::GetTree(), G4StrUtil::strip_copy(), and treeTop.

Referenced by CreateHTML(), and ListCommands().

◆ FindMacroPath()

G4String G4UImanager::FindMacroPath ( const G4String fname) const

Definition at line 821 of file G4UImanager.cc.

822{
823 G4String macrofile = fname;
824
825 for(std::size_t i = 0; i < searchDirs.size(); ++i)
826 {
827 G4String fullpath = searchDirs[i] + "/" + fname;
828 if(FileFound(fullpath))
829 {
830 macrofile = fullpath;
831 break;
832 }
833 }
834 return macrofile;
835}
static G4bool FileFound(const G4String &fname)
Definition: G4UImanager.cc:807
std::vector< G4String > searchDirs
Definition: G4UImanager.hh:295
string fname
Definition: test.py:308

References FileFound(), test::fname, and searchDirs.

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

◆ fMasterUImanager()

G4UImanager *& G4UImanager::fMasterUImanager ( )
staticprivate

Definition at line 70 of file G4UImanager.cc.

71{
72 static G4UImanager* _instance = nullptr;
73 return _instance;
74}

Referenced by AddNewCommand(), GetMasterUIpointer(), RemoveCommand(), and SetMasterUIManager().

◆ Foreach()

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

Definition at line 399 of file G4UImanager.cc.

401{
402 G4String candidatesString = candidates;
403 G4Tokenizer parameterToken(candidatesString);
404 G4String cd;
405 while(!((cd = parameterToken()).empty()))
406 {
407 G4String vl = variableName;
408 vl += " ";
409 vl += cd;
410 SetAlias(vl);
412 if(lastRC != 0)
413 {
415 ed << "Loop aborted due to a command execution error - "
416 << "error code " << lastRC;
417 G4Exception("G4UImanager::Foreach", "UIMAN0201", JustWarning, ed);
418 break;
419 }
420 }
421}
static const G4double cd
void ExecuteMacroFile(const char *fileName)
Definition: G4UImanager.cc:303
void SetAlias(const char *aliasLine)
Definition: G4UImanager.cc:734
G4String FindMacroPath(const G4String &fname) const
Definition: G4UImanager.cc:821

References cd, anonymous_namespace{G4MTcoutDestination.cc}::empty, ExecuteMacroFile(), FindMacroPath(), G4Exception(), JustWarning, lastRC, and SetAlias().

Referenced by ForeachS(), and Loop().

◆ ForeachS()

void G4UImanager::ForeachS ( const char *  valueList)

Definition at line 365 of file G4UImanager.cc.

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

References anonymous_namespace{G4MTcoutDestination.cc}::empty, and Foreach().

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ fUImanager()

G4UImanager *& G4UImanager::fUImanager ( )
staticprivate

Definition at line 56 of file G4UImanager.cc.

57{
58 G4ThreadLocalStatic G4UImanager* _instance = nullptr;
59 return _instance;
60}
#define G4ThreadLocalStatic
Definition: tls.hh:76

References G4ThreadLocalStatic.

Referenced by GetUIpointer(), and ~G4UImanager().

◆ fUImanagerHasBeenKilled()

G4bool & G4UImanager::fUImanagerHasBeenKilled ( )
staticprivate

Definition at line 63 of file G4UImanager.cc.

64{
65 G4ThreadLocalStatic G4bool _instance = false;
66 return _instance;
67}
bool G4bool
Definition: G4Types.hh:86

References G4ThreadLocalStatic.

Referenced by GetUIpointer(), and ~G4UImanager().

◆ GetCommandStack()

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

Definition at line 838 of file G4UImanager.cc.

839{
840 std::vector<G4String>* returnValue = commandStack;
841 commandStack = new std::vector<G4String>;
842 return returnValue;
843}

References commandStack.

Referenced by G4MTRunManager::PrepareCommandsStack().

◆ GetCurrentDoubleValue() [1/2]

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

Definition at line 244 of file G4UImanager.cc.

247{
248 G4String targetParameter =
249 GetCurrentStringValue(aCommand, aParameterName, reGet);
250 G4double value;
251 const char* t = targetParameter;
252 std::istringstream is(t);
253 is >> value;
254 return value;
255}
double G4double
Definition: G4Types.hh:83
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
Definition: G4UImanager.cc:177

References GetCurrentStringValue().

◆ GetCurrentDoubleValue() [2/2]

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

Definition at line 258 of file G4UImanager.cc.

260{
261 G4String targetParameter =
262 GetCurrentStringValue(aCommand, parameterNumber, reGet);
263 G4double value;
264 const char* t = targetParameter;
265 std::istringstream is(t);
266 is >> value;
267 return value;
268}

References GetCurrentStringValue().

◆ GetCurrentIntValue() [1/2]

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

Definition at line 218 of file G4UImanager.cc.

220{
221 G4String targetParameter =
222 GetCurrentStringValue(aCommand, aParameterName, reGet);
223 G4int value;
224 const char* t = targetParameter;
225 std::istringstream is(t);
226 is >> value;
227 return value;
228}

References GetCurrentStringValue().

◆ GetCurrentIntValue() [2/2]

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

Definition at line 231 of file G4UImanager.cc.

233{
234 G4String targetParameter =
235 GetCurrentStringValue(aCommand, parameterNumber, reGet);
236 G4int value;
237 const char* t = targetParameter;
238 std::istringstream is(t);
239 is >> value;
240 return value;
241}

References GetCurrentStringValue().

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 201 of file G4UImanager.cc.

204{
205 if(reGet || savedCommand == nullptr)
206 {
207 G4String parameterValues = GetCurrentValues(aCommand);
208 }
209 for(std::size_t i = 0; i < savedCommand->GetParameterEntries(); ++i)
210 {
211 if(aParameterName == savedCommand->GetParameter(i)->GetParameterName())
212 return GetCurrentStringValue(aCommand, i + 1, false);
213 }
214 return G4String();
215}
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:138
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:139
G4UIcommand * savedCommand
Definition: G4UImanager.hh:285
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:164
const G4String & GetParameterName() const

References GetCurrentStringValue(), GetCurrentValues(), G4UIcommand::GetParameter(), G4UIcommand::GetParameterEntries(), G4UIparameter::GetParameterName(), and savedCommand.

◆ GetCurrentStringValue() [2/2]

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

Definition at line 177 of file G4UImanager.cc.

179{
180 if(reGet || savedCommand == nullptr)
181 {
183 }
184 G4Tokenizer savedToken(savedParameters);
185 G4String token;
186 for(G4int i_thParameter = 0; i_thParameter < parameterNumber; ++i_thParameter)
187 {
188 token = savedToken();
189 if(token.empty())
190 return G4String();
191 if(token[(size_t) 0] == '"')
192 {
193 token.append(" ");
194 token.append(savedToken("\""));
195 }
196 }
197 return token;
198}
G4String savedParameters
Definition: G4UImanager.hh:284

References GetCurrentValues(), savedCommand, and savedParameters.

Referenced by GetCurrentDoubleValue(), GetCurrentIntValue(), GetCurrentStringValue(), and G4DecayTableMessenger::SetCurrentParticle().

◆ GetCurrentValues()

G4String G4UImanager::GetCurrentValues ( const char *  aCommand)

Definition at line 164 of file G4UImanager.cc.

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

References G4UIcommandTree::FindPath(), G4cerr, G4endl, G4UIcommand::GetCurrentValue(), savedCommand, and treeTop.

Referenced by export_G4UImanager(), 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; }
G4UIsession * g4UIWindow
Definition: G4UImanager.hh:279

References 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; }

References lastRC.

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetMacroSearchPath()

const G4String & G4UImanager::GetMacroSearchPath ( ) const
inline

Definition at line 215 of file G4UImanager.hh.

215{ return searchPath; }
G4String searchPath
Definition: G4UImanager.hh:294

References searchPath.

Referenced by export_G4UImanager(), and G4UIcontrolMessenger::GetCurrentValue().

◆ GetMasterUIpointer()

G4UImanager * G4UImanager::GetMasterUIpointer ( )
static

Definition at line 91 of file G4UImanager.cc.

92{
93 return fMasterUImanager();
94}

References fMasterUImanager().

Referenced by G4UIbridge::G4UIbridge(), and G4UIcommand::G4UIcommandCommonConstructorCode().

◆ GetMaxHistSize()

G4int G4UImanager::GetMaxHistSize ( ) const
inline

Definition at line 212 of file G4UImanager.hh.

212{ return maxHistSize; }

References maxHistSize.

Referenced by G4UIcontrolMessenger::GetCurrentValue().

◆ GetNumberOfHistory()

G4int G4UImanager::GetNumberOfHistory ( ) const
inline

Definition at line 201 of file G4UImanager.hh.

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

References histVec.

Referenced by G4VBasicShell::ApplyShellCommand().

◆ GetPauseAtBeginOfEvent()

G4bool G4UImanager::GetPauseAtBeginOfEvent ( ) const
inline

Definition at line 178 of file G4UImanager.hh.

178{ return pauseAtBeginOfEvent; }
G4bool pauseAtBeginOfEvent
Definition: G4UImanager.hh:292

References pauseAtBeginOfEvent.

Referenced by export_G4UImanager().

◆ GetPauseAtEndOfEvent()

G4bool G4UImanager::GetPauseAtEndOfEvent ( ) const
inline

Definition at line 180 of file G4UImanager.hh.

180{ return pauseAtEndOfEvent; }
G4bool pauseAtEndOfEvent
Definition: G4UImanager.hh:293

References pauseAtEndOfEvent.

Referenced by export_G4UImanager().

◆ 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 }

References histVec.

Referenced by G4VBasicShell::ApplyShellCommand(), G4UIterminal::GetCommand(), and G4ZMQServer::GetCommand().

◆ GetSession()

G4UIsession * G4UImanager::GetSession ( ) const
inline

◆ GetThreadCout()

G4MTcoutDestination * G4UImanager::GetThreadCout ( )
inline

Definition at line 249 of file G4UImanager.hh.

249{ return threadCout; }

References threadCout.

Referenced by G4UIQt::GetThreadPrefix().

◆ GetThreadID()

G4int G4UImanager::GetThreadID ( ) const
inline

Definition at line 239 of file G4UImanager.hh.

239{ return threadID; }

References threadID.

◆ GetTree()

G4UIcommandTree * G4UImanager::GetTree ( ) const
inline

◆ GetUIpointer()

G4UImanager * G4UImanager::GetUIpointer ( )
static

Definition at line 77 of file G4UImanager.cc.

78{
79 if(fUImanager() == nullptr)
80 {
82 {
83 fUImanager() = new G4UImanager;
85 }
86 }
87 return fUImanager();
88}
void CreateMessenger()
Definition: G4UImanager.cc:107

References CreateMessenger(), fUImanager(), fUImanagerHasBeenKilled(), and G4UImanager().

Referenced by G4UIQt::AddButton(), G4UIQt::AddIcon(), G4UIcommandTree::AddNewCommand(), G4UIQt::AddViewerTabFromFile(), G4OpenInventorQtExaminerViewer::afterRealizeHook(), G4VBasicShell::ApplyShellCommand(), pyG4UImanager::ApplyUICommand_1(), G4RunManagerKernel::BuildPhysicsTables(), G4UIQt::ButtonCallback(), G4UIQt::ChangeCursorAction(), G4UIQt::ChangePerspectiveOrtho(), G4UIQt::ChangeSurfaceStyle(), G4VVisCommand::CheckSceneAndNotifyHandlers(), G4VBasicShell::Complete(), G4TaskRunManager::CreateAndStartWorkers(), G4TheMTRayTracer::CreateBitMap(), G4UIQt::CreateCompleterModel(), G4CascadeParamMessenger::CreateDirectory(), G4UImessenger::CreateDirectory(), G4OpenGLQtViewer::CreateMainWindow(), G4VtkQtViewer::CreateMainWindow(), G4WorkerRunManager::DoWork(), G4UIbatch::ExecCommand(), G4VBasicShell::ExecuteCommand(), export_G4UImanager(), G4UIQt::FillHelpTree(), G4VBasicShell::FindCommand(), G4VBasicShell::FindDirectory(), G4MTRunManager::G4MTRunManager(), G4Qt::G4Qt(), G4TaskRunManager::G4TaskRunManager(), G4UIbatch::G4UIbatch(), G4UIcommand::G4UIcommandCommonConstructorCode(), G4UIQt::G4UIQt(), G4UIterminal::G4UIterminal(), G4UIWin32::G4UIWin32(), G4UIXm::G4UIXm(), G4VisCommandDrawLogicalVolume::G4VisCommandDrawLogicalVolume(), G4VisCommandDrawVolume::G4VisCommandDrawVolume(), G4VisCommandSceneAddMagneticField::G4VisCommandSceneAddMagneticField(), G4WorkerRunManager::G4WorkerRunManager(), G4ZMQServer::G4ZMQServer(), G4RunManager::GeometryHasBeenModified(), G4VisManager::GeometryHasChanged(), G4VUIshell::GetCommandTree(), G4UIcontrolMessenger::GetCurrentValue(), G4UIWin32::GetHelpTreeToolTips(), G4UIQt::GetThreadPrefix(), G4UIQt::HelpTreeClicCallback(), G4UIWin32::InitHelpTreeItems(), G4OpenInventorQtViewer::Initialise(), G4Qt3DViewer::Initialise(), G4ToolsSGQtViewer::Initialise(), G4TaskRunManagerKernel::InitializeWorker(), G4VVisCommand::InterpolateViews(), G4OpenGLQt::IsUISessionCompatible(), G4OpenGLXm::IsUISessionCompatible(), G4OpenInventor::IsUISessionCompatible(), G4Qt3D::IsUISessionCompatible(), G4VtkQt::IsUISessionCompatible(), G4VisManager::IsValidView(), G4VisManager::NotifyHandlers(), G4UIQt::OpenHelpTreeOnCommand(), G4UIQt::OpenIconCallback(), G4QTabWidget::paintEvent(), G4MTRunManager::PrepareCommandsStack(), G4RunManager::ProcessOneEvent(), G4WorkerRunManager::ProcessOneEvent(), G4WorkerTaskRunManager::ProcessOneEvent(), G4WorkerTaskRunManager::ProcessUI(), G4UIQt::ReceiveG4cout(), G4VVisCommand::RefreshIfRequired(), G4RunManager::ReinitializeGeometry(), G4TaskRunManager::RequestWorkersProcessCommandsStack(), pyglobals::ResetG4PyCoutDestination(), G4RunManager::rndmSaveThisEvent(), G4WorkerRunManager::rndmSaveThisEvent(), G4MTRunManager::rndmSaveThisRun(), G4RunManager::rndmSaveThisRun(), G4WorkerRunManager::rndmSaveThisRun(), G4UIQt::SaveIconCallback(), G4UIbatch::SessionStart(), G4VVisCommandGeometrySet::Set(), G4DecayTableMessenger::SetCurrentParticle(), pyglobals::SetG4PyCoutDestination(), G4LocalThreadCoutMessenger::SetNewValue(), G4OpticalParametersMessenger::SetNewValue(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4EmExtraParametersMessenger::SetNewValue(), G4EmLowEParametersMessenger::SetNewValue(), G4EmParametersMessenger::SetNewValue(), G4UIcontrolMessenger::SetNewValue(), G4VisCommandList::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandOpen::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4ProcessManagerMessenger::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4RunMessenger::SetNewValue(), G4TrackingMessenger::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4ToolsSGSceneHandler::SetPlotterHistograms(), G4VViewer::SetTouchable(), G4VBasicShell::ShowCurrent(), SignalHandler(), G4MTRunManagerKernel::StartThread(), G4OpenGLQtViewer::tableWidgetViewerSetItemChanged(), G4VBasicShell::TerminalHelp(), G4OpenGLQtViewer::togglePicking(), G4VViewer::TouchableSetColour(), G4VViewer::TouchableSetVisibility(), G4TheMTRayTracer::Trace(), G4TheRayTracer::Trace(), G4UIQt::UpdateCommandCompleter(), G4OpenGLQtViewer::updateViewerPropertiesTableWidget(), G4UIQt::VisParameterCallback(), G4RunManagerKernel::~G4RunManagerKernel(), G4UIcommand::~G4UIcommand(), G4UIQt::~G4UIQt(), G4UIterminal::~G4UIterminal(), G4UIWin32::~G4UIWin32(), G4UIXm::~G4UIXm(), and G4VisManager::~G4VisManager().

◆ GetVerboseLevel()

G4int G4UImanager::GetVerboseLevel ( ) const
inline

◆ IsLastCommandOutputTreated()

bool G4UImanager::IsLastCommandOutputTreated ( )
inline

Definition at line 256 of file G4UImanager.hh.

References fLastCommandOutputTreated.

Referenced by G4UIQt::ReceiveG4cout().

◆ ListAlias()

void G4UImanager::ListAlias ( )

Definition at line 766 of file G4UImanager.cc.

767{
768 aliasList->List();
769}

References aliasList, and G4UIaliasList::List().

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ ListCommands()

void G4UImanager::ListCommands ( const char *  direc)

Definition at line 660 of file G4UImanager.cc.

661{
662 G4UIcommandTree* comTree = FindDirectory(direct);
663 if(comTree != nullptr)
664 {
665 comTree->List();
666 }
667 else
668 {
669 G4cout << direct << " is not found." << G4endl;
670 }
671}
void List() const

References FindDirectory(), G4cout, G4endl, and G4UIcommandTree::List().

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 336 of file G4UImanager.cc.

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

References cd, and Foreach().

Referenced by LoopS().

◆ LoopS()

void G4UImanager::LoopS ( const char *  valueList)

Definition at line 315 of file G4UImanager.cc.

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

References d1, d2, and Loop().

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ Notify()

G4bool G4UImanager::Notify ( G4ApplicationState  requestedState)
virtual

Implements G4VStateDependent.

Definition at line 703 of file G4UImanager.cc.

704{
706 {
707 if(requestedState == G4State_EventProc &&
708 G4StateManager::GetStateManager()->GetPreviousState() ==
710 {
711 PauseSession("BeginOfEvent");
712 }
713 }
715 {
716 if(requestedState == G4State_GeomClosed &&
717 G4StateManager::GetStateManager()->GetPreviousState() ==
719 {
720 PauseSession("EndOfEvent");
721 }
722 }
723 return true;
724}
@ G4State_EventProc
@ G4State_GeomClosed
static G4StateManager * GetStateManager()
void PauseSession(const char *msg)
Definition: G4UImanager.cc:653

References G4State_EventProc, G4State_GeomClosed, G4StateManager::GetStateManager(), pauseAtBeginOfEvent, pauseAtEndOfEvent, and PauseSession().

◆ operator!=() [1/2]

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

◆ operator!=() [2/2]

G4bool G4VStateDependent::operator!= ( const G4VStateDependent right) const
inherited

Definition at line 66 of file G4VStateDependent.cc.

67{
68 return (this != &right);
69}

◆ operator=()

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

◆ operator==() [1/2]

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

◆ operator==() [2/2]

G4bool G4VStateDependent::operator== ( const G4VStateDependent right) const
inherited

Definition at line 61 of file G4VStateDependent.cc.

62{
63 return (this == &right);
64}

◆ ParseMacroSearchPath()

void G4UImanager::ParseMacroSearchPath ( )

Definition at line 786 of file G4UImanager.cc.

787{
788 searchDirs.clear();
789
790 std::size_t idxfirst = 0;
791 std::size_t idxend = 0;
792 G4String pathstring = "";
793 while((idxend = searchPath.find(':', idxfirst)) != G4String::npos)
794 {
795 pathstring = searchPath.substr(idxfirst, idxend - idxfirst);
796 if(pathstring.size() != 0)
797 searchDirs.push_back(pathstring);
798 idxfirst = idxend + 1;
799 }
800
801 pathstring = searchPath.substr(idxfirst, searchPath.size() - idxfirst);
802 if(pathstring.size() != 0)
803 searchDirs.push_back(pathstring);
804}

References searchDirs, and searchPath.

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ PauseSession()

void G4UImanager::PauseSession ( const char *  msg)
private

Definition at line 653 of file G4UImanager.cc.

654{
655 if(session)
656 session->PauseSessionStart(msg);
657}

Referenced by Notify().

◆ RegisterBridge()

void G4UImanager::RegisterBridge ( G4UIbridge brg)

Definition at line 846 of file G4UImanager.cc.

847{
848 if(brg->LocalUI() == this)
849 {
850 G4Exception("G4UImanager::RegisterBridge()", "UI7002", FatalException,
851 "G4UIBridge cannot bridge between same object.");
852 }
853 else
854 {
855 bridges->push_back(brg);
856 }
857}
@ FatalException
G4UImanager * LocalUI() const
Definition: G4UIbridge.hh:55

References bridges, FatalException, G4Exception(), and G4UIbridge::LocalUI().

Referenced by G4UIbridge::G4UIbridge().

◆ RemoveAlias()

void G4UImanager::RemoveAlias ( const char *  aliasName)

Definition at line 758 of file G4UImanager.cc.

759{
760 G4String aL = aliasName;
761 G4String targetAlias = G4StrUtil::strip_copy(aL);
762 aliasList->RemoveAlias(targetAlias);
763}
void RemoveAlias(const char *aliasName)

References aliasList, G4UIaliasList::RemoveAlias(), and G4StrUtil::strip_copy().

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ RemoveCommand()

void G4UImanager::RemoveCommand ( G4UIcommand aCommand)

Definition at line 287 of file G4UImanager.cc.

288{
289 treeTop->RemoveCommand(aCommand);
290 if(fMasterUImanager() != nullptr && G4Threading::G4GetThreadId() == 0)
291 {
293 }
294}
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)
void RemoveWorkerCommand(G4UIcommand *aCommand)
Definition: G4UImanager.cc:297

References fMasterUImanager(), G4Threading::G4GetThreadId(), G4UIcommandTree::RemoveCommand(), RemoveWorkerCommand(), and treeTop.

Referenced by G4UIcommand::~G4UIcommand().

◆ RemoveWorkerCommand()

void G4UImanager::RemoveWorkerCommand ( G4UIcommand aCommand)
private

Definition at line 297 of file G4UImanager.cc.

298{
299 treeTop->RemoveCommand(aCommand, true);
300}

References G4UIcommandTree::RemoveCommand(), and treeTop.

Referenced by RemoveCommand().

◆ SetAlias()

void G4UImanager::SetAlias ( const char *  aliasLine)

Definition at line 734 of file G4UImanager.cc.

735{
736 G4String aLine = aliasLine;
737 G4int i = aLine.find(" ");
738 G4String aliasName = aLine.substr(0, i);
739 G4String aliasValue = aLine.substr(i + 1, aLine.length() - (i + 1));
740 if(aliasValue[0] == '"')
741 {
742 G4String strippedValue;
743 if(aliasValue.back() == '"')
744 {
745 strippedValue = aliasValue.substr(1, aliasValue.length() - 2);
746 }
747 else
748 {
749 strippedValue = aliasValue.substr(1, aliasValue.length() - 1);
750 }
751 aliasValue = strippedValue;
752 }
753
754 aliasList->ChangeAlias(aliasName, aliasValue);
755}
void ChangeAlias(const char *aliasName, const char *aliasValue)

References aliasList, and G4UIaliasList::ChangeAlias().

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

◆ SetCerrFileName()

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

Definition at line 899 of file G4UImanager.cc.

900{
901 // for sequential mode, ignore this method.
902 if(threadID < 0)
903 return;
904
905 if(fileN == "**Screen**")
906 {
907 threadCout->SetCerrFileName(fileN, ifAppend);
908 }
909 else
910 {
911 std::stringstream fn;
912 fn << "G4W_" << threadID << "_" << fileN;
913 threadCout->SetCerrFileName(fn.str(), ifAppend);
914 }
915}
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)

References G4MTcoutDestination::SetCerrFileName(), threadCout, and threadID.

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetCoutDestination()

void G4UImanager::SetCoutDestination ( G4UIsession *const  value)

Definition at line 727 of file G4UImanager.cc.

728{
731}
G4GLOB_DLL G4strstreambuf G4coutbuf
Definition: G4ios.cc:108
G4GLOB_DLL G4strstreambuf G4cerrbuf
Definition: G4ios.cc:109
void SetDestination(G4coutDestination *dest)

References G4cerrbuf, G4coutbuf, and G4strstreambuf::SetDestination().

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 880 of file G4UImanager.cc.

881{
882 // for sequential mode, ignore this method.
883 if(threadID < 0)
884 return;
885
886 if(fileN == "**Screen**")
887 {
888 threadCout->SetCoutFileName(fileN, ifAppend);
889 }
890 else
891 {
892 std::stringstream fn;
893 fn << "G4W_" << threadID << "_" << fileN;
894 threadCout->SetCoutFileName(fn.str(), ifAppend);
895 }
896}
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)

References G4MTcoutDestination::SetCoutFileName(), threadCout, and threadID.

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetG4UIWindow()

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

Definition at line 191 of file G4UImanager.hh.

191{ g4UIWindow = value; }

References g4UIWindow.

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; }

References ignoreCmdNotFound.

Referenced by G4WorkerRunManager::G4WorkerRunManager().

◆ SetLastCommandOutputTreated()

void G4UImanager::SetLastCommandOutputTreated ( )
inline

Definition at line 257 of file G4UImanager.hh.

References fLastCommandOutputTreated.

Referenced by G4UIQt::ReceiveG4cout().

◆ SetMacroSearchPath()

void G4UImanager::SetMacroSearchPath ( const G4String path)
inline

Definition at line 214 of file G4UImanager.hh.

214{ searchPath = path; }

References searchPath.

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

◆ SetMasterUIManager()

void G4UImanager::SetMasterUIManager ( G4bool  val)
inline

Definition at line 219 of file G4UImanager.hh.

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

References bridges, fMasterUImanager(), isMaster, and stackCommandsForBroadcast.

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; }

References maxHistSize.

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ SetPauseAtBeginOfEvent()

void G4UImanager::SetPauseAtBeginOfEvent ( G4bool  vl)
inline

Definition at line 177 of file G4UImanager.hh.

177{ pauseAtBeginOfEvent = vl; }

References pauseAtBeginOfEvent.

Referenced by export_G4UImanager(), and G4RunMessenger::SetNewValue().

◆ SetPauseAtEndOfEvent()

void G4UImanager::SetPauseAtEndOfEvent ( G4bool  vl)
inline

Definition at line 179 of file G4UImanager.hh.

179{ pauseAtEndOfEvent = vl; }

References pauseAtEndOfEvent.

Referenced by export_G4UImanager(), and G4RunMessenger::SetNewValue().

◆ SetSession()

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

◆ SetThreadIgnore()

void G4UImanager::SetThreadIgnore ( G4int  tid = 0)

Definition at line 936 of file G4UImanager.cc.

937{
938 // for sequential mode, ignore this method.
939 if(threadID < 0)
940 {
941 igThreadID = tid;
942 return;
943 }
945}
void SetIgnoreCout(G4int tid=0)
static G4ICOMS_DLL G4int igThreadID
Definition: G4UImanager.hh:305

References igThreadID, G4MTcoutDestination::SetIgnoreCout(), threadCout, and threadID.

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadIgnoreInit()

void G4UImanager::SetThreadIgnoreInit ( G4bool  flg = true)

Definition at line 948 of file G4UImanager.cc.

949{
950 // for sequential mode, ignore this method.
951 if(threadID < 0)
952 {
953 return;
954 }
956}
void SetIgnoreInit(G4bool val=true)

References G4MTcoutDestination::SetIgnoreInit(), threadCout, and threadID.

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadPrefixString()

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

Definition at line 918 of file G4UImanager.cc.

919{
920 // for sequential mode, ignore this method.
921 if(threadID < 0)
922 return;
924}
static constexpr double s
Definition: G4SIunits.hh:154
void SetPrefixString(const G4String &wd="G4WT")

References s, G4MTcoutDestination::SetPrefixString(), threadCout, and threadID.

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetThreadUseBuffer()

void G4UImanager::SetThreadUseBuffer ( G4bool  flg = true)

Definition at line 927 of file G4UImanager.cc.

928{
929 // for sequential mode, ignore this method.
930 if(threadID < 0)
931 return;
933}
void EnableBuffering(G4bool flag=true)

References G4MTcoutDestination::EnableBuffering(), threadCout, and threadID.

Referenced by G4LocalThreadCoutMessenger::SetNewValue().

◆ SetUpForAThread()

void G4UImanager::SetUpForAThread ( G4int  tId)

◆ SetUpForSpecialThread()

void G4UImanager::SetUpForSpecialThread ( G4String  aPrefix)

◆ SetVerboseLevel()

void G4UImanager::SetVerboseLevel ( G4int  val)
inline

◆ SolveAlias()

G4String G4UImanager::SolveAlias ( const char *  aCmd)

Definition at line 424 of file G4UImanager.cc.

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

References aliasList, G4UIaliasList::FindAlias(), G4cerr, G4endl, and ps.

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

◆ StoreHistory() [1/2]

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

Definition at line 627 of file G4UImanager.cc.

628{
629 StoreHistory(true, fileName);
630}
void StoreHistory(const char *fileName="G4history.macro")
Definition: G4UImanager.cc:627

References StoreHistory().

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

◆ StoreHistory() [2/2]

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

Definition at line 633 of file G4UImanager.cc.

634{
635 if(historySwitch)
636 {
637 if(saveHistory)
638 {
639 historyFile.close();
640 }
641 historyFile.open((char*) fileName);
642 saveHistory = true;
643 }
644 else
645 {
646 historyFile.close();
647 saveHistory = false;
648 }
649 saveHistory = historySwitch;
650}

References historyFile, and saveHistory.

◆ UseDoublePrecisionStr()

void G4UImanager::UseDoublePrecisionStr ( G4bool  val)
static

Definition at line 152 of file G4UImanager.cc.

153{
154 doublePrecisionStr = val;
155}

References doublePrecisionStr.

Referenced by G4UIcontrolMessenger::SetNewValue().

Field Documentation

◆ aliasList

G4UIaliasList* G4UImanager::aliasList = nullptr
private

Definition at line 290 of file G4UImanager.hh.

Referenced by G4UImanager(), ListAlias(), RemoveAlias(), SetAlias(), SolveAlias(), and ~G4UImanager().

◆ bridges

std::vector<G4UIbridge*>* G4UImanager::bridges = nullptr
private

Definition at line 298 of file G4UImanager.hh.

Referenced by ApplyCommand(), RegisterBridge(), SetMasterUIManager(), and ~G4UImanager().

◆ commandStack

std::vector<G4String>* G4UImanager::commandStack = nullptr
private

Definition at line 301 of file G4UImanager.hh.

Referenced by ApplyCommand(), G4UImanager(), GetCommandStack(), and ~G4UImanager().

◆ CoutMessenger

G4LocalThreadCoutMessenger* G4UImanager::CoutMessenger = nullptr
private

Definition at line 282 of file G4UImanager.hh.

Referenced by CreateMessenger(), and ~G4UImanager().

◆ doublePrecisionStr

G4bool G4UImanager::doublePrecisionStr = false
staticprivate

Definition at line 307 of file G4UImanager.hh.

Referenced by DoublePrecisionStr(), and UseDoublePrecisionStr().

◆ fLastCommandOutputTreated

G4bool G4UImanager::fLastCommandOutputTreated = true
private

◆ g4UIWindow

G4UIsession* G4UImanager::g4UIWindow = nullptr
private

Definition at line 279 of file G4UImanager.hh.

Referenced by GetG4UIWindow(), and SetG4UIWindow().

◆ historyFile

std::ofstream G4UImanager::historyFile
private

Definition at line 287 of file G4UImanager.hh.

Referenced by ApplyCommand(), StoreHistory(), and ~G4UImanager().

◆ histVec

std::vector<G4String> G4UImanager::histVec
private

Definition at line 289 of file G4UImanager.hh.

Referenced by ApplyCommand(), GetNumberOfHistory(), GetPreviousCommand(), and ~G4UImanager().

◆ ignoreCmdNotFound

G4bool G4UImanager::ignoreCmdNotFound = false
private

Definition at line 299 of file G4UImanager.hh.

Referenced by ApplyCommand(), and SetIgnoreCmdNotFound().

◆ igThreadID

G4int G4UImanager::igThreadID = -1
staticprivate

Definition at line 305 of file G4UImanager.hh.

Referenced by SetThreadIgnore(), SetUpForAThread(), and SetUpForSpecialThread().

◆ isMaster

G4bool G4UImanager::isMaster = false
private

Definition at line 297 of file G4UImanager.hh.

Referenced by ApplyCommand(), and SetMasterUIManager().

◆ lastRC

G4int G4UImanager::lastRC = 0
private

Definition at line 309 of file G4UImanager.hh.

Referenced by ExecuteMacroFile(), Foreach(), and GetLastReturnCode().

◆ maxHistSize

G4int G4UImanager::maxHistSize = 20
private

Definition at line 291 of file G4UImanager.hh.

Referenced by ApplyCommand(), GetMaxHistSize(), and SetMaxHistSize().

◆ pauseAtBeginOfEvent

G4bool G4UImanager::pauseAtBeginOfEvent = false
private

Definition at line 292 of file G4UImanager.hh.

Referenced by GetPauseAtBeginOfEvent(), Notify(), and SetPauseAtBeginOfEvent().

◆ pauseAtEndOfEvent

G4bool G4UImanager::pauseAtEndOfEvent = false
private

Definition at line 293 of file G4UImanager.hh.

Referenced by GetPauseAtEndOfEvent(), Notify(), and SetPauseAtEndOfEvent().

◆ ProfileMessenger

G4ProfilerMessenger* G4UImanager::ProfileMessenger = nullptr
private

Definition at line 283 of file G4UImanager.hh.

Referenced by CreateMessenger(), and ~G4UImanager().

◆ savedCommand

G4UIcommand* G4UImanager::savedCommand = nullptr
private

Definition at line 285 of file G4UImanager.hh.

Referenced by GetCurrentStringValue(), and GetCurrentValues().

◆ savedParameters

G4String G4UImanager::savedParameters
private

Definition at line 284 of file G4UImanager.hh.

Referenced by GetCurrentStringValue().

◆ saveHistory

G4bool G4UImanager::saveHistory = false
private

Definition at line 288 of file G4UImanager.hh.

Referenced by ApplyCommand(), StoreHistory(), and ~G4UImanager().

◆ searchDirs

std::vector<G4String> G4UImanager::searchDirs
private

Definition at line 295 of file G4UImanager.hh.

Referenced by FindMacroPath(), and ParseMacroSearchPath().

◆ searchPath

G4String G4UImanager::searchPath = ""
private

Definition at line 294 of file G4UImanager.hh.

Referenced by GetMacroSearchPath(), ParseMacroSearchPath(), and SetMacroSearchPath().

◆ session

G4UIsession* G4UImanager::session = nullptr
private

Definition at line 278 of file G4UImanager.hh.

Referenced by ExecuteMacroFile(), and GetSession().

◆ stackCommandsForBroadcast

G4bool G4UImanager::stackCommandsForBroadcast = false
private

Definition at line 300 of file G4UImanager.hh.

Referenced by ApplyCommand(), and SetMasterUIManager().

◆ threadCout

G4MTcoutDestination* G4UImanager::threadCout = nullptr
private

◆ threadID

G4int G4UImanager::threadID = -1
private

◆ treeTop

G4UIcommandTree* G4UImanager::treeTop = nullptr
private

◆ UImessenger

G4UIcontrolMessenger* G4UImanager::UImessenger = nullptr
private

Definition at line 280 of file G4UImanager.hh.

Referenced by CreateMessenger(), and ~G4UImanager().

◆ UnitsMessenger

G4UnitsMessenger* G4UImanager::UnitsMessenger = nullptr
private

Definition at line 281 of file G4UImanager.hh.

Referenced by CreateMessenger(), and ~G4UImanager().

◆ verboseLevel

G4int G4UImanager::verboseLevel = 0
private

Definition at line 286 of file G4UImanager.hh.

Referenced by ApplyCommand(), GetVerboseLevel(), and SetVerboseLevel().


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