Geant4  10.02.p03
G4UIGAG Class Reference

#include <G4UIGAG.hh>

Inheritance diagram for G4UIGAG:
Collaboration diagram for G4UIGAG:

Public Member Functions

 G4UIGAG ()
 
 ~G4UIGAG ()
 
G4UIsessionSessionStart ()
 
void PauseSessionStart (const G4String &)
 
G4int ReceiveG4cout (const G4String &)
 
G4int ReceiveG4cerr (const G4String &)
 
void SessionTerminate ()
 
void Prompt (const G4String &)
 
G4String GetCommand ()
 
- Public Member Functions inherited from G4UIsession
 G4UIsession ()
 
virtual ~G4UIsession ()
 
- Public Member Functions inherited from G4coutDestination
 G4coutDestination ()
 
virtual ~G4coutDestination ()
 

Private Member Functions

void ExecuteCommand (const G4String &)
 
void ChangeDirectory (const G4String &)
 
void ListDirectory (const G4String &)
 
void TerminalHelp (const G4String &)
 
G4String ModifyPrefix (G4String)
 
G4UIcommandTreeFindDirPath (const G4String &)
 
void ShowCurrent (const G4String &)
 
G4String GetFullPath (const G4String &)
 
void SendCommandProperties (G4UIcommandTree *)
 
void SendParameterProperties (G4UIcommandTree *)
 
void SendAParamProperty (G4UIcommand *)
 
void SendATclParamProperty (G4UIcommand *)
 
void CodeGenJavaTree (G4UIcommandTree *, int recursiveLevel)
 
void CodeGenJavaParams (G4UIcommandTree *, int recursiveLevel)
 
void CodeGenTclTree (G4UIcommandTree *, int recursiveLevel)
 
void CodeGenTclParams (G4UIcommandTree *, int recursiveLevel)
 
void SendDisableList (G4UIcommandTree *, int recursiveLevel)
 
void NotifyStateChange (void)
 
void NotifyCommandUpdate (void)
 
void NotifyParameterUpdate (G4UIcommand *)
 
int CommandUpdated (void)
 
void UpdateState (void)
 
void UpdateParamVal (void)
 
void GetNewTreeStructure (G4UIcommandTree *, int recursiveLevel)
 
void GetNewTreeValues (G4UIcommandTree *, int recursiveLevel)
 

Private Attributes

G4String prefix
 
G4UImanagerUI
 
G4String promptCharacter
 
G4bool iExit
 
G4bool iCont
 
UImode uiMode
 
G4String JVersion
 
G4String TVersion
 
std::vector< G4StringpreviousTreeCommands
 
std::vector< G4StringnewTreeCommands
 
std::vector< G4StringpreviousTreeParams
 
std::vector< G4StringnewTreeParams
 
std::vector< G4UIcommand * > previousTreePCP
 
std::vector< G4UIcommand * > newTreePCP
 

Additional Inherited Members

- Static Protected Attributes inherited from G4coutDestination
static G4coutDestinationmasterG4coutDestination = 0
 

Detailed Description

Definition at line 53 of file G4UIGAG.hh.

Constructor & Destructor Documentation

◆ G4UIGAG()

G4UIGAG::G4UIGAG ( )

Definition at line 39 of file G4UIGAG.cc.

