Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIGAG.hh,v 1.2 1999/04/13 01:26:18 yhajime Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4UIGAG.hh,v 1.3.4.1 1999/12/07 20:49:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
// G4UIGAG.hh
|
||||
// GAG(Geant4 adaptive GUI) interface class
|
||||
@@ -21,24 +21,43 @@
|
||||
#include "G4UIsession.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include <fstream.h>
|
||||
#include <g4std/vector>
|
||||
|
||||
enum UImode { terminal_mode , java_mode, tcl_mode };
|
||||
enum ChangeOfTree { notChanged=0, added, deleted, addedAndDeleted };
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This class inherits the class G4UIsession.
|
||||
// This is the class which is the front-end to GAG (Geant4 Adaptive GUI).
|
||||
// Its usage is quite similar to G4UIterminal.
|
||||
|
||||
class G4UIGAG : public G4UIsession
|
||||
{
|
||||
public:
|
||||
public: // with description
|
||||
G4UIGAG();
|
||||
~G4UIGAG();
|
||||
|
||||
G4UIsession * SessionStart();
|
||||
|
||||
// A GAG session "gagSession" is instantiated.
|
||||
// G4cout stream is redirected by default to the constructed instance.
|
||||
// Usage: G4UIsession * gagSession = new G4UIGAG;
|
||||
// "gagSession" is started.
|
||||
// Usage: gagSession->SessionStart();
|
||||
// "gagSession" is deleted.
|
||||
// Usage: delete gagSession;
|
||||
//
|
||||
void PauseSessionStart(G4String);
|
||||
void Prompt(G4String);
|
||||
G4String GetCommand();
|
||||
G4int ReceiveG4cout(G4String);
|
||||
G4int ReceiveG4cerr(G4String);
|
||||
// These methods are implementation of the virtual methods of
|
||||
// G4UIsession class.
|
||||
//
|
||||
void SessionTerminate();
|
||||
|
||||
void Prompt(G4String);
|
||||
G4String GetCommand();
|
||||
// These methods are not for users.
|
||||
private:
|
||||
G4String prefix;
|
||||
G4UImanager * UI;
|
||||
@@ -82,12 +101,12 @@ class G4UIGAG : public G4UIsession
|
||||
void GetNewTreeStructure( G4UIcommandTree*,int recursiveLevel);
|
||||
void GetNewTreeValues( G4UIcommandTree*,int recursiveLevel);
|
||||
|
||||
RWTValOrderedVector<G4String> previousTreeCommands;
|
||||
RWTValOrderedVector<G4String> newTreeCommands;
|
||||
RWTValOrderedVector<G4String> previousTreeParams;
|
||||
RWTValOrderedVector<G4String> newTreeParams;
|
||||
RWTValOrderedVector<G4UIcommand*> previousTreePCP;
|
||||
RWTValOrderedVector<G4UIcommand*> newTreePCP;
|
||||
G4std::vector<G4String> previousTreeCommands;
|
||||
G4std::vector<G4String> newTreeCommands;
|
||||
G4std::vector<G4String> previousTreeParams;
|
||||
G4std::vector<G4String> newTreeParams;
|
||||
G4std::vector<G4UIcommand*> previousTreePCP;
|
||||
G4std::vector<G4UIcommand*> newTreePCP;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIGAG.cc,v 1.3 1999/04/15 17:41:44 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4UIGAG.cc,v 1.6.2.1.2.1 1999/12/07 20:49:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
// G4UIGAG.cc
|
||||
// 18.Feb.98 M.Nagamatu and T.Kodama created G4UIGAG from G4UIterminal
|
||||
@@ -174,8 +174,12 @@ G4String G4UIGAG::GetCommand()
|
||||
}else{
|
||||
G4cout << "@@Ready" << endl;
|
||||
}
|
||||
newCommand.readLine( cin );
|
||||
newCommand.readLine( cin, FALSE );
|
||||
if (!cin.good()) { cin.clear(); newCommand = nullString; iExit=false;break;}
|
||||
|
||||
newCommand = newCommand.strip(G4String::leading);
|
||||
if( newCommand.length() < 1) { break; }
|
||||
|
||||
while( newCommand(newCommand.length()-1) == '_' )
|
||||
{
|
||||
G4String newLine;
|
||||
@@ -186,6 +190,8 @@ G4String G4UIGAG::GetCommand()
|
||||
}
|
||||
|
||||
G4String nC = newCommand.strip(G4String::leading);
|
||||
if( nC.length() < 1) { break; }
|
||||
|
||||
// -------------------- nC.toUpper();
|
||||
if( nC == "@@GAGmodeJAVA" ) {
|
||||
uiMode = java_mode;
|
||||
@@ -380,7 +386,7 @@ void G4UIGAG::TerminalHelp(G4String newCommand)
|
||||
{
|
||||
G4UIcommandTree * treeTop = UI->GetTree();
|
||||
int i = newCommand.index(" ");
|
||||
if( i != RW_NPOS )
|
||||
if( i != G4std::string::npos )
|
||||
{
|
||||
G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
|
||||
newValue.strip(G4String::both);
|
||||
@@ -796,12 +802,12 @@ void G4UIGAG::UpdateState(void)
|
||||
int G4UIGAG::CommandUpdated(void)
|
||||
{
|
||||
int added=0, deleted=0;
|
||||
int pEntry= previousTreeCommands.entries();
|
||||
int nEntry= newTreeCommands.entries();
|
||||
int pEntry= previousTreeCommands.size();
|
||||
int nEntry= newTreeCommands.size();
|
||||
int i,j;
|
||||
for( i=0; i<pEntry; i++) { // check deleted command(s)
|
||||
for( j=0; j<nEntry; j++) {
|
||||
if( previousTreeCommands(i) == newTreeCommands(j)) break;
|
||||
if( previousTreeCommands[i] == newTreeCommands[j]) break;
|
||||
}
|
||||
if( j==nEntry ) {
|
||||
deleted = 1;
|
||||
@@ -810,7 +816,7 @@ int G4UIGAG::CommandUpdated(void)
|
||||
}
|
||||
for( i=0; i<nEntry; i++) { // check added command(s)
|
||||
for( j=0; j<pEntry; j++) {
|
||||
if( newTreeCommands(i) == previousTreeCommands(j)) break;
|
||||
if( newTreeCommands[i] == previousTreeCommands[j]) break;
|
||||
}
|
||||
if( j==pEntry ) {
|
||||
added = 1;
|
||||
@@ -836,7 +842,7 @@ void G4UIGAG::GetNewTreeStructure(G4UIcommandTree * tree, int level)
|
||||
for(int com=0; com<commandEntry; com++){
|
||||
commandPath = tree->GetCommand(com+1)->GetCommandPath();
|
||||
title = tree->GetCommand(com+1)->GetTitle();
|
||||
newTreeCommands.insert( commandPath + " " + title );
|
||||
newTreeCommands.push_back( commandPath + " " + title );
|
||||
}
|
||||
|
||||
if(treeEntry == 0) return; //end recursion
|
||||
@@ -845,7 +851,7 @@ void G4UIGAG::GetNewTreeStructure(G4UIcommandTree * tree, int level)
|
||||
t = tree->GetTree(i+1);
|
||||
pathName = t->GetPathName();
|
||||
title = t->GetTitle();
|
||||
newTreeCommands.insert( pathName + " " + title );
|
||||
newTreeCommands.push_back( pathName + " " + title );
|
||||
GetNewTreeStructure(t, level+1);
|
||||
}
|
||||
}
|
||||
@@ -855,14 +861,14 @@ void G4UIGAG::UpdateParamVal(void)
|
||||
// call NotifyParameterUpdate() if the value of each
|
||||
// command/parameter is updated.
|
||||
// assuming the command structure is not changed.
|
||||
int pEntry= previousTreeParams.entries();
|
||||
int nEntry= newTreeParams.entries();
|
||||
int pEntry= previousTreeParams.size();
|
||||
int nEntry= newTreeParams.size();
|
||||
int i;
|
||||
G4UIcommand* Comp;
|
||||
if (pEntry != nEntry) return;
|
||||
for( i=0; i<nEntry; i++) {
|
||||
if( previousTreeParams(i) != newTreeParams(i)){
|
||||
Comp = newTreePCP(i);
|
||||
if( previousTreeParams[i] != newTreeParams[i]){
|
||||
Comp = newTreePCP[i];
|
||||
G4cout << Comp->GetCommandPath()
|
||||
<< " command is updated." <<endl;
|
||||
NotifyParameterUpdate(Comp);
|
||||
@@ -929,8 +935,8 @@ void G4UIGAG::GetNewTreeValues( G4UIcommandTree * tree, int level) // recursive
|
||||
param += prp->GetParameterRange() +" ";
|
||||
param += prp->GetParameterCandidates();
|
||||
}
|
||||
newTreeParams.insert( param + "\n");
|
||||
newTreePCP.insert( Comp );
|
||||
newTreeParams.push_back( param + "\n");
|
||||
newTreePCP.push_back( Comp );
|
||||
}
|
||||
if( treeEntry == 0 ) return; // end recursion
|
||||
for( int i=0; i< treeEntry; i++) {
|
||||
|
||||
Reference in New Issue
Block a user