00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef G4UImanager_h
00031 #define G4UImanager_h 1
00032
00033 #include "globals.hh"
00034
00035 #include <vector>
00036 #include <fstream>
00037 #include "G4VStateDependent.hh"
00038 #include "G4UIcommandStatus.hh"
00039 class G4UIcommandTree;
00040 class G4UIcommand;
00041 class G4UIsession;
00042 class G4UIcontrolMessenger;
00043 class G4UnitsMessenger;
00044 class G4UIaliasList;
00045
00046
00047
00048
00049
00050
00051
00052
00053 class G4UImanager : public G4VStateDependent
00054 {
00055 public:
00056 static G4UImanager * GetUIpointer();
00057
00058
00059
00060 protected:
00061 G4UImanager();
00062 public:
00063 ~G4UImanager();
00064 private:
00065 G4UImanager(const G4UImanager &right);
00066 const G4UImanager & operator=(const G4UImanager &right);
00067 G4int operator==(const G4UImanager &right) const;
00068 G4int operator!=(const G4UImanager &right) const;
00069
00070 public:
00071 G4String GetCurrentValues(const char * aCommand);
00072
00073
00074
00075
00076 void AddNewCommand(G4UIcommand * newCommand);
00077
00078 void RemoveCommand(G4UIcommand * aCommand);
00079
00080
00081 void ExecuteMacroFile(const char * fileName);
00082
00083 void Loop(const char * macroFile,const char * variableName,
00084 G4double initialValue,G4double finalValue,G4double stepSize=1.0);
00085
00086 void Foreach(const char * macroFile,const char * variableName,
00087 const char * candidates);
00088
00089
00090 G4int ApplyCommand(const char * aCommand);
00091 G4int ApplyCommand(const G4String& aCommand);
00092
00093
00094
00095
00096
00097
00098
00099
00100 void StoreHistory(const char* fileName = "G4history.macro");
00101 void StoreHistory(G4bool historySwitch,
00102 const char* fileName = "G4history.macro");
00103
00104
00105 void ListCommands(const char* direc);
00106
00107
00108 void SetAlias(const char * aliasLine);
00109
00110
00111
00112 void RemoveAlias(const char * aliasName);
00113
00114 void ListAlias();
00115
00116 G4String SolveAlias(const char* aCmd);
00117
00118 void CreateHTML(const char* dir = "/");
00119
00120
00121
00122 public:
00123 void LoopS(const char* valueList);
00124 void ForeachS(const char* valueList);
00125
00126 virtual G4bool Notify(G4ApplicationState requestedState);
00127
00128
00129
00130 private:
00131 void PauseSession(const char* msg);
00132 void CreateMessenger();
00133 G4UIcommandTree* FindDirectory(const char* dirName);
00134
00135
00136
00137
00138
00139
00140 private:
00141 static G4UImanager * fUImanager;
00142 static G4bool fUImanagerHasBeenKilled;
00143 G4UIcommandTree * treeTop;
00144 G4UIsession * session;
00145 G4UIsession * g4UIWindow;
00146 G4UIcontrolMessenger * UImessenger;
00147 G4UnitsMessenger * UnitsMessenger;
00148 G4String savedParameters;
00149 G4UIcommand * savedCommand;
00150 G4int verboseLevel;
00151 std::ofstream historyFile;
00152 G4bool saveHistory;
00153 std::vector<G4String> histVec;
00154 G4UIaliasList* aliasList;
00155 G4int maxHistSize;
00156 G4bool pauseAtBeginOfEvent;
00157 G4bool pauseAtEndOfEvent;
00158 G4String searchPath;
00159 std::vector<G4String> searchDirs;
00160
00161 public:
00162 G4String GetCurrentStringValue(const char * aCommand,
00163 G4int parameterNumber=1, G4bool reGet=true);
00164 G4int GetCurrentIntValue(const char * aCommand,
00165 G4int parameterNumber=1, G4bool reGet=true);
00166 G4double GetCurrentDoubleValue(const char * aCommand,
00167 G4int parameterNumber=1, G4bool reGet=true);
00168 G4String GetCurrentStringValue(const char * aCommand,
00169 const char * aParameterName, G4bool reGet=true);
00170 G4int GetCurrentIntValue(const char * aCommand,
00171 const char * aParameterName, G4bool reGet=true);
00172 G4double GetCurrentDoubleValue(const char * aCommand,
00173 const char * aParameterName, G4bool reGet=true);
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 inline void SetPauseAtBeginOfEvent(G4bool vl)
00184 { pauseAtBeginOfEvent = vl; }
00185 inline G4bool GetPauseAtBeginOfEvent() const
00186 { return pauseAtBeginOfEvent; }
00187 inline void SetPauseAtEndOfEvent(G4bool vl)
00188 { pauseAtEndOfEvent = vl; }
00189 inline G4bool GetPauseAtEndOfEvent() const
00190 { return pauseAtEndOfEvent; }
00191
00192
00193
00194
00195
00196 public:
00197 inline G4UIcommandTree * GetTree() const
00198 { return treeTop; }
00199 inline G4UIsession * GetSession() const
00200 { return session; }
00201 inline G4UIsession * GetG4UIWindow() const
00202 { return g4UIWindow; }
00203 public:
00204 inline void SetSession(G4UIsession *const value)
00205 { session = value; }
00206 inline void SetG4UIWindow(G4UIsession *const value)
00207 { g4UIWindow = value; }
00208
00209 void SetCoutDestination(G4UIsession *const value);
00210
00211
00212
00213
00214
00215 public:
00216 inline void SetVerboseLevel(G4int val)
00217 { verboseLevel = val; }
00218 inline G4int GetVerboseLevel() const
00219 { return verboseLevel; }
00220 inline G4int GetNumberOfHistory() const
00221 { return histVec.size(); }
00222 inline G4String GetPreviousCommand(G4int i) const
00223 {
00224 G4String st;
00225 if(i>=0 && i<G4int(histVec.size()))
00226 { st = histVec[i]; }
00227 return st;
00228 }
00229 inline void SetMaxHistSize(G4int mx)
00230 { maxHistSize = mx; }
00231 inline G4int GetMaxHistSize() const
00232 { return maxHistSize; }
00233
00234 inline void SetMacroSearchPath(const G4String& path)
00235 { searchPath = path; }
00236 inline const G4String& GetMacroSearchPath() const
00237 { return searchPath; }
00238 void ParseMacroSearchPath();
00239 G4String FindMacroPath(const G4String& fname) const;
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249 };
00250
00251 #endif