40 {
41  TVersion="T1.0a"; JVersion="J1.0a";
42  //G4cout << "G4UIGAG: Apr15,98." << G4endl;
43  prefix = "/";
45  UI->SetSession(this);
46  UI->SetCoutDestination(this);
49  uiMode = terminal_mode; // GAG
50  iExit = false;
51  iCont = false;
52  // -- Initialize Notify routines begin
54  GetNewTreeStructure(tree,0);
55  GetNewTreeValues(tree,0);
59  // -- end
60 }
void GetNewTreeStructure(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:856
G4String GetStateString(G4ApplicationState aState) const
std::vector< G4String > newTreeCommands
Definition: G4UIGAG.hh:123
std::vector< G4String > newTreeParams
Definition: G4UIGAG.hh:125
void SetSession(G4UIsession *const value)
Definition: G4UImanager.hh:213
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
static G4StateManager * GetStateManager()
UImode uiMode
Definition: G4UIGAG.hh:85
std::vector< G4String > previousTreeParams
Definition: G4UIGAG.hh:124
G4String JVersion
Definition: G4UIGAG.hh:88
G4String promptCharacter
Definition: G4UIGAG.hh:82
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:206
G4UImanager * UI
Definition: G4UIGAG.hh:81
G4String TVersion
Definition: G4UIGAG.hh:89
G4bool iCont
Definition: G4UIGAG.hh:84
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:618
std::vector< G4UIcommand * > newTreePCP
Definition: G4UIGAG.hh:127
G4bool iExit
Definition: G4UIGAG.hh:83
std::vector< G4String > previousTreeCommands
Definition: G4UIGAG.hh:122
G4ApplicationState GetCurrentState() const
void GetNewTreeValues(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:935
std::vector< G4UIcommand * > previousTreePCP
Definition: G4UIGAG.hh:126
Here is the call graph for this function:

◆ ~G4UIGAG()

G4UIGAG::~G4UIGAG ( )

Definition at line 62 of file G4UIGAG.cc.

63 {
64  if( G4UImanager::GetUIpointer() != 0)
65  {
66  UI->SetSession(NULL);
67  UI->SetCoutDestination(NULL);
68  // G4cout << "GAG session deleted" << G4endl;
69  }
70 }
void SetSession(G4UIsession *const value)
Definition: G4UImanager.hh:213
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4UImanager * UI
Definition: G4UIGAG.hh:81
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:618
Here is the call graph for this function:

Member Function Documentation

◆ ChangeDirectory()

void G4UIGAG::ChangeDirectory ( const G4String newCommand)
private

Definition at line 359 of file G4UIGAG.cc.

360 {
361  G4String savedPrefix = prefix;
362  if( newCommand.length() <= 3 )
363  { prefix = "/"; }
364  else
365  {
366  G4String aNewPrefix = newCommand.substr(3,newCommand.length()-3);
367  G4String newPrefix = aNewPrefix.strip(G4String::both);
368  if( newPrefix(0) == '/' )
369  { prefix = newPrefix; }
370  else if( newPrefix(0) != '.' )
371  {
372  prefix += newPrefix;
373  }
374  else
375  { prefix = ModifyPrefix( newPrefix ); }
376  }
377  if( prefix( prefix.length() - 1 ) != '/' )
378  { prefix += "/"; }
379  if( FindDirPath( prefix ) == NULL )
380  {
381  G4cout << "Directory <" << prefix << "> is not found." << G4endl;
382  prefix = savedPrefix;
383  }
384 }
G4String strip(G4int strip_Type=trailing, char c=' ')
G4String ModifyPrefix(G4String)
Definition: G4UIGAG.cc:490
G4UIcommandTree * FindDirPath(const G4String &)
Definition: G4UIGAG.cc:515
G4GLOB_DLL std::ostream G4cout
G4String prefix
Definition: G4UIGAG.hh:80
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CodeGenJavaParams()

void G4UIGAG::CodeGenJavaParams ( G4UIcommandTree tree,
int  recursiveLevel 
)
private

Definition at line 581 of file G4UIGAG.cc.

582 {
583  int treeEntry, commandEntry, i;
584  //G4UIcommand * Comp;
585  G4UIcommandTree * treeLink;
586 
587  treeEntry = tree->GetTreeEntry();
588  commandEntry = tree->GetCommandEntry();
589 
590  for(i=0; i<commandEntry; i++) {
591  SendAParamProperty(tree->GetCommand(i+1));
592  }
593  if( treeEntry == 0 ) return; // end recursion
594 
595  for(i=0; i< treeEntry; i++) {
596  treeLink = tree->GetTree(i+1);
597  G4cout << "@@JDirGuideBegin" << G4endl;
598  G4cout << treeLink->GetPathName() << G4endl << treeLink->GetTitle() << G4endl;
599  G4cout << "@@JDirGuideEnd" << G4endl;
600  CodeGenJavaParams(treeLink, level+1);
601  }
602 }
void SendAParamProperty(G4UIcommand *)
Definition: G4UIGAG.cc:604
G4UIcommand * GetCommand(G4int i)
void CodeGenJavaParams(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:581
const G4String GetPathName() const
G4int GetCommandEntry() const
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
#define G4endl
Definition: G4ios.hh:61
G4int GetTreeEntry() const
const G4String GetTitle() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CodeGenJavaTree()

void G4UIGAG::CodeGenJavaTree ( G4UIcommandTree tree,
int  recursiveLevel 
)
private

Definition at line 563 of file G4UIGAG.cc.

564 {
565  int treeEntry, commandEntry;
566  treeEntry = tree->GetTreeEntry();
567  commandEntry = tree->GetCommandEntry();
568 
569  if(level!=0) {
570  for(int i=0; i<commandEntry; i++){
571  G4cout << tree->GetCommand(i+1)->GetCommandPath() << G4endl;
572  }
573  }
574  if(treeEntry == 0) return; //end recursion
575 
576  for(int j=0; j<treeEntry; j++){
577  CodeGenJavaTree(tree->GetTree(j+1), level+1);
578  }
579 }
G4UIcommand * GetCommand(G4int i)
void CodeGenJavaTree(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:563
G4int GetCommandEntry() const
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
#define G4endl
Definition: G4ios.hh:61
G4int GetTreeEntry() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CodeGenTclParams()

void G4UIGAG::CodeGenTclParams ( G4UIcommandTree tree,
int  recursiveLevel 
)
private

Definition at line 730 of file G4UIGAG.cc.

731 {
732  int treeEntry, commandEntry;
733  G4UIcommand * Comp;
734  treeEntry = tree->GetTreeEntry();
735  commandEntry = tree->GetCommandEntry();
736 
737  for(int com=0; com<commandEntry; com++) {
738  Comp = tree->GetCommand(com+1);
739  SendATclParamProperty(Comp);
740  }
741  if( treeEntry == 0 ) return; // end recursion
742 
743  for( int i=0; i<treeEntry; i++) {
744  CodeGenTclParams(tree->GetTree(i+1), level+1);
745  // be sure the function name is the same
746  }
747 }
void CodeGenTclParams(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:730
void SendATclParamProperty(G4UIcommand *)
Definition: G4UIGAG.cc:749
G4UIcommand * GetCommand(G4int i)
G4int GetCommandEntry() const
G4UIcommandTree * GetTree(G4int i)
G4int GetTreeEntry() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CodeGenTclTree()

void G4UIGAG::CodeGenTclTree ( G4UIcommandTree tree,
int  recursiveLevel 
)
private

Definition at line 668 of file G4UIGAG.cc.

669 {
670  int i, j;
671  int treeEntry, commandEntry, guidanceEntry;
672  treeEntry = tree->GetTreeEntry();
673  commandEntry = tree->GetCommandEntry();
674  G4String commandPath, pathName, title1, title2;
675  G4UIcommandTree * t;
676  G4UIcommand * Comp;
677 
678  for(int com=0; com<commandEntry; com++){
679  Comp = tree->GetCommand(com+1);
680  commandPath = Comp->GetCommandPath();
681  G4cout << commandPath << " @@command" << G4endl;
682  guidanceEntry = Comp->GetGuidanceEntries();
683  if (guidanceEntry == 0){
684  title2 = "...Title not available...";
685  } else {
686  title2 = "";
687  j = 0;
688  while(1){
689  title1 = Comp->GetGuidanceLine(j);
690  for(i=0; i< (int)title1.length(); i++){
691  char c[2];
692  c[0]=title1(i);
693  c[1]= '\0';
694  if( c[0] == '\"') {
695  title2.append("\\\""); // a Backslash and a double quote
696  } else if ( c[0] == '\n' || c[0] == '\r') {
697  title2.append("\\n");
698  } else title2.append(c);
699  }
700  j++;
701  if (j >= guidanceEntry) break;
702  title2.append("\\n");
703  }
704  }
705  G4cout << commandPath << " @@title \""<< title2 <<"\""<< G4endl;
706  }
707 
708  if(treeEntry == 0) return; //end recursion
709 
710  for(i=0; i< treeEntry; i++){
711  t = tree->GetTree(i+1);
712  pathName = t->GetPathName();
713  title1 = t->GetTitle();
714  title2 = "";
715  for(int k=0; k<(int)title1.length(); k++){
716  char c[2];
717  c[0]=title1(k);
718  c[1]= '\0';
719  if( c[0] == '\"')
720  title2.append("\\\""); // a Backslash and a double quote
721  else title2.append(c);
722  }
723  if(level==0) G4cout << pathName<< G4endl;
724  else G4cout << pathName<< " @@cascade"<<G4endl;
725  G4cout << pathName << " @@title \"" << title1 << "\""<<G4endl;
726  CodeGenTclTree(t, level+1);
727  }
728 }
G4int GetGuidanceEntries() const
Definition: G4UIcommand.hh:135
void CodeGenTclTree(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:668
G4UIcommand * GetCommand(G4int i)
const G4String & GetGuidanceLine(G4int i) const
Definition: G4UIcommand.hh:137
const G4String GetPathName() const
G4int GetCommandEntry() const
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
G4String & append(const G4String &)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
#define G4endl
Definition: G4ios.hh:61
G4int GetTreeEntry() const
const G4String GetTitle() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CommandUpdated()

int G4UIGAG::CommandUpdated ( void  )
private

Definition at line 826 of file G4UIGAG.cc.

827 {
828  int added=0, deleted=0;
829  int pEntry= previousTreeCommands.size();
830  int nEntry= newTreeCommands.size();
831  int i,j;
832  for( i=0; i<pEntry; i++) { // check deleted command(s)
833  for( j=0; j<nEntry; j++) {
834  if( previousTreeCommands[i] == newTreeCommands[j]) break;
835  }
836  if( j==nEntry ) {
837  deleted = 1;
838  //G4cout <<"deleted: "<< previousTreeCommands(i) << G4endl;
839  }
840  }
841  for( i=0; i<nEntry; i++) { // check added command(s)
842  for( j=0; j<pEntry; j++) {
843  if( newTreeCommands[i] == previousTreeCommands[j]) break;
844  }
845  if( j==pEntry ) {
846  added = 1;
847  // G4cout <<"added: "<< newTreeCommands(i) << G4endl;
848  }
849  }
850  if( added && deleted==0 ) {G4cout<<"c added"<<G4endl;return added;}
851  if( added==0 && deleted ) {G4cout<<"c deleted"<<G4endl;return deleted;}
852  if( added && deleted ) {G4cout<<"c add/deleted"<<G4endl;return addedAndDeleted;}
853  return notChanged;
854 }
Definition: G4UIGAG.hh:45
std::vector< G4String > newTreeCommands
Definition: G4UIGAG.hh:123
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
std::vector< G4String > previousTreeCommands
Definition: G4UIGAG.hh:122
Here is the caller graph for this function:

◆ ExecuteCommand()

void G4UIGAG::ExecuteCommand ( const G4String aCommand)
private

Definition at line 100 of file G4UIGAG.cc.

101 {
103  if(aCommand.length()<2) return;
104  G4int returnVal = UI->ApplyCommand(aCommand);
105  G4int paramIndex = returnVal % 100;
106  G4int commandStatus = returnVal - paramIndex;
107 
108  UpdateState();
109  if ( uiMode == terminal_mode){
110  switch(commandStatus) {
111  case fCommandSucceeded:
112  break;
113  case fCommandNotFound:
114  // G4cerr << "command not found" << G4endl;
115  G4cerr << "command <" << UI->SolveAlias(aCommand) << "> not found" << G4endl;
116  break;
118  G4cerr << "illegal application state -- command refused" << G4endl;
119  break;
122  G4cerr << "Parameter is wrong type and/or is not omittable (index " << paramIndex << ")" << G4endl;
123  break;
125  G4cerr << "Parameter is out of candidate list (index " << paramIndex << ")" << G4endl;
126  // G4cerr << "Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates() << G4endl;
127  break;
128  case fAliasNotFound:
129  default:
130  G4cerr << "command refused (" << commandStatus << ")" << G4endl;
131  }
132  }else{
133  switch(commandStatus) {
134  case fCommandSucceeded:
135  {
136  GetNewTreeStructure(tree,0);
137  GetNewTreeValues(tree,0);
138  if (CommandUpdated()) {
140  } else {
141  UpdateParamVal(); // if param is updated, call notifyPara...
142  }
146  }
147  break;
148  case fCommandNotFound:
149  G4cout << "@@ErrResult \" <" << UI->SolveAlias(aCommand) << "> command not found.\"" << G4endl;
150  break;
152  G4cout << "@@ErrResult \"Illegal application state -- command refused\"" << G4endl;
153  break;
155  G4cout << "@@ErrResult \"Parameter Out of Range.\"" << G4endl;
156  break;
158  G4cout << "@@ErrResult \"Parameter is wrong type and/or is not omittable.\"" << G4endl;
159  break;
161 // G4cout << "@@ErrResult \"Parameter Out of Candidates. Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates()<< "\"" << G4endl;
162  G4cout << "@@ErrResult \"Parameter Out of Candidates.\"" << G4endl;
163  break;
164  case fAliasNotFound:
165  default:
166  G4cout << "@@ErrResult \"command refused (" << commandStatus << ")\"" << G4endl;
167  }
168  }
169 }
void GetNewTreeStructure(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:856
std::vector< G4String > newTreeCommands
Definition: G4UIGAG.hh:123
std::vector< G4String > newTreeParams
Definition: G4UIGAG.hh:125
int G4int
Definition: G4Types.hh:78
int CommandUpdated(void)
Definition: G4UIGAG.cc:826
UImode uiMode
Definition: G4UIGAG.hh:85
std::vector< G4String > previousTreeParams
Definition: G4UIGAG.hh:124
G4GLOB_DLL std::ostream G4cout
void UpdateParamVal(void)
Definition: G4UIGAG.cc:883
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:206
G4UImanager * UI
Definition: G4UIGAG.hh:81
G4String SolveAlias(const char *aCmd)
Definition: G4UImanager.cc:391
std::vector< G4UIcommand * > newTreePCP
Definition: G4UIGAG.hh:127
#define G4endl
Definition: G4ios.hh:61
std::vector< G4String > previousTreeCommands
Definition: G4UIGAG.hh:122
void UpdateState(void)
Definition: G4UIGAG.cc:813
void GetNewTreeValues(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:935
std::vector< G4UIcommand * > previousTreePCP
Definition: G4UIGAG.hh:126
void NotifyCommandUpdate(void)
Definition: G4UIGAG.cc:798
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindDirPath()

G4UIcommandTree * G4UIGAG::FindDirPath ( const G4String newCommand)
private

Definition at line 515 of file G4UIGAG.cc.

516 {
517  G4UIcommandTree * comTree = UI->GetTree();
518  /*int*/ unsigned idx = 1;
519  while( idx < newCommand.length()-1 )
520  {
521  int i = newCommand.index("/",idx);
522  comTree = comTree->GetTree(G4String(newCommand.substr(0,i+1)));
523  if( comTree == NULL )
524  { return NULL; }
525  idx = i+1;
526  }
527  return comTree;
528 }
str_size index(const char *, G4int pos=0) const
G4UIcommandTree * GetTree(G4int i)
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:206
G4UImanager * UI
Definition: G4UIGAG.hh:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCommand()

G4String G4UIGAG::GetCommand ( )

Definition at line 189 of file G4UIGAG.cc.

190 {
191  G4String newCommand;
192  G4String nullString;
193  while( 1 )
194  {
196  if ( uiMode != terminal_mode ){
197  G4cout << "@@PROMPT \"" << promptCharacter << "\"" << G4endl;
198  }
199  if ( uiMode != java_mode ){
200  G4cout << promptCharacter << "> " << std::flush;
201  }else{
202  G4cout << "@@Ready" << G4endl;
203  }
204  newCommand.readLine( G4cin, FALSE );
205  if (!G4cin.good()) { G4cin.clear(); newCommand = nullString; iExit=false;break;}
206 
207  newCommand = newCommand.strip(G4String::leading);
208  if( newCommand.length() < 1) { break; }
209 
210  while( newCommand(newCommand.length()-1) == '_' )
211  {
212  G4String newLine;
213  newCommand.remove(newCommand.length()-1);
214  newLine.readLine( G4cin );
215  if (!G4cin.good()) { G4cin.clear(); newCommand = nullString; iExit=false;break;}
216  newCommand.append(newLine);
217  }
218 
219  G4String nC = newCommand.strip(G4String::leading);
220  if( nC.length() < 1) { break; }
221 
222  // -------------------- nC.toUpper();
223  if( nC == "@@GAGmodeJAVA" ) {
224  uiMode = java_mode;
225  G4cout << G4endl << "@@Version " << JVersion << G4endl;
226  SendCommandProperties(tree);
228  }
229  else if( nC == "@@GAGmodeTcl" ) {
230  uiMode = tcl_mode;
231  G4cout << G4endl << "@@Version " << TVersion << G4endl;
232  SendCommandProperties(tree);
234  }
235  else if( nC(0) == '#' )
236  { G4cout << nC << G4endl; }
237 
238  else if( nC == "ls" || nC(0,3) == "ls " )
239  { ListDirectory( nC ); }
240  else if( nC == "pwd" )
241  { G4cout << "Current Working Directory : " << prefix << G4endl; }
242  else if( nC(0,2) == "cd" || nC(0,3) == "cd " )
243  { ChangeDirectory( nC ); }
244  else if( nC == "help" || nC(0,5) == "help ")
245  { TerminalHelp( nC ); }
246  else if( nC(0) == '?' )
247  { ShowCurrent( nC ); }
248  else if( nC(0,4) == "hist" || nC == "history")
249  {
250  G4int nh = UI->GetNumberOfHistory();
251  for(int i=0;i<nh;i++)
252  { G4cout << i << ": " << UI->GetPreviousCommand(i) << G4endl; }
253  }
254  else if( nC(0) == '!' )
255  {
256  G4String ss = nC(1,nC.length()-1);
257  G4int vl;
258  const char* tt = ss;
259  std::istringstream is((char*)tt);
260  is >> vl;
261  G4int nh = UI->GetNumberOfHistory();
262  if(vl>=0 && vl<nh)
263  {
264  newCommand = UI->GetPreviousCommand(vl);
265  G4cout << newCommand << G4endl;
266  break;
267  }
268  else
269  { G4cerr << "history " << vl << " is not found." << G4endl; }
270  }
271  else if( nC(0,4) == "exit" )
272  {
273  if( iCont )
274  {
275  if ( uiMode == terminal_mode){
276  G4cerr << "You are now processing RUN." << G4endl;
277  G4cerr << "Please abrot it using \"/run/abort\" command first" << G4endl;
278  G4cerr << " and use \"continue\" command until the application" << G4endl;
279  G4cerr << " becomes to Idle." << G4endl;
280  }else{
281  G4cout << "@@ErrResult \"You are now processing RUN.\"" << G4endl;
282  }
283  }
284  else
285  {
286  iExit = false;
287  newCommand = nullString;
288  break;
289  }
290  }
291  else if( nC == "cont" || nC == "continue" )
292  {
293  iCont = false;
294  newCommand = nullString;
295  break;
296  }
297  else
298  { break; }
299  }
300  return GetFullPath(newCommand);
301 }
G4String & remove(str_size)
G4String GetFullPath(const G4String &)
Definition: G4UIGAG.cc:303
G4String strip(G4int strip_Type=trailing, char c=' ')
std::istream & readLine(std::istream &, G4bool skipWhite=true)
int G4int
Definition: G4Types.hh:78
void ShowCurrent(const G4String &)
Definition: G4UIGAG.cc:342
UImode uiMode
Definition: G4UIGAG.hh:85
#define G4cin
Definition: G4ios.hh:60
G4String JVersion
Definition: G4UIGAG.hh:88
void TerminalHelp(const G4String &)
Definition: G4UIGAG.cc:414
G4String promptCharacter
Definition: G4UIGAG.hh:82
G4GLOB_DLL std::ostream G4cout
void ChangeDirectory(const G4String &)
Definition: G4UIGAG.cc:359
#define FALSE
Definition: globals.hh:52
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:206
G4UImanager * UI
Definition: G4UIGAG.hh:81
void ListDirectory(const G4String &)
Definition: G4UIGAG.cc:386
G4String TVersion
Definition: G4UIGAG.hh:89
G4int GetNumberOfHistory() const
Definition: G4UImanager.hh:229
G4bool iCont
Definition: G4UIGAG.hh:84
void SendCommandProperties(G4UIcommandTree *)
Definition: G4UIGAG.cc:532
G4String & append(const G4String &)
void NotifyStateChange(void)
Definition: G4UIGAG.cc:784
#define G4endl
Definition: G4ios.hh:61
G4bool iExit
Definition: G4UIGAG.hh:83
G4String GetPreviousCommand(G4int i) const
Definition: G4UImanager.hh:231
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFullPath()

G4String G4UIGAG::GetFullPath ( const G4String aNewCommand)
private

Definition at line 303 of file G4UIGAG.cc.

304 {
305  G4String newCommand = aNewCommand;
306  newCommand.strip(G4String::both);
307 
308  G4String tmpString;
309  if( newCommand(0) == '/' )
310  { tmpString = newCommand; }
311  else if( newCommand(0,3) == "../" )
312  {
313  G4String tmpPrefix = prefix;
314  /*G4int*/ unsigned i_direc = 0;
315  while( i_direc < newCommand.length() )
316  {
317  if( newCommand(i_direc,3) == "../" )
318  {
319  i_direc += 3;
320  prefix = ModifyPrefix( G4String("../") );
321  }
322  else
323  { break; }
324  }
325  tmpString = prefix;
326  tmpString.append( newCommand( i_direc, newCommand.length()-i_direc ) );
327  prefix = tmpPrefix;
328  }
329  else
330  {
331  tmpString = prefix;
332  tmpString.append( newCommand );
333  }
334  return tmpString;
335 }
G4String strip(G4int strip_Type=trailing, char c=' ')
G4String ModifyPrefix(G4String)
Definition: G4UIGAG.cc:490
G4String prefix
Definition: G4UIGAG.hh:80
G4String & append(const G4String &)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNewTreeStructure()

void G4UIGAG::GetNewTreeStructure ( G4UIcommandTree tree,
int  recursiveLevel 
)
private

Definition at line 856 of file G4UIGAG.cc.

857 {
858  G4String commandPath;
859  G4String title;
860  G4String pathName; //tree name
861  G4UIcommandTree * t;
862  int treeEntry = tree->GetTreeEntry();
863  int commandEntry = tree->GetCommandEntry();
864 
865  if( level==0 ) { newTreeCommands.clear();}
866  for(int com=0; com<commandEntry; com++){
867  commandPath = tree->GetCommand(com+1)->GetCommandPath();
868  title = tree->GetCommand(com+1)->GetTitle();
869  newTreeCommands.push_back( commandPath + " " + title );
870  }
871 
872  if(treeEntry == 0) return; //end recursion
873 
874  for(int i=0; i< treeEntry; i++){
875  t = tree->GetTree(i+1);
876  pathName = t->GetPathName();
877  title = t->GetTitle();
878  newTreeCommands.push_back( pathName + " " + title );
879  GetNewTreeStructure(t, level+1);
880  }
881 }
void GetNewTreeStructure(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:856
G4UIcommand * GetCommand(G4int i)
std::vector< G4String > newTreeCommands
Definition: G4UIGAG.hh:123
const G4String GetTitle() const
Definition: G4UIcommand.hh:170
const G4String GetPathName() const
G4int GetCommandEntry() const
G4UIcommandTree * GetTree(G4int i)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
G4int GetTreeEntry() const
subroutine title
Definition: hijing1.383.f:5981
const G4String GetTitle() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNewTreeValues()

void G4UIGAG::GetNewTreeValues ( G4UIcommandTree tree,
int  recursiveLevel 
)
private

Definition at line 935 of file G4UIGAG.cc.

936 {
937  G4String commandPath;
938  G4String pathName; //tree name
939  G4UIcommandTree * t;
940  int parameterEntry;
941  int treeEntry = tree->GetTreeEntry();
942  int commandEntry = tree->GetCommandEntry();
943  G4UIcommand * Comp;
944  G4UIparameter * prp;
945  G4String param, str(" ");
946 
947  if( level==0 ) { newTreeParams.clear(); }
948  for(int com=0; com<commandEntry; com++) {
949  Comp = tree->GetCommand(com+1);
950  commandPath = Comp->GetCommandPath();
951  parameterEntry = Comp->GetParameterEntries();
952  param = commandPath +" ";
953  for( int par=0; par< parameterEntry; par++) {
954  prp = (G4UIparameter *)Comp->GetParameter(par);
955  param += prp->GetParameterName() +" ";
956  str(0) = prp->GetParameterType();
957  param += str + " ";
958  param += prp->GetDefaultValue() +" ";
959  param += prp->GetParameterRange() +" ";
960  param += prp->GetParameterCandidates();
961  }
962  newTreeParams.push_back( param + "\n");
963  newTreePCP.push_back( Comp );
964  }
965  if( treeEntry == 0 ) return; // end recursion
966  for( int i=0; i< treeEntry; i++) {
967  t = tree->GetTree(i+1);
968  GetNewTreeValues(t, level+1);
969  }
970 }
G4String GetDefaultValue() const
G4String GetParameterRange() const
G4UIcommand * GetCommand(G4int i)
char GetParameterType() const
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:145
std::vector< G4String > newTreeParams
Definition: G4UIGAG.hh:125
G4int GetCommandEntry() const
G4UIcommandTree * GetTree(G4int i)
G4String GetParameterName() const
G4String GetParameterCandidates() const
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
std::vector< G4UIcommand * > newTreePCP
Definition: G4UIGAG.hh:127
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
G4int GetTreeEntry() const
void GetNewTreeValues(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:935
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ListDirectory()

void G4UIGAG::ListDirectory ( const G4String newCommand)
private

Definition at line 386 of file G4UIGAG.cc.

387 {
388  G4String targetDir('\0');
389  if( newCommand.length() <= 3 )
390  { targetDir = prefix; }
391  else
392  {
393  G4String newPrefix = newCommand.substr(3,newCommand.length()-3);
394  newPrefix.strip(G4String::both);
395  if( newPrefix(0) == '/' )
396  { targetDir = newPrefix; }
397  else if( newPrefix(0) != '.' )
398  {
399  targetDir = prefix;
400  targetDir += newPrefix;
401  }
402  else
403  { targetDir = ModifyPrefix(newPrefix); }
404  }
405  if( targetDir( targetDir.length() - 1 ) != '/' )
406  { targetDir += "/"; }
407  G4UIcommandTree * commandTree = FindDirPath( targetDir );
408  if( commandTree == NULL )
409  { G4cout << "Directory <" << targetDir << "> is not found." << G4endl; }
410  else
411  { commandTree->ListCurrent(); }
412 }
G4String strip(G4int strip_Type=trailing, char c=' ')
G4String ModifyPrefix(G4String)
Definition: G4UIGAG.cc:490
G4UIcommandTree * FindDirPath(const G4String &)
Definition: G4UIGAG.cc:515
G4GLOB_DLL std::ostream G4cout
G4String prefix
Definition: G4UIGAG.hh:80
#define G4endl
Definition: G4ios.hh:61
void ListCurrent() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ModifyPrefix()

G4String G4UIGAG::ModifyPrefix ( G4String  newCommand)
private

Definition at line 490 of file G4UIGAG.cc.

491 {
492  G4String newPrefix = prefix;
493  while( 1 )
494  {
495  if( newCommand.substr(0,2) == ".." )
496  {
497  if( newPrefix != "/" )
498  {
499  G4String tmpString = newPrefix(0,newPrefix.length()-1);
500  newPrefix = newPrefix(0,tmpString.last('/')+1);
501  }
502  }
503  else
504  {
505  newPrefix += newCommand;
506  break;
507  }
508  if( newCommand == ".." || newCommand == "../" )
509  { break; }
510  newCommand = newCommand.substr(3,newCommand.length()-3);
511  }
512  return newPrefix;
513 }
G4String prefix
Definition: G4UIGAG.hh:80
G4int last(char) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NotifyCommandUpdate()

void G4UIGAG::NotifyCommandUpdate ( void  )
private

Definition at line 798 of file G4UIGAG.cc.

799 {
801  SendCommandProperties(tree);
802 }
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:206
G4UImanager * UI
Definition: G4UIGAG.hh:81
void SendCommandProperties(G4UIcommandTree *)
Definition: G4UIGAG.cc:532
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NotifyParameterUpdate()

void G4UIGAG::NotifyParameterUpdate ( G4UIcommand com)
private

Definition at line 804 of file G4UIGAG.cc.

805 {
806  if (uiMode == java_mode)
807  SendAParamProperty(com);
808  else
810 }
void SendAParamProperty(G4UIcommand *)
Definition: G4UIGAG.cc:604
void SendATclParamProperty(G4UIcommand *)
Definition: G4UIGAG.cc:749
UImode uiMode
Definition: G4UIGAG.hh:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NotifyStateChange()

void G4UIGAG::NotifyStateChange ( void  )
private

Definition at line 784 of file G4UIGAG.cc.

785 {
786  G4String stateString;
789  stateString = statM->GetStateString(statM->GetCurrentState());
790  if ( uiMode != terminal_mode ){
791  G4cout << "@@State \"" << stateString << "\"" << G4endl;
792  G4cout << "@@DisableListBegin"<<G4endl;
793  SendDisableList(tree, 0);
794  G4cout << "@@DisableListEnd" <<G4endl;
795  }
796 }
G4String GetStateString(G4ApplicationState aState) const
static G4StateManager * GetStateManager()
UImode uiMode
Definition: G4UIGAG.hh:85
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:206
G4UImanager * UI
Definition: G4UIGAG.hh:81
#define G4endl
Definition: G4ios.hh:61
G4ApplicationState GetCurrentState() const
void SendDisableList(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:645
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PauseSessionStart()

void G4UIGAG::PauseSessionStart ( const G4String msg)
virtual

Reimplemented from G4UIsession.

Definition at line 87 of file G4UIGAG.cc.

88 {
89  promptCharacter = msg;
90  G4cout << "@@PROMPT \"" << promptCharacter << "\"" << G4endl;
91  iCont = true;
92  G4String newCommand = GetCommand();
93  while( iCont )
94  {
95  ExecuteCommand(newCommand);
96  newCommand = GetCommand();
97  }
98 }
void ExecuteCommand(const G4String &)
Definition: G4UIGAG.cc:100
G4String promptCharacter
Definition: G4UIGAG.hh:82
G4GLOB_DLL std::ostream G4cout
G4bool iCont
Definition: G4UIGAG.hh:84
G4String GetCommand()
Definition: G4UIGAG.cc:189
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ Prompt()

void G4UIGAG::Prompt ( const G4String aPrompt)

Definition at line 184 of file G4UIGAG.cc.

185 {
186  promptCharacter = aPrompt;
187 }
G4String promptCharacter
Definition: G4UIGAG.hh:82

◆ ReceiveG4cerr()

G4int G4UIGAG::ReceiveG4cerr ( const G4String cerrString)
virtual

Reimplemented from G4UIsession.

Definition at line 178 of file G4UIGAG.cc.

179 {
180  std::cerr << cerrString << std::flush;
181  return 0;
182 }

◆ ReceiveG4cout()

G4int G4UIGAG::ReceiveG4cout ( const G4String coutString)
virtual

Reimplemented from G4UIsession.

Definition at line 172 of file G4UIGAG.cc.

173 {
174  std::cout << coutString << std::flush;
175  return 0;
176 }

◆ SendAParamProperty()

void G4UIGAG::SendAParamProperty ( G4UIcommand Comp)
private

Definition at line 604 of file G4UIGAG.cc.

605 {
606  int guidanceEntry, parameterEntry;
607  G4String title, title2;
608  G4UIparameter * prp;
609  char c[2];
610  guidanceEntry = Comp->GetGuidanceEntries();
611  parameterEntry = Comp->GetParameterEntries();
612  G4cout << "@@JParamBegin" << G4endl;
613  G4cout << Comp->GetCommandPath() << G4endl;
614  G4cout << guidanceEntry << G4endl;
615  for (int j=0; j<guidanceEntry; j++){
616  title = Comp->GetGuidanceLine(j);
617  title2 = "";
618  if (title != ""){
619  for(int i=0; i< (int)title.length(); i++){
620  c[0]=title(i);
621  c[1]= '\0';
622  if ( c[0] == '\n' || c[0] == '\r') {
623  c[0]= ' ';
624  }
625  title2.append(c);
626  }
627  }
628  G4cout << title2 << G4endl;
629  }
630  G4cout << Comp->GetRange() << G4endl;
631  G4cout << parameterEntry << G4endl;
632  for( int par=0; par<parameterEntry; par++) {
633  prp = (G4UIparameter *)Comp->GetParameter(par);
634  G4cout << prp->GetParameterName() << G4endl;
635  G4cout << prp->GetParameterGuidance() << G4endl;
636  G4cout << prp->GetParameterType() << G4endl;
637  G4cout << prp->IsOmittable() << G4endl;
638  G4cout << prp->GetDefaultValue() << G4endl;
639  G4cout << prp->GetParameterRange() << G4endl;
640  G4cout << prp->GetParameterCandidates() << G4endl;
641  }
642  G4cout << "@@JParamEnd" << G4endl;
643 }
G4int GetGuidanceEntries() const
Definition: G4UIcommand.hh:135
G4String GetDefaultValue() const
G4String GetParameterRange() const
const G4String GetParameterGuidance() const
const G4String & GetGuidanceLine(G4int i) const
Definition: G4UIcommand.hh:137
G4bool IsOmittable() const
char GetParameterType() const
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:145
G4GLOB_DLL std::ostream G4cout
const G4String & GetRange() const
Definition: G4UIcommand.hh:133
G4String GetParameterName() const
G4String GetParameterCandidates() const
G4String & append(const G4String &)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
#define G4endl
Definition: G4ios.hh:61
subroutine title
Definition: hijing1.383.f:5981
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendATclParamProperty()

void G4UIGAG::SendATclParamProperty ( G4UIcommand Comp)
private

Definition at line 749 of file G4UIGAG.cc.

750 {
751  G4UIparameter * prp;
752  int parameterEntry = Comp->GetParameterEntries();
753  G4String commandPath = Comp->GetCommandPath();
754  G4String commandRange = Comp->GetRange();
755  G4cout << "@@parameter_start" << G4endl;
756  G4cout << commandPath << " @@param " << parameterEntry << G4endl;
757  G4cout << "@@command_range \"" << commandRange << "\"" << G4endl;
758  for( int par=0; par<parameterEntry; par++) {
759  prp = (G4UIparameter *)Comp->GetParameter(par);
760  G4cout << "{" ;
761  G4cout << "@@param_name : \"" << prp->GetParameterName() <<"\""<<G4endl;
762  G4String guide1,guide2;
763  guide1 = prp->GetParameterGuidance();
764  guide2 = "";
765  for(int i=0; i<(int)guide1.length(); i++){
766  char c[2];
767  c[0]=guide1(i);
768  c[1]= '\0';
769  if( c[0] == '\"')
770  guide2.append("\\\""); // a Backslash and a double quote
771  else guide2.append(c);
772  }
773  G4cout << " @@param_guide : \"" << guide2 << "\""<<G4endl;
774  G4cout << " @@param_type : \"" << prp->GetParameterType()<<"\""<<G4endl;
775  G4cout << " @@param_omit : \"" << prp->IsOmittable()<<"\""<<G4endl;
776  G4cout << " @@param_default : \""<< prp->GetDefaultValue()<<"\""<<G4endl;
777  G4cout << " @@param_range : \""<< prp->GetParameterRange()<<"\""<<G4endl;
778  G4cout << " @@param_candidate : \"" << prp->GetParameterCandidates()<< "\""<<G4endl;
779  G4cout << "}" << G4endl;
780  }
781  G4cout << "@@parameter_end" << G4endl;
782 }
G4String GetDefaultValue() const
G4String GetParameterRange() const
const G4String GetParameterGuidance() const
G4bool IsOmittable() const
char GetParameterType() const
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:145
G4GLOB_DLL std::ostream G4cout
const G4String & GetRange() const
Definition: G4UIcommand.hh:133
G4String GetParameterName() const
G4String GetParameterCandidates() const
G4String & append(const G4String &)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendCommandProperties()

void G4UIGAG::SendCommandProperties ( G4UIcommandTree tree)
private

Definition at line 532 of file G4UIGAG.cc.

533 {
534  if( tree == NULL ) {
535  G4cerr << "GetTree() returnes null." << G4endl;
536  return;
537  }
538  if (uiMode == java_mode){
539  G4cout << "@@JTreeBegin" << G4endl;
540  CodeGenJavaTree(tree, 0);
541  G4cout << "@@JTreeEnd" << G4endl;
542  CodeGenJavaParams(tree, 0);
543  }else{
544  G4cout << G4endl << "@@maketree_start" << G4endl;
545  CodeGenTclTree(tree,0);
546  G4cout << "@@maketree_end" << G4endl;
547  CodeGenTclParams(tree, 0);
548  }
549 }
void CodeGenTclParams(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:730
void CodeGenTclTree(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:668
void CodeGenJavaTree(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:563
void CodeGenJavaParams(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:581
UImode uiMode
Definition: G4UIGAG.hh:85
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendDisableList()

void G4UIGAG::SendDisableList ( G4UIcommandTree tree,
int  recursiveLevel 
)
private

Definition at line 645 of file G4UIGAG.cc.

646 {
647  int treeEntry, commandEntry;
648  G4UIcommand * Comp;
649  treeEntry = tree->GetTreeEntry();
650  commandEntry = tree->GetCommandEntry();
651 
652  for(int com=0; com<commandEntry; com++) {
653  Comp = tree->GetCommand(com+1);
654  if( Comp->IsAvailable()==false ) {
655  G4cout << Comp->GetCommandPath()<<G4endl;
656  }
657  }
658  if( treeEntry == 0 ) return; // end recursion
659 
660  for( int i=0; i<treeEntry; i++) {
661  SendDisableList(tree->GetTree(i+1), level+1);
662  // be sure the function name is the same
663  }
664 }
G4bool IsAvailable()
Definition: G4UIcommand.cc:289
G4UIcommand * GetCommand(G4int i)
G4int GetCommandEntry() const
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
#define G4endl
Definition: G4ios.hh:61
void SendDisableList(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:645
G4int GetTreeEntry() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendParameterProperties()

void G4UIGAG::SendParameterProperties ( G4UIcommandTree tree)
private

Definition at line 550 of file G4UIGAG.cc.

551 {
552  if( tree == NULL ) {
553  G4cerr << "GetTree() returnes null." << G4endl;
554  return;
555  }
556  if (uiMode == java_mode){
557  CodeGenJavaParams(tree, 0);
558  }else{
559  CodeGenTclParams(tree, 0);
560  }
561 }
void CodeGenTclParams(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:730
void CodeGenJavaParams(G4UIcommandTree *, int recursiveLevel)
Definition: G4UIGAG.cc:581
UImode uiMode
Definition: G4UIGAG.hh:85
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:

◆ SessionStart()

G4UIsession * G4UIGAG::SessionStart ( )
virtual

Reimplemented from G4UIsession.

Definition at line 72 of file G4UIGAG.cc.

73 {
74  iExit = true;
77  G4String newCommand = GetCommand();
78  while( iExit )
79  {
80  ExecuteCommand(newCommand);
82  newCommand = GetCommand();
83  }
84  return NULL;
85 }
G4String GetStateString(G4ApplicationState aState) const
void ExecuteCommand(const G4String &)
Definition: G4UIGAG.cc:100
static G4StateManager * GetStateManager()
G4String promptCharacter
Definition: G4UIGAG.hh:82
G4String GetCommand()
Definition: G4UIGAG.cc:189
G4bool iExit
Definition: G4UIGAG.hh:83
G4ApplicationState GetCurrentState() const
Here is the call graph for this function:

◆ SessionTerminate()

void G4UIGAG::SessionTerminate ( )

Definition at line 337 of file G4UIGAG.cc.

338 {
339  G4cout << "***** Terminal session end *****" << G4endl;
340 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

◆ ShowCurrent()

void G4UIGAG::ShowCurrent ( const G4String newCommand)
private

Definition at line 342 of file G4UIGAG.cc.

343 {
344  G4String theCommand = GetFullPath(newCommand.substr(1,newCommand.length()-1));
345  G4String curV = UI->GetCurrentValues(theCommand);
346  if( ! (curV.isNull()||curV(0)=='\0' ) ) {
347  if (uiMode == terminal_mode){
348  G4cout << "Current value(s) of the parameter(s) : " << curV << G4endl;
349  }else{
350  G4cout << "@@CurrentValue " << curV << G4endl;
351  }
352  } else if (uiMode == terminal_mode){
353  G4cout << "Current value is not available." << G4endl;
354  } else {
355  G4cout << "@@ErrResult \"Current value is not available.\"" << G4endl;
356  }
357 }
G4String GetFullPath(const G4String &)
Definition: G4UIGAG.cc:303
UImode uiMode
Definition: G4UIGAG.hh:85
G4GLOB_DLL std::ostream G4cout
G4UImanager * UI
Definition: G4UIGAG.hh:81
G4String GetCurrentValues(const char *aCommand)
Definition: G4UImanager.cc:170
#define G4endl
Definition: G4ios.hh:61
G4bool isNull() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TerminalHelp()

void G4UIGAG::TerminalHelp ( const G4String newCommand)
private

Definition at line 414 of file G4UIGAG.cc.

415 {
416  G4UIcommandTree * treeTop = UI->GetTree();
417  /*int*/str_size i = newCommand.index(" ");
418  if( i != std::string::npos )
419  {
420  G4String newValue = newCommand.substr(i+1,newCommand.length()-(i+1));
421  newValue.strip(G4String::both);
422  if( newValue(0) != '/' )
423  { newValue.prepend( prefix ); }
424  G4UIcommand * theCommand = treeTop->FindPath( newValue );
425  if( theCommand != NULL )
426  {
427  theCommand->List();
428  return;
429  }
430  else
431  {
432  G4cout << "Command <" << newValue << " is not found." << G4endl;
433  return;
434  }
435  }
436 
437  G4UIcommandTree * floor[10];
438  floor[0] = treeTop;
439  int iFloor = 0;
440  /*int*/ unsigned prefixIndex = 1;
441  while( prefixIndex < prefix.length()-1 )
442  {
443  int ii = prefix.index("/",prefixIndex);
444  floor[iFloor+1] =
445  floor[iFloor]->GetTree(G4String(prefix(0,ii+1)));
446  prefixIndex = ii+1;
447  iFloor++;
448  }
449  floor[iFloor]->ListCurrentWithNum();
450  // 1998 Oct 2 non-number input
451  while(1){
452  int j;
453  G4cout << G4endl << "Type the number ( 0:end, -n:n level back ) : "<<std::flush;
454  G4cin >> j;
455  if(!G4cin.good()){
456  G4cin.clear();
457  G4cin.ignore(30,'\n');
458  G4cout << G4endl << "Not a number, once more" << G4endl; continue;}
459  else if( j < 0 ){
460  iFloor += j;
461  if( iFloor < 0 ) iFloor = 0;
462  floor[iFloor]->ListCurrentWithNum(); continue;}
463  else if(j == 0) { break;}
464  else if( j > 0 ) {
465  int n_tree = floor[iFloor]->GetTreeEntry();
466  if( j > n_tree )
467  {
468  if( j <= n_tree + floor[iFloor]->GetCommandEntry() )
469  {
470  floor[iFloor]->GetCommand(i-n_tree)->List();
471  //iFloor++;
472  }
473  }
474  else
475  {
476  floor[iFloor+1] = floor[iFloor]->GetTree(i);
477  iFloor++;
478  floor[iFloor]->ListCurrentWithNum();
479  }
480  }
481 
482  }
483  G4cout << "Exit from HELP." << G4endl << G4endl;
484  G4cout << G4endl;
485  // G4cin.flush();
486  char temp[100];
487  G4cin.getline( temp, 100 );
488 }
G4String strip(G4int strip_Type=trailing, char c=' ')
G4UIcommand * GetCommand(G4int i)
std::string::size_type str_size
str_size index(const char *, G4int pos=0) const
G4String & prepend(const char *)
#define G4cin
Definition: G4ios.hh:60
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
G4String prefix
Definition: G4UIGAG.hh:80
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:206
G4UImanager * UI
Definition: G4UIGAG.hh:81
G4UIcommand * FindPath(const char *commandPath) const
#define G4endl
Definition: G4ios.hh:61
G4int GetTreeEntry() const
virtual void List()
Definition: G4UIcommand.cc:348
void ListCurrentWithNum() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateParamVal()

void G4UIGAG::UpdateParamVal ( void  )
private

Definition at line 883 of file G4UIGAG.cc.

884 {
885  // call NotifyParameterUpdate() if the value of each
886  // command/parameter is updated.
887  // assuming the command structure is not changed.
888  int pEntry= previousTreeParams.size();
889  int nEntry= newTreeParams.size();
890  int i;
891  G4UIcommand* Comp;
892  if (pEntry != nEntry) return;
893  for( i=0; i<nEntry; i++) {
894  if( previousTreeParams[i] != newTreeParams[i]){
895  Comp = newTreePCP[i];
896  G4cout << Comp->GetCommandPath()
897  << " command is updated." <<G4endl;
898  NotifyParameterUpdate(Comp);
899  }
900  }
901 }
std::vector< G4String > newTreeParams
Definition: G4UIGAG.hh:125
std::vector< G4String > previousTreeParams
Definition: G4UIGAG.hh:124
G4GLOB_DLL std::ostream G4cout
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
std::vector< G4UIcommand * > newTreePCP
Definition: G4UIGAG.hh:127
#define G4endl
Definition: G4ios.hh:61
void NotifyParameterUpdate(G4UIcommand *)
Definition: G4UIGAG.cc:804
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateState()

void G4UIGAG::UpdateState ( void  )
private

Definition at line 813 of file G4UIGAG.cc.

814 {
815  static G4ThreadLocal G4ApplicationState *previousState_G4MT_TLS_ = 0 ; if (!previousState_G4MT_TLS_) {previousState_G4MT_TLS_ = new G4ApplicationState ; *previousState_G4MT_TLS_= G4State_PreInit ; } G4ApplicationState &previousState = *previousState_G4MT_TLS_;
816  G4ApplicationState newState;
818  newState = statM->GetCurrentState();
819  if( newState != previousState )
820  {
822  previousState = newState;
823  }
824 }
#define G4ThreadLocal
Definition: tls.hh:89
static G4StateManager * GetStateManager()
void NotifyStateChange(void)
Definition: G4UIGAG.cc:784
G4ApplicationState GetCurrentState() const
G4ApplicationState
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ iCont

G4bool G4UIGAG::iCont
private

Definition at line 84 of file G4UIGAG.hh.

◆ iExit

G4bool G4UIGAG::iExit
private

Definition at line 83 of file G4UIGAG.hh.

◆ JVersion

G4String G4UIGAG::JVersion
private

Definition at line 88 of file G4UIGAG.hh.

◆ newTreeCommands

std::vector<G4String> G4UIGAG::newTreeCommands
private

Definition at line 123 of file G4UIGAG.hh.

◆ newTreeParams

std::vector<G4String> G4UIGAG::newTreeParams
private

Definition at line 125 of file G4UIGAG.hh.

◆ newTreePCP

std::vector<G4UIcommand*> G4UIGAG::newTreePCP
private

Definition at line 127 of file G4UIGAG.hh.

◆ prefix

G4String G4UIGAG::prefix
private

Definition at line 80 of file G4UIGAG.hh.

◆ previousTreeCommands

std::vector<G4String> G4UIGAG::previousTreeCommands
private

Definition at line 122 of file G4UIGAG.hh.

◆ previousTreeParams

std::vector<G4String> G4UIGAG::previousTreeParams
private

Definition at line 124 of file G4UIGAG.hh.

◆ previousTreePCP

std::vector<G4UIcommand*> G4UIGAG::previousTreePCP
private

Definition at line 126 of file G4UIGAG.hh.

◆ promptCharacter

G4String G4UIGAG::promptCharacter
private

Definition at line 82 of file G4UIGAG.hh.

◆ TVersion

G4String G4UIGAG::TVersion
private

Definition at line 89 of file G4UIGAG.hh.

◆ UI

G4UImanager* G4UIGAG::UI
private

Definition at line 81 of file G4UIGAG.hh.

◆ uiMode

UImode G4UIGAG::uiMode
private

Definition at line 85 of file G4UIGAG.hh.


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