Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/intercoms/src/G4UIcontrolMessenger.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /intercoms/src/G4UIcontrolMessenger.cc (Version 11.3.0) and /intercoms/src/G4UIcontrolMessenger.cc (Version 6.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                    <<   3 // * DISCLAIMER                                                       *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th <<   5 // * The following disclaimer summarizes all the specific disclaimers *
  6 // * the Geant4 Collaboration.  It is provided <<   6 // * of contributors to this software. The specific disclaimers,which *
  7 // * conditions of the Geant4 Software License <<   7 // * govern, are listed with their locations in:                      *
  8 // * LICENSE and available at  http://cern.ch/ <<   8 // *   http://cern.ch/geant4/license                                  *
  9 // * include a list of copyright holders.      << 
 10 // *                                                9 // *                                                                  *
 11 // * Neither the authors of this software syst     10 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     11 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     12 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     13 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  <<  14 // * use.                                                             *
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                               15 // *                                                                  *
 18 // * This  code  implementation is the result  <<  16 // * This  code  implementation is the  intellectual property  of the *
 19 // * technical work of the GEANT4 collaboratio <<  17 // * GEANT4 collaboration.                                            *
 20 // * By using,  copying,  modifying or  distri <<  18 // * By copying,  distributing  or modifying the Program (or any work *
 21 // * any work based  on the software)  you  ag <<  19 // * based  on  the Program)  you indicate  your  acceptance of  this *
 22 // * use  in  resulting  scientific  publicati <<  20 // * statement, and all its terms.                                    *
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // *******************************************     21 // ********************************************************************
 25 //                                                 22 //
 26 // G4UIcontrolMessenger                        << 
 27 //                                                 23 //
 28 // Author: Makoto Asai, SLAC - 2001            <<  24 // $Id: G4UIcontrolMessenger.cc,v 1.9 2002/05/15 06:51:32 asaim Exp $
 29 // ------------------------------------------- <<  25 // GEANT4 tag $Name: geant4-05-02-patch-01 $
                                                   >>  26 //
 30                                                    27 
                                                   >>  28 #include <stdlib.h>
 31 #include "G4UIcontrolMessenger.hh"                 29 #include "G4UIcontrolMessenger.hh"
 32                                                <<  30 #include "G4UImanager.hh"
 33 #include "G4StateManager.hh"                   <<  31 #include "G4UIdirectory.hh"
 34 #include "G4Tokenizer.hh"                      <<  32 #include "G4UIcommand.hh"
 35 #include "G4UIaliasList.hh"                    <<  33 #include "G4UIparameter.hh"
 36 #include "G4UIcmdWithABool.hh"                 << 
 37 #include "G4UIcmdWithAString.hh"                   34 #include "G4UIcmdWithAString.hh"
 38 #include "G4UIcmdWithAnInteger.hh"                 35 #include "G4UIcmdWithAnInteger.hh"
 39 #include "G4UIcmdWithoutParameter.hh"              36 #include "G4UIcmdWithoutParameter.hh"
 40 #include "G4UIcommand.hh"                      <<  37 #include "G4UIaliasList.hh"
 41 #include "G4UIdirectory.hh"                    <<  38 #include "G4StateManager.hh"
 42 #include "G4UImanager.hh"                      << 
 43 #include "G4UIparameter.hh"                    << 
 44 #include "G4UIsession.hh"                      << 
 45 #include "G4ios.hh"                                39 #include "G4ios.hh"
 46                                                    40 
 47 #include <cstdlib>                             << 
 48                                                << 
 49 // ------------------------------------------- << 
 50 G4UIcontrolMessenger::G4UIcontrolMessenger()       41 G4UIcontrolMessenger::G4UIcontrolMessenger()
 51 {                                                  42 {
 52   controlDirectory = new G4UIdirectory("/contr     43   controlDirectory = new G4UIdirectory("/control/");
 53   controlDirectory->SetGuidance("UI control co     44   controlDirectory->SetGuidance("UI control commands.");
 54                                                    45 
 55   macroPathCommand = new G4UIcmdWithAString("/ <<  46   ExecuteCommand = new G4UIcmdWithAString("/control/execute",this);
 56   macroPathCommand->SetGuidance(               << 
 57     "Set macro search path"                    << 
 58     " with colon-separated list.");            << 
 59   macroPathCommand->SetParameterName("path", f << 
 60                                                << 
 61   ExecuteCommand = new G4UIcmdWithAString("/co << 
 62   ExecuteCommand->SetGuidance("Execute a macro     47   ExecuteCommand->SetGuidance("Execute a macro file.");
 63   ExecuteCommand->SetParameterName("fileName", <<  48   ExecuteCommand->SetParameterName("fileName",false);
 64   ExecuteCommand->SetToBeBroadcasted(false);   << 
 65                                                    49 
 66   loopCommand = new G4UIcommand("/control/loop <<  50   loopCommand = new G4UIcommand("/control/loop",this);
 67   loopCommand->SetGuidance("Execute a macro fi     51   loopCommand->SetGuidance("Execute a macro file more than once.");
 68   loopCommand->SetGuidance("Loop counter can b     52   loopCommand->SetGuidance("Loop counter can be used as an aliased variable.");
 69   auto* param1 = new G4UIparameter("macroFile" <<  53   G4UIparameter* param1 = new G4UIparameter("macroFile",'s',false);
 70   loopCommand->SetParameter(param1);               54   loopCommand->SetParameter(param1);
 71   auto* param2 = new G4UIparameter("counterNam <<  55   G4UIparameter* param2 = new G4UIparameter("counterName",'s',false);
 72   loopCommand->SetParameter(param2);               56   loopCommand->SetParameter(param2);
 73   auto* param3 = new G4UIparameter("initialVal <<  57   G4UIparameter* param3 = new G4UIparameter("initialValue",'d',false);
 74   loopCommand->SetParameter(param3);               58   loopCommand->SetParameter(param3);
 75   auto* param4 = new G4UIparameter("finalValue <<  59   G4UIparameter* param4 = new G4UIparameter("finalValue",'d',false);
 76   loopCommand->SetParameter(param4);               60   loopCommand->SetParameter(param4);
 77   auto* param5 = new G4UIparameter("stepSize", <<  61   G4UIparameter* param5 = new G4UIparameter("stepSize",'d',true);
 78   param5->SetDefaultValue(1.0);                    62   param5->SetDefaultValue(1.0);
 79   loopCommand->SetParameter(param5);               63   loopCommand->SetParameter(param5);
 80   loopCommand->SetToBeBroadcasted(false);      << 
 81                                                    64 
 82   foreachCommand = new G4UIcommand("/control/f <<  65   foreachCommand = new G4UIcommand("/control/foreach",this);
 83   foreachCommand->SetGuidance("Execute a macro     66   foreachCommand->SetGuidance("Execute a macro file more than once.");
 84   foreachCommand->SetGuidance("Loop counter ca     67   foreachCommand->SetGuidance("Loop counter can be used as an aliased variable.");
 85   foreachCommand->SetGuidance("Values must be      68   foreachCommand->SetGuidance("Values must be separated by a space.");
 86   auto* param6 = new G4UIparameter("macroFile" <<  69   G4UIparameter* param6 = new G4UIparameter("macroFile",'s',false);
 87   foreachCommand->SetParameter(param6);            70   foreachCommand->SetParameter(param6);
 88   auto* param7 = new G4UIparameter("counterNam <<  71   G4UIparameter* param7 = new G4UIparameter("counterName",'s',false);
 89   foreachCommand->SetParameter(param7);            72   foreachCommand->SetParameter(param7);
 90   auto* param8 = new G4UIparameter("valueList" <<  73   G4UIparameter* param8 = new G4UIparameter("valueList",'s',false);
 91   foreachCommand->SetParameter(param8);            74   foreachCommand->SetParameter(param8);
 92   foreachCommand->SetToBeBroadcasted(false);   <<  75   
 93                                                <<  76   suppressAbortionCommand = new G4UIcmdWithAnInteger("/control/suppressAbortion",this);
 94   suppressAbortionCommand = new G4UIcmdWithAnI << 
 95   suppressAbortionCommand->SetGuidance("Suppre     77   suppressAbortionCommand->SetGuidance("Suppress the program abortion caused by G4Exception.");
 96   suppressAbortionCommand->SetGuidance("Suppre     78   suppressAbortionCommand->SetGuidance("Suppression level = 0 : no suppression");
 97   suppressAbortionCommand->SetGuidance("           79   suppressAbortionCommand->SetGuidance("                  = 1 : suppress during EventProc state");
 98   suppressAbortionCommand->SetGuidance(        <<  80   suppressAbortionCommand->SetGuidance("                  = 2 : full suppression, i.e. no abortion by G4Exception");
 99     "                  = 2 : full suppression, <<  81   suppressAbortionCommand->SetGuidance("When abortion is suppressed, you will get error messages issued by G4Exception,");
100     "G4Exception");                            <<  82   suppressAbortionCommand->SetGuidance("and there is NO guarantee for the correct result after the G4Exception error message.");
101   suppressAbortionCommand->SetGuidance(        <<  83   suppressAbortionCommand->SetParameterName("level",true);
102     "When abortion is suppressed, you will get << 
103     "G4Exception,");                           << 
104   suppressAbortionCommand->SetGuidance(        << 
105     "and there is NO guarantee for the correct << 
106     "error message.");                         << 
107   suppressAbortionCommand->SetParameterName("l << 
108   suppressAbortionCommand->SetRange("level >=      84   suppressAbortionCommand->SetRange("level >= 0 && level <= 2");
109   suppressAbortionCommand->SetDefaultValue(0);     85   suppressAbortionCommand->SetDefaultValue(0);
110                                                    86 
111   verboseCommand = new G4UIcmdWithAnInteger("/ <<  87   verboseCommand = new G4UIcmdWithAnInteger("/control/verbose",this);
112   verboseCommand->SetGuidance("Applied command     88   verboseCommand->SetGuidance("Applied command will also be shown on screen.");
113   verboseCommand->SetGuidance("This command is     89   verboseCommand->SetGuidance("This command is useful with MACRO file.");
114   verboseCommand->SetGuidance("  0 : silent");     90   verboseCommand->SetGuidance("  0 : silent");
115   verboseCommand->SetGuidance("  1 : only the      91   verboseCommand->SetGuidance("  1 : only the valid commands are shown.");
116   verboseCommand->SetGuidance("  2 : comment l     92   verboseCommand->SetGuidance("  2 : comment lines are also shown (default).");
117   verboseCommand->SetParameterName("switch", t <<  93   verboseCommand->SetParameterName("switch",true);
118   verboseCommand->SetRange("switch >= 0 && swi     94   verboseCommand->SetRange("switch >= 0 && switch <=2");
119   verboseCommand->SetDefaultValue(2);              95   verboseCommand->SetDefaultValue(2);
120                                                <<  96   
121   doublePrecCommand = new G4UIcmdWithABool("/c <<  97   historyCommand = new G4UIcmdWithAString("/control/saveHistory",this);
122   doublePrecCommand->SetGuidance(              << 
123     "Use double precision for printing out the << 
124   doublePrecCommand->SetParameterName("useDoub << 
125   doublePrecCommand->SetDefaultValue(true);    << 
126                                                << 
127   historyCommand = new G4UIcmdWithAString("/co << 
128   historyCommand->SetGuidance("Store command h     98   historyCommand->SetGuidance("Store command history to a file.");
129   historyCommand->SetGuidance("Defaul file nam     99   historyCommand->SetGuidance("Defaul file name is G4history.macro.");
130   historyCommand->SetParameterName("fileName", << 100   historyCommand->SetParameterName("fileName",true);
131   historyCommand->SetDefaultValue("G4History.m    101   historyCommand->SetDefaultValue("G4History.macro");
132   historyCommand->SetToBeBroadcasted(false);   << 102   
133                                                << 103   stopStoreHistoryCommand 
134   stopStoreHistoryCommand = new G4UIcmdWithout << 104     = new G4UIcmdWithoutParameter("/control/stopSavingHistory",this);
135   stopStoreHistoryCommand->SetGuidance("Stop s    105   stopStoreHistoryCommand->SetGuidance("Stop saving history file.");
136   stopStoreHistoryCommand->SetToBeBroadcasted( << 
137                                                   106 
138   aliasCommand = new G4UIcommand("/control/ali << 107   aliasCommand = new G4UIcommand("/control/alias",this);
139   aliasCommand->SetGuidance("Set an alias.");     108   aliasCommand->SetGuidance("Set an alias.");
140   aliasCommand->SetGuidance("String can be ali    109   aliasCommand->SetGuidance("String can be aliased by this command.");
141   aliasCommand->SetGuidance("The string may co    110   aliasCommand->SetGuidance("The string may contain one or more spaces,");
142   aliasCommand->SetGuidance("the string must b    111   aliasCommand->SetGuidance("the string must be enclosed by double quotes (\").");
143   aliasCommand->SetGuidance("To use an alias,     112   aliasCommand->SetGuidance("To use an alias, enclose the alias name with");
144   aliasCommand->SetGuidance("parenthesis \"{\" << 113   aliasCommand->SetGuidance("parenthis \"{\" and \"}\".");
145   auto* aliasNameParam = new G4UIparameter("al << 114   G4UIparameter* aliasNameParam = new G4UIparameter("aliasName",'s',false);
146   aliasCommand->SetParameter(aliasNameParam);     115   aliasCommand->SetParameter(aliasNameParam);
147   auto* aliasValueParam = new G4UIparameter("a << 116   G4UIparameter* aliasValueParam = new G4UIparameter("aliasValue",'s',false);
148   aliasCommand->SetParameter(aliasValueParam);    117   aliasCommand->SetParameter(aliasValueParam);
149                                                   118 
150   unaliasCommand = new G4UIcmdWithAString("/co << 119   unaliasCommand = new G4UIcmdWithAString("/control/unalias",this);
151   unaliasCommand->SetGuidance("Remove an alias    120   unaliasCommand->SetGuidance("Remove an alias.");
152   unaliasCommand->SetParameterName("aliasName" << 121   unaliasCommand->SetParameterName("aliasName",false);
153                                                   122 
154   listAliasCommand = new G4UIcmdWithoutParamet << 123   listAliasCommand = new G4UIcmdWithoutParameter("/control/listAlias",this);
155   listAliasCommand->SetGuidance("List aliases.    124   listAliasCommand->SetGuidance("List aliases.");
156                                                   125 
157   getEnvCmd = new G4UIcmdWithAString("/control << 126   shellCommand = new G4UIcmdWithAString("/control/shell",this);
158   getEnvCmd->SetGuidance("Get a shell environm << 
159   getEnvCmd->SetToBeBroadcasted(false);        << 
160                                                << 
161   getValCmd = new G4UIcommand("/control/getVal << 
162   getValCmd->SetGuidance("Get the current valu << 
163   getValCmd->SetGuidance(                      << 
164     "Command is ignored if the UI command does << 
165   getValCmd->SetGuidance(" Syntax : <alias_nam << 
166   auto* aliName = new G4UIparameter("alias_nam << 
167   getValCmd->SetParameter(aliName);            << 
168   auto* comName = new G4UIparameter("UI_comman << 
169   getValCmd->SetParameter(comName);            << 
170   auto* iIdxParam = new G4UIparameter("iIdx",  << 
171   iIdxParam->SetDefaultValue(0);               << 
172   getValCmd->SetParameter(iIdxParam);          << 
173   getValCmd->SetToBeBroadcasted(false);        << 
174                                                << 
175   echoCmd = new G4UIcmdWithAString("/control/e << 
176   echoCmd->SetGuidance("Display the valueramet << 
177   echoCmd->SetGuidance("If alias is contained, << 
178                                                << 
179   shellCommand = new G4UIcmdWithAString("/cont << 
180   shellCommand->SetGuidance("Execute a (Unix)     127   shellCommand->SetGuidance("Execute a (Unix) SHELL command.");
181   shellCommand->SetToBeBroadcasted(false);     << 
182                                                   128 
183   ManualCommand = new G4UIcmdWithAString("/con << 129   ManualCommand = new G4UIcmdWithAString("/control/manual",this);
184   ManualCommand->SetGuidance("Display all of s    130   ManualCommand->SetGuidance("Display all of sub-directories and commands.");
185   ManualCommand->SetGuidance("Directory path s    131   ManualCommand->SetGuidance("Directory path should be given by FULL-PATH.");
186   ManualCommand->SetParameterName("dirPath", t << 132   ManualCommand->SetParameterName("dirPath",true);
187   ManualCommand->SetDefaultValue("/");            133   ManualCommand->SetDefaultValue("/");
188   ManualCommand->SetToBeBroadcasted(false);    << 
189                                                   134 
190   HTMLCommand = new G4UIcmdWithAString("/contr << 135   HTMLCommand = new G4UIcmdWithAString("/control/createHTML",this);
191   HTMLCommand->SetGuidance("Generate HTML file    136   HTMLCommand->SetGuidance("Generate HTML files for all of sub-directories and commands.");
192   HTMLCommand->SetGuidance("Directory path sho    137   HTMLCommand->SetGuidance("Directory path should be given by FULL-PATH.");
193   HTMLCommand->SetParameterName("dirPath", tru << 138   HTMLCommand->SetParameterName("dirPath",true);
194   HTMLCommand->SetDefaultValue("/");              139   HTMLCommand->SetDefaultValue("/");
195   HTMLCommand->SetToBeBroadcasted(false);      << 
196                                                   140 
197   maxStoredHistCommand = new G4UIcmdWithAnInte << 141   maxStoredHistCommand = new G4UIcmdWithAnInteger("/control/maximumStoredHistory",this);
198   maxStoredHistCommand->SetGuidance("Set maxim    142   maxStoredHistCommand->SetGuidance("Set maximum number of stored UI commands.");
199   maxStoredHistCommand->SetParameterName("max" << 143   maxStoredHistCommand->SetParameterName("max",true);
200   maxStoredHistCommand->SetDefaultValue(20);      144   maxStoredHistCommand->SetDefaultValue(20);
201                                                << 
202   ifCommand = new G4UIcommand("/control/if", t << 
203   ifCommand->SetGuidance("Execute a macro file << 
204   ifCommand->SetGuidance(" Syntax : <double> < << 
205   auto* leftParam = new G4UIparameter("left",  << 
206   ifCommand->SetParameter(leftParam);          << 
207   auto* compParam = new G4UIparameter("comp",  << 
208   compParam->SetParameterCandidates("> >= < <= << 
209   ifCommand->SetParameter(compParam);          << 
210   auto* rightParam = new G4UIparameter("right" << 
211   ifCommand->SetParameter(rightParam);         << 
212   auto* macroFileParam = new G4UIparameter("ma << 
213   ifCommand->SetParameter(macroFileParam);     << 
214   ifCommand->SetToBeBroadcasted(false);        << 
215                                                << 
216   doifCommand = new G4UIcommand("/control/doif << 
217   doifCommand->SetGuidance("Execute a UI comma << 
218   doifCommand->SetGuidance(" Syntax : <double> << 
219   auto* doleftParam = new G4UIparameter("left" << 
220   doifCommand->SetParameter(doleftParam);      << 
221   auto* docompParam = new G4UIparameter("comp" << 
222   docompParam->SetParameterCandidates("> >= <  << 
223   doifCommand->SetParameter(docompParam);      << 
224   auto* dorightParam = new G4UIparameter("righ << 
225   doifCommand->SetParameter(dorightParam);     << 
226   auto* comParam = new G4UIparameter("UI_comma << 
227   doifCommand->SetParameter(comParam);         << 
228   doifCommand->SetToBeBroadcasted(false);      << 
229                                                << 
230   addCommand = new G4UIcommand("/control/add", << 
231   addCommand->SetGuidance("Define a new alias  << 
232   addCommand->SetGuidance(" Syntax : <new_alia << 
233   addCommand->SetGuidance(" <new_alias> may be << 
234   addCommand->SetGuidance(" aliased value is a << 
235   auto* newAlias1 = new G4UIparameter("new_ali << 
236   addCommand->SetParameter(newAlias1);         << 
237   auto* val1a = new G4UIparameter("value1", 'd << 
238   addCommand->SetParameter(val1a);             << 
239   auto* val1b = new G4UIparameter("value2", 'd << 
240   addCommand->SetParameter(val1b);             << 
241   addCommand->SetToBeBroadcasted(false);       << 
242                                                << 
243   subtractCommand = new G4UIcommand("/control/ << 
244   subtractCommand->SetGuidance("Define a new a << 
245   subtractCommand->SetGuidance(" Syntax : <new << 
246   subtractCommand->SetGuidance(" <new_alias> m << 
247   subtractCommand->SetGuidance(" aliased value << 
248   auto* newAlias2 = new G4UIparameter("new_ali << 
249   subtractCommand->SetParameter(newAlias2);    << 
250   auto* val2a = new G4UIparameter("value1", 'd << 
251   subtractCommand->SetParameter(val2a);        << 
252   auto* val2b = new G4UIparameter("value2", 'd << 
253   subtractCommand->SetParameter(val2b);        << 
254   subtractCommand->SetToBeBroadcasted(false);  << 
255                                                << 
256   multiplyCommand = new G4UIcommand("/control/ << 
257   multiplyCommand->SetGuidance("Define a new a << 
258   multiplyCommand->SetGuidance(" Syntax : <new << 
259   multiplyCommand->SetGuidance(" <new_alias> m << 
260   multiplyCommand->SetGuidance(" aliased value << 
261   auto* newAlias3 = new G4UIparameter("new_ali << 
262   multiplyCommand->SetParameter(newAlias3);    << 
263   auto* val3a = new G4UIparameter("value1", 'd << 
264   multiplyCommand->SetParameter(val3a);        << 
265   auto* val3b = new G4UIparameter("value2", 'd << 
266   multiplyCommand->SetParameter(val3b);        << 
267   multiplyCommand->SetToBeBroadcasted(false);  << 
268                                                << 
269   divideCommand = new G4UIcommand("/control/di << 
270   divideCommand->SetGuidance("Define a new ali << 
271   divideCommand->SetGuidance(" Syntax : <new_a << 
272   divideCommand->SetGuidance(" <new_alias> may << 
273   divideCommand->SetGuidance(" aliased value i << 
274   auto* newAlias4 = new G4UIparameter("new_ali << 
275   divideCommand->SetParameter(newAlias4);      << 
276   auto* val4a = new G4UIparameter("value1", 'd << 
277   divideCommand->SetParameter(val4a);          << 
278   auto* val4b = new G4UIparameter("value2", 'd << 
279   val4b->SetParameterRange("value2 != 0.");    << 
280   divideCommand->SetParameter(val4b);          << 
281   divideCommand->SetToBeBroadcasted(false);    << 
282                                                << 
283   remainderCommand = new G4UIcommand("/control << 
284   remainderCommand->SetGuidance("Define a new  << 
285   remainderCommand->SetGuidance(" Syntax : <ne << 
286   remainderCommand->SetGuidance(               << 
287     " <new_alias> may be an already existing a << 
288   remainderCommand->SetGuidance(" aliased valu << 
289   auto* newAlias5 = new G4UIparameter("new_ali << 
290   remainderCommand->SetParameter(newAlias5);   << 
291   auto* val5a = new G4UIparameter("value1", 'i << 
292   remainderCommand->SetParameter(val5a);       << 
293   auto* val5b = new G4UIparameter("value2", 'i << 
294   val4b->SetParameterRange("value2 != 0");     << 
295   remainderCommand->SetParameter(val5b);       << 
296   remainderCommand->SetToBeBroadcasted(false); << 
297                                                << 
298   strifCommand = new G4UIcommand("/control/str << 
299   strifCommand->SetGuidance("Execute a macro f << 
300   strifCommand->SetGuidance(" Syntax : <string << 
301   auto* strleftParam = new G4UIparameter("left << 
302   strifCommand->SetParameter(strleftParam);    << 
303   auto* strcompParam = new G4UIparameter("comp << 
304   strcompParam->SetParameterCandidates("== !=" << 
305   strifCommand->SetParameter(strcompParam);    << 
306   auto* strrightParam = new G4UIparameter("rig << 
307   strifCommand->SetParameter(strrightParam);   << 
308   auto* strmacroFileParam = new G4UIparameter( << 
309   strifCommand->SetParameter(strmacroFileParam << 
310   strifCommand->SetToBeBroadcasted(false);     << 
311                                                << 
312   strdoifCommand = new G4UIcommand("/control/s << 
313   strdoifCommand->SetGuidance("Execute a UI co << 
314   strdoifCommand->SetGuidance(" Syntax : <stri << 
315   auto* strdoleftParam = new G4UIparameter("le << 
316   strdoifCommand->SetParameter(strdoleftParam) << 
317   auto* strdocompParam = new G4UIparameter("co << 
318   strdocompParam->SetParameterCandidates("== ! << 
319   strdoifCommand->SetParameter(strdocompParam) << 
320   auto* strdorightParam = new G4UIparameter("r << 
321   strdoifCommand->SetParameter(strdorightParam << 
322   auto* strdomacroFileParam = new G4UIparamete << 
323   strdoifCommand->SetParameter(strdomacroFileP << 
324   strdoifCommand->SetToBeBroadcasted(false);   << 
325                                                << 
326   ifBatchCommand = new G4UIcmdWithAString("/co << 
327   ifBatchCommand->SetGuidance("Execute a macro << 
328   ifBatchCommand->SetParameterName("macroFile" << 
329   ifBatchCommand->SetToBeBroadcasted(false);   << 
330                                                << 
331   ifInteractiveCommand = new G4UIcmdWithAStrin << 
332   ifInteractiveCommand->SetGuidance(           << 
333     "Execute a macro file if program is runnin << 
334   ifInteractiveCommand->SetParameterName("macr << 
335   ifInteractiveCommand->SetToBeBroadcasted(fal << 
336                                                << 
337   doifBatchCommand = new G4UIcmdWithAString("/ << 
338   doifBatchCommand->SetGuidance("Execute a UI  << 
339   doifBatchCommand->SetParameterName("UIcomman << 
340   doifBatchCommand->SetToBeBroadcasted(false); << 
341                                                << 
342   doifInteractiveCommand = new G4UIcmdWithAStr << 
343   doifInteractiveCommand->SetGuidance(         << 
344     "Execute a UI command if program is runnin << 
345   doifInteractiveCommand->SetParameterName("UI << 
346   doifInteractiveCommand->SetToBeBroadcasted(f << 
347 }                                                 145 }
348                                                   146 
349 // ------------------------------------------- << 
350 G4UIcontrolMessenger::~G4UIcontrolMessenger()     147 G4UIcontrolMessenger::~G4UIcontrolMessenger()
351 {                                                 148 {
352   delete macroPathCommand;                     << 
353   delete ExecuteCommand;                          149   delete ExecuteCommand;
354   delete suppressAbortionCommand;                 150   delete suppressAbortionCommand;
355   delete verboseCommand;                          151   delete verboseCommand;
356   delete doublePrecCommand;                    << 
357   delete historyCommand;                          152   delete historyCommand;
358   delete stopStoreHistoryCommand;                 153   delete stopStoreHistoryCommand;
359   delete ManualCommand;                           154   delete ManualCommand;
360   delete aliasCommand;                            155   delete aliasCommand;
361   delete unaliasCommand;                          156   delete unaliasCommand;
362   delete listAliasCommand;                        157   delete listAliasCommand;
363   delete getEnvCmd;                            << 
364   delete getValCmd;                            << 
365   delete echoCmd;                              << 
366   delete shellCommand;                            158   delete shellCommand;
367   delete loopCommand;                             159   delete loopCommand;
368   delete foreachCommand;                       << 160   delete foreachCommand; 
369   delete HTMLCommand;                             161   delete HTMLCommand;
370   delete maxStoredHistCommand;                    162   delete maxStoredHistCommand;
371   delete ifCommand;                            << 
372   delete doifCommand;                          << 
373   delete addCommand;                           << 
374   delete subtractCommand;                      << 
375   delete multiplyCommand;                      << 
376   delete divideCommand;                        << 
377   delete remainderCommand;                     << 
378   delete strifCommand;                         << 
379   delete strdoifCommand;                       << 
380   delete ifBatchCommand;                       << 
381   delete ifInteractiveCommand;                 << 
382   delete doifBatchCommand;                     << 
383   delete doifInteractiveCommand;               << 
384   delete controlDirectory;                        163   delete controlDirectory;
385 }                                                 164 }
386                                                   165 
387 // ------------------------------------------- << 166 void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
388 void G4UIcontrolMessenger::SetNewValue(G4UIcom << 
389 {                                                 167 {
390   G4UImanager* UI = G4UImanager::GetUIpointer( << 168   G4UImanager * UI = G4UImanager::GetUIpointer();
391                                                << 169   
392   if (command == macroPathCommand) {           << 170   if(command==ExecuteCommand)
393     UI->SetMacroSearchPath(newValue);          << 171   {
394     UI->ParseMacroSearchPath();                << 172     UI->ExecuteMacroFile(newValue);
395   }                                            << 173   }
396   if (command == ExecuteCommand) {             << 174   if(command==suppressAbortionCommand)
397     command->ResetFailure();                   << 175   {
398     UI->ExecuteMacroFile(UI->FindMacroPath(new << 176     G4StateManager::GetStateManager()->SetSuppressAbortion(suppressAbortionCommand->GetNewIntValue(newValue));
399     if (UI->GetLastReturnCode() != 0) {        << 
400       G4ExceptionDescription ed;               << 
401       ed << "Command aborted (" << UI->GetLast << 
402       command->CommandFailed(UI->GetLastReturn << 
403     }                                          << 
404   }                                            << 
405   if (command == suppressAbortionCommand) {    << 
406     G4StateManager::GetStateManager()->SetSupp << 
407       suppressAbortionCommand->GetNewIntValue( << 
408   }                                               177   }
409   if (command == verboseCommand) {             << 178   if(command==verboseCommand)
                                                   >> 179   {
410     UI->SetVerboseLevel(verboseCommand->GetNew    180     UI->SetVerboseLevel(verboseCommand->GetNewIntValue(newValue));
411   }                                               181   }
412   if (command == doublePrecCommand) {          << 182   if(command==historyCommand)
413     G4UImanager::UseDoublePrecisionStr(doubleP << 183   {
414   }                                            << 184     UI->StoreHistory(newValue);
415   if (command == historyCommand) {             << 185   }
416     UI->StoreHistory(newValue);                << 186   if(command==stopStoreHistoryCommand)
417   }                                            << 187   {
418   if (command == stopStoreHistoryCommand) {    << 188     UI->StoreHistory(false);
419     UI->StoreHistory(false);                   << 
420   }                                               189   }
421   if (command == ManualCommand) {              << 190   if(command==ManualCommand)
                                                   >> 191   {
422     UI->ListCommands(newValue);                   192     UI->ListCommands(newValue);
423   }                                               193   }
424   if (command == aliasCommand) {               << 194   if(command==aliasCommand)
                                                   >> 195   {
425     UI->SetAlias(newValue);                       196     UI->SetAlias(newValue);
426   }                                               197   }
427   if (command == unaliasCommand) {             << 198   if(command==unaliasCommand)
                                                   >> 199   {
428     UI->RemoveAlias(newValue);                    200     UI->RemoveAlias(newValue);
429   }                                               201   }
430   if (command == listAliasCommand) {           << 202   if(command==listAliasCommand)
                                                   >> 203   {
431     UI->ListAlias();                              204     UI->ListAlias();
432   }                                               205   }
433   if (command == getEnvCmd) {                  << 206   if(command==shellCommand)
434     command->ResetFailure();                   << 207   {
435     if (std::getenv(newValue) != nullptr) {    << 208     system(newValue);
436       G4String st = newValue;                  << 
437       st += " ";                               << 
438       st += std::getenv(newValue);             << 
439       UI->SetAlias(st.c_str());                << 
440     }                                          << 
441     else {                                     << 
442       G4ExceptionDescription ed;               << 
443       ed << "<" << newValue << "> is not defin << 
444       command->CommandFailed(ed);              << 
445     }                                          << 
446   }                                            << 
447   if (command == getValCmd) {                  << 
448     G4Tokenizer next(newValue);                << 
449     const G4String& aliName = next();          << 
450     const G4String& com = next();              << 
451     const G4String& curVal = UI->GetCurrentVal << 
452     if (!(curVal.empty())) {                   << 
453       G4String theValue = curVal;              << 
454       G4String iIdx = next();                  << 
455       if (!(iIdx.empty())) {                   << 
456         G4int idx = StoI(iIdx);                << 
457         G4Tokenizer nextVal(curVal);           << 
458         for (G4int i = 0; i <= idx; i++) {     << 
459           theValue = nextVal();                << 
460         }                                      << 
461       }                                        << 
462       G4String st = "/control/alias ";         << 
463       st += aliName + " " + theValue;          << 
464       UI->ApplyCommand(st);                    << 
465     }                                          << 
466   }                                            << 
467   if (command == echoCmd) {                    << 
468     G4cout << UI->SolveAlias(newValue) << G4en << 
469   }                                            << 
470   if (command == shellCommand) {               << 
471     command->ResetFailure();                   << 
472     G4int rc = system(newValue);               << 
473     if (rc < 0) {                              << 
474       G4ExceptionDescription ed;               << 
475       ed << "<" << newValue << "> is not a val << 
476       command->CommandFailed(ed);              << 
477     }                                          << 
478   }                                               209   }
479   if (command == loopCommand) {                << 210   if(command==loopCommand)
480     command->ResetFailure();                   << 211   {
481     UI->LoopS(newValue);                          212     UI->LoopS(newValue);
482     if (UI->GetLastReturnCode() != 0) {        << 
483       G4ExceptionDescription ed;               << 
484       ed << "Command aborted (" << UI->GetLast << 
485       command->CommandFailed(UI->GetLastReturn << 
486     }                                          << 
487   }                                               213   }
488   if (command == foreachCommand) {             << 214   if(command==foreachCommand)
489     command->ResetFailure();                   << 215   {
490     UI->ForeachS(newValue);                       216     UI->ForeachS(newValue);
491     if (UI->GetLastReturnCode() != 0) {        << 
492       G4ExceptionDescription ed;               << 
493       ed << "Command aborted (" << UI->GetLast << 
494       command->CommandFailed(UI->GetLastReturn << 
495     }                                          << 
496   }                                               217   }
497   if (command == HTMLCommand) {                << 218   if(command==HTMLCommand)
                                                   >> 219   {
498     UI->CreateHTML(newValue);                     220     UI->CreateHTML(newValue);
499   }                                               221   }
500   if (command == maxStoredHistCommand) {       << 222   if(command==maxStoredHistCommand)
                                                   >> 223   {
501     UI->SetMaxHistSize(maxStoredHistCommand->G    224     UI->SetMaxHistSize(maxStoredHistCommand->GetNewIntValue(newValue));
502   }                                               225   }
503   if (command == ifCommand) {                  << 226 
504     G4Tokenizer next(newValue);                << 
505     G4double l = StoD(next());                 << 
506     const G4String& comp = next();             << 
507     G4double r = StoD(next());                 << 
508     const G4String& mac = next();              << 
509     G4bool x = false;                          << 
510     if (comp == ">") {                         << 
511       x = (l > r);                             << 
512     }                                          << 
513     else if (comp == ">=") {                   << 
514       x = (l >= r);                            << 
515     }                                          << 
516     else if (comp == "<") {                    << 
517       x = (l < r);                             << 
518     }                                          << 
519     else if (comp == "<=") {                   << 
520       x = (l <= r);                            << 
521     }                                          << 
522     else if (comp == "==") {                   << 
523       x = (l == r);                            << 
524     }                                          << 
525     else if (comp == "!=") {                   << 
526       x = (l != r);                            << 
527     }                                          << 
528     if (x) {                                   << 
529       UI->ExecuteMacroFile(UI->FindMacroPath(m << 
530     }                                          << 
531   }                                            << 
532   if (command == doifCommand) {                << 
533     G4Tokenizer next(newValue);                << 
534     G4double l = StoD(next());                 << 
535     const G4String& comp = next();             << 
536     G4double r = StoD(next());                 << 
537                                                << 
538     G4String c1 = next();                      << 
539     G4String ca;                               << 
540     while (!((ca = next()).empty())) {         << 
541       c1 += " ";                               << 
542       c1 += ca;                                << 
543     }                                          << 
544     if (c1[0] == '"') {                        << 
545       G4String strippedValue;                  << 
546       if (c1.back() == '"') {                  << 
547         strippedValue = c1.substr(1, c1.length << 
548       }                                        << 
549       else {                                   << 
550         strippedValue = c1.substr(1, c1.length << 
551       }                                        << 
552       c1 = std::move(strippedValue);           << 
553     }                                          << 
554                                                << 
555     G4bool x = false;                          << 
556     if (comp == ">") {                         << 
557       x = (l > r);                             << 
558     }                                          << 
559     else if (comp == ">=") {                   << 
560       x = (l >= r);                            << 
561     }                                          << 
562     else if (comp == "<") {                    << 
563       x = (l < r);                             << 
564     }                                          << 
565     else if (comp == "<=") {                   << 
566       x = (l <= r);                            << 
567     }                                          << 
568     else if (comp == "==") {                   << 
569       x = (l == r);                            << 
570     }                                          << 
571     else if (comp == "!=") {                   << 
572       x = (l != r);                            << 
573     }                                          << 
574     if (x) {                                   << 
575       UI->ApplyCommand(c1);                    << 
576     }                                          << 
577   }                                            << 
578   if (command == addCommand) {                 << 
579     G4Tokenizer next(newValue);                << 
580     const G4String& newA = next();             << 
581     G4double l = StoD(next());                 << 
582     G4double r = StoD(next());                 << 
583     G4String st = "/control/alias ";           << 
584     st += newA;                                << 
585     st += " ";                                 << 
586     st += DtoS(l + r);                         << 
587     UI->ApplyCommand(st);                      << 
588   }                                            << 
589   if (command == subtractCommand) {            << 
590     G4Tokenizer next(newValue);                << 
591     const G4String& newA = next();             << 
592     G4double l = StoD(next());                 << 
593     G4double r = StoD(next());                 << 
594     G4String st = "/control/alias ";           << 
595     st += newA;                                << 
596     st += " ";                                 << 
597     st += DtoS(l - r);                         << 
598     UI->ApplyCommand(st);                      << 
599   }                                            << 
600   if (command == multiplyCommand) {            << 
601     G4Tokenizer next(newValue);                << 
602     const G4String& newA = next();             << 
603     G4double l = StoD(next());                 << 
604     G4double r = StoD(next());                 << 
605     G4String st = "/control/alias ";           << 
606     st += newA;                                << 
607     st += " ";                                 << 
608     st += DtoS(l * r);                         << 
609     UI->ApplyCommand(st);                      << 
610   }                                            << 
611   if (command == divideCommand) {              << 
612     G4Tokenizer next(newValue);                << 
613     const G4String& newA = next();             << 
614     G4double l = StoD(next());                 << 
615     G4double r = StoD(next());                 << 
616     G4String st = "/control/alias ";           << 
617     st += newA;                                << 
618     st += " ";                                 << 
619     st += DtoS(l / r);                         << 
620     UI->ApplyCommand(st);                      << 
621   }                                            << 
622   if (command == remainderCommand) {           << 
623     G4Tokenizer next(newValue);                << 
624     const G4String& newA = next();             << 
625     G4int l = StoI(next());                    << 
626     G4int r = StoI(next());                    << 
627     G4String st = "/control/alias ";           << 
628     st += newA;                                << 
629     st += " ";                                 << 
630     st += DtoS(l % r);                         << 
631     UI->ApplyCommand(st);                      << 
632   }                                            << 
633   if (command == strifCommand) {               << 
634     G4Tokenizer next(newValue);                << 
635     const G4String& l = next();                << 
636     const G4String& comp = next();             << 
637     const G4String& r = next();                << 
638     const G4String& mac = next();              << 
639     G4bool x = false;                          << 
640     if (comp == "==") {                        << 
641       x = (l == r);                            << 
642     }                                          << 
643     else if (comp == "!=") {                   << 
644       x = (l != r);                            << 
645     }                                          << 
646     if (x) {                                   << 
647       UI->ExecuteMacroFile(UI->FindMacroPath(m << 
648     }                                          << 
649   }                                            << 
650   if (command == strdoifCommand) {             << 
651     G4Tokenizer next(newValue);                << 
652     const G4String& l = next();                << 
653     const G4String& comp = next();             << 
654     const G4String& r = next();                << 
655                                                << 
656     G4String c1 = next();                      << 
657     G4String ca;                               << 
658     while (!((ca = next()).empty())) {         << 
659       c1 += " ";                               << 
660       c1 += ca;                                << 
661     }                                          << 
662     if (c1[0] == '"') {                        << 
663       G4String strippedValue;                  << 
664       if (c1.back() == '"') {                  << 
665         strippedValue = c1.substr(1, c1.length << 
666       }                                        << 
667       else {                                   << 
668         strippedValue = c1.substr(1, c1.length << 
669       }                                        << 
670       c1 = std::move(strippedValue);           << 
671     }                                          << 
672                                                << 
673     G4bool x = false;                          << 
674     if (comp == "==") {                        << 
675       x = (l == r);                            << 
676     }                                          << 
677     else if (comp == "!=") {                   << 
678       x = (l != r);                            << 
679     }                                          << 
680     if (x) {                                   << 
681       UI->ApplyCommand(c1);                    << 
682     }                                          << 
683   }                                            << 
684   if (command == ifBatchCommand) {             << 
685     if (G4UIsession::InSession() == 0) {       << 
686       UI->ExecuteMacroFile(UI->FindMacroPath(n << 
687     }                                          << 
688   }                                            << 
689   if (command == ifInteractiveCommand) {       << 
690     if (G4UIsession::InSession() > 0) {        << 
691       UI->ExecuteMacroFile(UI->FindMacroPath(n << 
692     }                                          << 
693   }                                            << 
694   if (command == doifBatchCommand) {           << 
695     if (G4UIsession::InSession() == 0) {       << 
696       UI->ApplyCommand(newValue);              << 
697     }                                          << 
698   }                                            << 
699   if (command == doifInteractiveCommand) {     << 
700     if (G4UIsession::InSession() > 0) {        << 
701       UI->ApplyCommand(newValue);              << 
702     }                                          << 
703   }                                            << 
704 }                                                 227 }
705                                                   228 
706 // ------------------------------------------- << 229 G4String G4UIcontrolMessenger::GetCurrentValue(G4UIcommand * command)
707 G4String G4UIcontrolMessenger::GetCurrentValue << 
708 {                                                 230 {
709   G4UImanager* UI = G4UImanager::GetUIpointer( << 231   G4UImanager * UI = G4UImanager::GetUIpointer();
710   G4String currentValue;                          232   G4String currentValue;
711                                                << 233   
712   if (command == macroPathCommand) {           << 234   if(command==verboseCommand)
713     currentValue = UI->GetMacroSearchPath();   << 235   {
714   }                                            << 
715   if (command == verboseCommand) {             << 
716     currentValue = verboseCommand->ConvertToSt    236     currentValue = verboseCommand->ConvertToString(UI->GetVerboseLevel());
717   }                                               237   }
718   if (command == doublePrecCommand) {          << 238   if(command==suppressAbortionCommand)
719     currentValue = doublePrecCommand->ConvertT << 239   {
                                                   >> 240     currentValue = suppressAbortionCommand->ConvertToString(G4StateManager::GetStateManager()->GetSuppressAbortion());
720   }                                               241   }
721   if (command == suppressAbortionCommand) {    << 242   if(command==maxStoredHistCommand)
722     currentValue = suppressAbortionCommand->Co << 243   {
723       G4StateManager::GetStateManager()->GetSu << 
724   }                                            << 
725   if (command == maxStoredHistCommand) {       << 
726     currentValue = maxStoredHistCommand->Conve    244     currentValue = maxStoredHistCommand->ConvertToString(UI->GetMaxHistSize());
727   }                                               245   }
728                                                << 246   
729   return currentValue;                            247   return currentValue;
730 }                                                 248 }
                                                   >> 249 
                                                   >> 250 
731                                                   251