91 UImessenger(0), UnitsMessenger(0), CoutMessenger(0),
92 isMaster(false),bridges(0),
93 ignoreCmdNotFound(false), stackCommandsForBroadcast(false),
94 threadID(-1), threadCout(0)
124 std::vector<G4UIbridge*>::iterator itr =
bridges->begin();
125 for(;itr!=
bridges->end();itr++)
181 {
return (
this==&right); }
183 {
return (
this!=&right); }
211 for(
G4int i_thParameter=0;i_thParameter<parameterNumber;i_thParameter++)
213 token = savedToken();
215 if( token[(
size_t)0] ==
'"' )
218 token.
append(savedToken(
"\""));
225 const char * aParameterName,
G4bool reGet)
233 if( aParameterName ==
241 const char * aParameterName,
G4bool reGet)
246 const char* t = targetParameter;
247 std::istringstream is(t);
258 const char* t = targetParameter;
259 std::istringstream is(t);
265 const char * aParameterName,
G4bool reGet)
270 const char* t = targetParameter;
271 std::istringstream is(t);
282 const char* t = targetParameter;
283 std::istringstream is(t);
329 c1 += parameterToken();
331 c1 += parameterToken();
333 std::istringstream is(t1);
337 is >> d1 >> d2 >> d3;
338 Loop(mf,vn,d1,d2,d3);
346 for(
G4double d=initialValue;
d<=finalValue;
d+=stepSize)
348 std::ostringstream os;
354 for(
G4double d=initialValue;
d>=finalValue;
d+=stepSize)
356 std::ostringstream os;
362 Foreach(macroFile,variableName,cd);
373 while(!((ca=parameterToken()).isNull()))
380 if(aliasValue(0)==
'"')
383 if(aliasValue(aliasValue.length()-1)==
'"')
384 { strippedValue = aliasValue(1,aliasValue.length()-2); }
386 { strippedValue = aliasValue(1,aliasValue.length()-1); }
387 aliasValue = strippedValue;
395 const char * candidates)
397 G4String candidatesString = candidates;
400 while(!((cd=parameterToken()).isNull()))
416 while((ia !=
G4int(std::string::npos))&&((iz==
G4int(std::string::npos))||(ia<iz)))
422 if( ib ==
G4int(std::string::npos) )
427 G4cerr <<
"Unmatched alias parenthis -- command ignored" <<
G4endl;
431 G4String ps = aCommand(ia+1,aCommand.length()-(ia+1));
434 if(ic!=
G4int(std::string::npos) && ic <
id)
442 if(ia>0) subs = aCommand(0,ia);
443 G4String alis = aCommand(ia+1,ibx-ia-1);
444 G4String rems = aCommand(ibx+1,aCommand.length()-ibx);
449 G4cerr <<
"Alias <" << alis <<
"> not found -- command ignored" <<
G4endl;
453 aCommand = subs+(*alVal)+rems;
454 ia = aCommand.
index(
"{");
475 if( i !=
G4int(std::string::npos) )
477 commandString = aCommand(0,i);
478 commandParameter = aCommand(i+1,aCommand.length()-(i+1));
482 commandString = aCommand;
492 if(commandString(ll,2)==
"//")
495 { commandString.
remove(ll,1); }
498 a1 = commandString(0,ll);
499 a2 = commandString(ll+1,len-ll-1);
500 commandString = a1+a2;
510 std::vector<G4UIbridge*>::iterator itr =
bridges->begin();
511 for(;itr!=
bridges->end();itr++)
513 G4int leng = (*itr)->DirLength();
514 if(commandString(0,leng)==(*itr)->DirName())
515 {
return (*itr)->LocalUI()->ApplyCommand(commandString+
" "+commandParameter); }
520 if( targetCommand == NULL )
525 {
commandStack->push_back(commandString+
" "+commandParameter); }
533 {
commandStack->push_back(commandString+
" "+commandParameter); }
544 G4int commandFailureCode = targetCommand->
DoIt( commandParameter );
545 if(commandFailureCode==0)
548 if(additionalFailureCode > 0)
552 <<
"Error code : " << additionalFailureCode;
553 G4Exception(
"G4UImanager::ApplyCommand",
"UIMAN0123",
555 commandFailureCode += additionalFailureCode;
558 return commandFailureCode;
599 if( targetDir( targetDir.length()-1 ) !=
'/' )
600 { targetDir +=
"/"; }
602 if( targetDir ==
"/" )
605 while( idx <
G4int(targetDir.length())-1 )
608 G4String targetDirString = targetDir(0,i+1);
609 comTree = comTree->
GetTree(targetDirString);
610 if( comTree == NULL )
664 G4String aliasValue = aLine(i+1,aLine.length()-(i+1));
665 if(aliasValue(0)==
'"')
668 if(aliasValue(aliasValue.length()-1)==
'"')
669 { strippedValue = aliasValue(1,aliasValue.length()-2); }
671 { strippedValue = aliasValue(1,aliasValue.length()-1); }
672 aliasValue = strippedValue;
696 {
G4cerr <<
"Directory <" << dir <<
"> is not found." <<
G4endl; }
707 pathstring =
searchPath.substr(idxfirst, idxend-idxfirst);
708 if(pathstring.size() != 0)
searchDirs.push_back(pathstring);
709 idxfirst = idxend + 1;
713 if(pathstring.size() != 0)
searchDirs.push_back(pathstring);
733 for (
size_t i = 0; i <
searchDirs.size(); i++) {
736 macrofile = fullpath;
756 "G4UIBridge cannot bridge between same object.");
785 if(fileN ==
"**Screen**")
789 std::stringstream fn;
800 if(fileN ==
"**Screen**")
804 std::stringstream fn;
G4bool pauseAtBeginOfEvent
std::vector< G4UIbridge * > * bridges
G4String & remove(str_size)
void RemoveAlias(const char *aliasName)
static G4bool DoublePrecisionStr()
void CreateHTML(const char *dir="/")
std::vector< G4String > * GetCommandStack()
std::vector< G4String > searchDirs
void SetPrefixString(const G4String &wd="G4WT")
std::ostringstream G4ExceptionDescription
G4UIcommandTree * FindDirectory(const char *dirName)
void AddNewCommand(G4UIcommand *newCommand)
void StoreHistory(const char *fileName="G4history.macro")
G4int ApplyCommand(const char *aCommand)
void G4iosInitialization()
G4int operator==(const G4UImanager &right) const
virtual G4int DoIt(G4String parameterList)
G4String FindMacroPath(const G4String &fname) const
void AddWorkerCommand(G4UIcommand *newCommand)
G4UIparameter * GetParameter(G4int i) const
std::ofstream historyFile
void RemoveCommand(G4UIcommand *aCommand)
str_size index(const char *, G4int pos=0) const
void SetIgnoreInit(G4bool val=true)
G4int operator!=(const G4UImanager &right) const
#define G4ThreadLocalStatic
const G4UImanager & operator=(const G4UImanager &right)
static G4UImanager * GetUIpointer()
static G4ICOMS_DLL G4UImanager *& fMasterUImanager()
virtual G4UIsession * SessionStart()
static G4UImanager * GetMasterUIpointer()
G4String SolveAlias(const char *aCmd)
void SetThreadIgnoreInit(G4bool flg=true)
static constexpr double ps
G4String GetCurrentValues(const char *aCommand)
virtual void PauseSessionStart(const G4String &Prompt)
static G4ICOMS_DLL G4int igThreadID
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
const XML_Char int const XML_Char * value
G4UImanager * LocalUI() const
void RemoveAlias(const char *aliasName)
const char * data() const
void RegisterBridge(G4UIbridge *brg)
G4String strip(G4int strip_Type=trailing, char c=' ')
G4MTcoutDestination * threadCout
void EnableBuffering(G4bool flag=true)
void RemoveWorkerCommand(G4UIcommand *aCommand)
virtual G4bool Notify(G4ApplicationState requestedState)
void SetAlias(const char *aliasLine)
G4UIcontrolMessenger * UImessenger
G4UIaliasList * aliasList
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
void SetDestination(G4coutDestination *dest)
void SetUpForSpecialThread(G4String aPrefix)
G4GLOB_DLL std::ostream G4cerr
void PauseSession(const char *msg)
void ChangeAlias(const char *aliasName, const char *aliasValue)
G4bool ToBeBroadcasted() const
void Loop(const char *macroFile, const char *variableName, G4double initialValue, G4double finalValue, G4double stepSize=1.0)
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
void SetThreadPrefixString(const G4String &s="W")
static G4ICOMS_DLL G4bool & fUImanagerHasBeenKilled()
void G4SetThreadId(G4int aNewValue)
void SetThreadIgnore(G4int tid=0)
void SetIgnoreCout(G4int tid=0)
void SetCoutDestination(G4UIsession *const value)
G4double GetCurrentDoubleValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
static G4ICOMS_DLL G4UImanager *& fUImanager()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void ListCommands(const char *direc)
std::vector< G4String > * commandStack
G4UIcommandTree * treeTop
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)
static G4bool FileFound(const G4String &fname)
G4int GetCurrentIntValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
G4UIcommand * savedCommand
void ParseMacroSearchPath()
static G4ICOMS_DLL G4bool doublePrecisionStr
void ForeachS(const char *valueList)
G4int GetParameterEntries() const
G4GLOB_DLL std::ostream G4cout
std::vector< G4String > histVec
G4LocalThreadCoutMessenger * CoutMessenger
void SetUpForAThread(G4int tId)
void SetThreadUseBuffer(G4bool flg=true)
G4String GetCurrentValue()
G4String & GetFailureDescription()
G4String & append(const G4String &)
G4UIcommand * FindPath(const char *commandPath) const
G4String * FindAlias(const char *aliasName)
static void UseDoublePrecisionStr(G4bool val)
G4bool stackCommandsForBroadcast
void ExecuteMacroFile(const char *fileName)
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
G4UnitsMessenger * UnitsMessenger
G4String GetParameterName() const
void LoopS(const char *valueList)
void Foreach(const char *macroFile, const char *variableName, const char *candidates)
G4String GetCurrentStringValue(const char *aCommand, G4int parameterNumber=1, G4bool reGet=true)
static G4StateManager * GetStateManager()
G4UIcommandTree * GetTree(G4int i)