Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -16,6 +16,18 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
26 November, 2019 G. Cosmo (intercoms-V10-05-09)
|
||||
- Fixed more cases of implicit type conversions from size_t to G4int.
|
||||
|
||||
19 November, 2019 G. Cosmo (intercoms-V10-05-08)
|
||||
- Fixed more cases of implicit type conversions.
|
||||
|
||||
15 November, 2019 G. Cosmo (intercoms-V10-05-07)
|
||||
- Fixed cases of implicit type conversions from size_t to G4int.
|
||||
|
||||
30 September, 2019 M. Asai (intercoms-V10-05-06)
|
||||
- Eliminating global-scope enum in G4UItokenNum.hh.
|
||||
|
||||
17 April, 2019 M. Asai (intercoms-V10-05-05)
|
||||
- Following UI commands now return proper return code when they are
|
||||
not successful. Addressing to bug report #2159.
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// G4UIcommand
|
||||
|
||||
#ifndef G4UIcommand_h
|
||||
#define G4UIcommand_h 1
|
||||
// Author: Makoto Asai (SLAC)
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4UIcommand_hh
|
||||
#define G4UIcommand_hh 1
|
||||
|
||||
#include "G4UIparameter.hh"
|
||||
class G4UImessenger;
|
||||
@@ -131,7 +131,7 @@ class G4UIcommand
|
||||
public:
|
||||
inline const G4String & GetRange() const
|
||||
{ return rangeString; };
|
||||
inline G4int GetGuidanceEntries() const
|
||||
inline size_t GetGuidanceEntries() const
|
||||
{ return commandGuidance.size(); }
|
||||
inline const G4String & GetGuidanceLine(G4int i) const
|
||||
{ return commandGuidance[i]; }
|
||||
@@ -139,7 +139,7 @@ class G4UIcommand
|
||||
{ return commandPath; }
|
||||
inline const G4String & GetCommandName() const
|
||||
{ return commandName; }
|
||||
inline G4int GetParameterEntries() const
|
||||
inline size_t GetParameterEntries() const
|
||||
{ return parameter.size(); }
|
||||
inline G4UIparameter * GetParameter(G4int i) const
|
||||
{ return parameter[i]; }
|
||||
@@ -150,8 +150,8 @@ class G4UIcommand
|
||||
public: // with description
|
||||
inline void SetParameter(G4UIparameter *const newParameter)
|
||||
{
|
||||
parameter.push_back( newParameter );
|
||||
newVal.resize( parameter.size() );
|
||||
parameter.push_back( newParameter );
|
||||
newVal.resize( parameter.size() );
|
||||
}
|
||||
// Defines a parameter. This method is used by the derived command classes
|
||||
// but the user can directly use this command when he/she defines a command
|
||||
@@ -168,10 +168,10 @@ class G4UIcommand
|
||||
public:
|
||||
inline const G4String GetTitle() const
|
||||
{
|
||||
if(commandGuidance.size() == 0)
|
||||
{ return G4String("...Title not available..."); }
|
||||
else
|
||||
{ return commandGuidance[0]; }
|
||||
if(commandGuidance.size() == 0)
|
||||
{ return G4String("...Title not available..."); }
|
||||
else
|
||||
{ return commandGuidance[0]; }
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -213,6 +213,9 @@ class G4UIcommand
|
||||
G4int CheckNewValue(const char* newValue);
|
||||
|
||||
// --- the following is used by CheckNewValue() --------
|
||||
protected:
|
||||
using yystype = G4UItokenNum::yystype;
|
||||
using tokenNum = G4UItokenNum::tokenNum;
|
||||
private:
|
||||
G4int TypeCheck(const char* t);
|
||||
G4int RangeCheck(const char* t);
|
||||
|
||||
@@ -80,9 +80,9 @@ class G4UIcommandTree
|
||||
inline const G4String GetPathName() const
|
||||
{ return pathName; };
|
||||
inline G4int GetTreeEntry() const
|
||||
{ return tree.size(); };
|
||||
{ return G4int(tree.size()); };
|
||||
inline G4int GetCommandEntry() const
|
||||
{ return command.size(); };
|
||||
{ return G4int(command.size()); };
|
||||
inline G4UIcommandTree * GetTree(G4int i)
|
||||
{ return tree[i-1]; };
|
||||
inline G4UIcommandTree * GetTree(const char* comNameC)
|
||||
|
||||
@@ -228,7 +228,7 @@ class G4UImanager : public G4VStateDependent
|
||||
inline G4int GetVerboseLevel() const
|
||||
{ return verboseLevel; }
|
||||
inline G4int GetNumberOfHistory() const
|
||||
{ return histVec.size(); }
|
||||
{ return G4int(histVec.size()); }
|
||||
inline G4String GetPreviousCommand(G4int i) const
|
||||
{
|
||||
G4String st;
|
||||
|
||||
@@ -143,6 +143,9 @@ class G4UIparameter
|
||||
inline void SetGuidance(const char * theGuidance)
|
||||
{ parameterGuidance = theGuidance; }
|
||||
|
||||
protected:
|
||||
using yystype = G4UItokenNum::yystype;
|
||||
using tokenNum = G4UItokenNum::tokenNum;
|
||||
private:
|
||||
// --- the following is used by CheckNewValue() -------
|
||||
G4int TypeCheck(const char* newValue );
|
||||
|
||||
@@ -31,8 +31,9 @@
|
||||
#define G4UItokenNum_hh 1
|
||||
#include "globals.hh"
|
||||
|
||||
|
||||
enum tokenNum
|
||||
namespace G4UItokenNum
|
||||
{
|
||||
enum tokenNum
|
||||
{
|
||||
NONE = 0,
|
||||
IDENTIFIER = 257,
|
||||
@@ -55,7 +56,6 @@ enum tokenNum
|
||||
MINUS = 45
|
||||
};
|
||||
|
||||
|
||||
typedef struct yystype
|
||||
{
|
||||
tokenNum type;
|
||||
@@ -64,7 +64,7 @@ typedef struct yystype
|
||||
char C;
|
||||
G4String S;
|
||||
|
||||
yystype() : type(NONE), D(0.0), I(0), C(' '), S("")
|
||||
yystype() : type(tokenNum::NONE), D(0.0), I(0), C(' '), S("")
|
||||
{
|
||||
}
|
||||
G4bool operator==(const yystype& right) const
|
||||
@@ -86,5 +86,5 @@ typedef struct yystype
|
||||
*this=right;
|
||||
}
|
||||
} yystype;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -207,8 +207,8 @@ G4GenericMessenger::Command& G4GenericMessenger::Command::SetUnit(const G4String
|
||||
G4String range = command->GetRange();
|
||||
std::vector<G4String> guidance;
|
||||
G4String par_name = command->GetParameter(0)->GetParameterName();
|
||||
bool par_omitable = command->GetParameter(0)->IsOmittable();
|
||||
for (G4int i = 0; i < command->GetGuidanceEntries(); i++) guidance.push_back(command->GetGuidanceLine(i));
|
||||
G4bool par_omitable = command->GetParameter(0)->IsOmittable();
|
||||
for (size_t i = 0; i < command->GetGuidanceEntries(); ++i) guidance.push_back(command->GetGuidanceLine(i));
|
||||
// Before deleting the command we need to add a fake one to avoid deleting the directory entry and with its guidance
|
||||
G4UIcommand tmp((cmdpath+"_tmp").c_str(), messenger);
|
||||
delete command;
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author: Makoto Asai (SLAC)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
@@ -38,6 +37,9 @@
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4UItokenNum.hh"
|
||||
using namespace G4UItokenNum;
|
||||
|
||||
G4UIcommand::G4UIcommand()
|
||||
: messenger(0), toBeBroadcasted(false), toBeFlushed(false), workerThreadOnly(false),
|
||||
commandFailureCode(0), failureDescription(""),
|
||||
|
||||
@@ -441,16 +441,16 @@ void G4UIcommandTree::CreateHTML()
|
||||
oF << "<html><head><title>Commands in " << ModStr(pathName) << "</title></head>" << G4endl;
|
||||
oF << "<body bgcolor=\"#ffffff\"><h2>" << ModStr(pathName) << "</h2><p>" << G4endl;
|
||||
|
||||
if( guidance != NULL )
|
||||
if( guidance != nullptr )
|
||||
{
|
||||
for(G4int i=0;i<guidance->GetGuidanceEntries();i++)
|
||||
for(size_t i=0;i<guidance->GetGuidanceEntries();++i)
|
||||
{ oF << ModStr(guidance->GetGuidanceLine(i)) << "<br>" << G4endl; }
|
||||
}
|
||||
|
||||
oF << "<p><hr><p>" << G4endl;
|
||||
|
||||
oF << "<h2>Sub-directories : </h2><dl>" << G4endl;
|
||||
for( G4int i_thTree = 0; i_thTree < G4int(tree.size()); i_thTree++ )
|
||||
for( size_t i_thTree = 0; i_thTree < tree.size(); ++i_thTree )
|
||||
{
|
||||
oF << "<p><br><p><dt><a href=\"" << CreateFileName(tree[i_thTree]->GetPathName())
|
||||
<< "\">" << ModStr(tree[i_thTree]->GetPathName()) << "</a>" << G4endl;
|
||||
@@ -461,18 +461,18 @@ void G4UIcommandTree::CreateHTML()
|
||||
oF << "</dl><p><hr><p>" << G4endl;
|
||||
|
||||
oF << "<h2>Commands : </h2><dl>" << G4endl;
|
||||
for( G4int i_thCommand = 0; i_thCommand < G4int(command.size()); i_thCommand++ )
|
||||
for( size_t i_thCommand = 0; i_thCommand < command.size(); ++i_thCommand )
|
||||
{
|
||||
G4UIcommand* cmd = command[i_thCommand];
|
||||
oF << "<p><br><p><dt><b>" << ModStr(cmd->GetCommandName());
|
||||
if(cmd->GetParameterEntries()>0)
|
||||
{
|
||||
for(G4int i_thParam=0;i_thParam<cmd->GetParameterEntries();i_thParam++)
|
||||
for(size_t i_thParam=0;i_thParam<cmd->GetParameterEntries();++i_thParam)
|
||||
{ oF << " [<i>" << ModStr(cmd->GetParameter(i_thParam)->GetParameterName()) << "</i>]"; }
|
||||
}
|
||||
oF << "</b>" << G4endl;
|
||||
oF << "<p><dd>" << G4endl;
|
||||
for(G4int i=0;i<cmd->GetGuidanceEntries();i++)
|
||||
for(size_t i=0;i<cmd->GetGuidanceEntries();++i)
|
||||
{ oF << ModStr(cmd->GetGuidanceLine(i)) << "<br>" << G4endl; }
|
||||
if(!(cmd->GetRange()).isNull())
|
||||
{ oF << "<p><dd>Range : " << ModStr(cmd->GetRange()) << G4endl; }
|
||||
@@ -482,13 +482,13 @@ void G4UIcommandTree::CreateHTML()
|
||||
else
|
||||
{
|
||||
oF << "<p><dd>Available Geant4 state(s) : ";
|
||||
for(G4int ias=0;ias<G4int(availabelStateList->size());ias++)
|
||||
for(size_t ias=0;ias<availabelStateList->size();++ias)
|
||||
{ oF << G4StateManager::GetStateManager()->GetStateString((*availabelStateList)[ias]) << " " << G4endl; }
|
||||
}
|
||||
if(cmd->GetParameterEntries()>0)
|
||||
{
|
||||
oF << "<p><dd>Parameters<table border=1>" << G4endl;
|
||||
for(G4int i_thParam=0;i_thParam<cmd->GetParameterEntries();i_thParam++)
|
||||
for(size_t i_thParam=0;i_thParam<cmd->GetParameterEntries();++i_thParam)
|
||||
{
|
||||
G4UIparameter* prm = cmd->GetParameter(i_thParam);
|
||||
oF << "<tr><td>" << ModStr(prm->GetParameterName()) << G4endl;
|
||||
|
||||
@@ -422,12 +422,12 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
if(command==getEnvCmd)
|
||||
{
|
||||
command->ResetFailure();
|
||||
if(getenv(newValue))
|
||||
if(std::getenv(newValue))
|
||||
{
|
||||
G4String st = "/control/alias ";
|
||||
st += newValue;
|
||||
st += " ";
|
||||
st += getenv(newValue);
|
||||
st += std::getenv(newValue);
|
||||
UI->ApplyCommand(st);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -99,8 +99,8 @@ G4UImanager::G4UImanager()
|
||||
savedParameters = nullString;
|
||||
verboseLevel = 0;
|
||||
saveHistory = false;
|
||||
session = NULL;
|
||||
g4UIWindow = NULL;
|
||||
session = nullptr;
|
||||
g4UIWindow = nullptr;
|
||||
SetCoutDestination(session);
|
||||
pauseAtBeginOfEvent = false;
|
||||
pauseAtEndOfEvent = false;
|
||||
@@ -125,7 +125,7 @@ G4UImanager::~G4UImanager()
|
||||
{ delete *itr; }
|
||||
delete bridges;
|
||||
}
|
||||
SetCoutDestination(NULL);
|
||||
SetCoutDestination(nullptr);
|
||||
histVec.clear();
|
||||
if(saveHistory) historyFile.close();
|
||||
delete CoutMessenger;
|
||||
@@ -134,7 +134,7 @@ G4UImanager::~G4UImanager()
|
||||
delete treeTop;
|
||||
delete aliasList;
|
||||
fUImanagerHasBeenKilled() = true;
|
||||
fUImanager() = NULL;
|
||||
fUImanager() = nullptr;
|
||||
if(commandStack)
|
||||
{
|
||||
commandStack->clear();
|
||||
@@ -190,7 +190,7 @@ G4String G4UImanager::GetCurrentValues(const char * aCommand)
|
||||
{
|
||||
G4String theCommand = aCommand;
|
||||
savedCommand = treeTop->FindPath( theCommand );
|
||||
if( savedCommand == NULL )
|
||||
if( savedCommand == nullptr )
|
||||
{
|
||||
G4cerr << "command not found" << G4endl;
|
||||
return G4String();
|
||||
@@ -201,7 +201,7 @@ G4String G4UImanager::GetCurrentValues(const char * aCommand)
|
||||
G4String G4UImanager::GetCurrentStringValue(const char * aCommand,
|
||||
G4int parameterNumber, G4bool reGet)
|
||||
{
|
||||
if(reGet || savedCommand == NULL)
|
||||
if(reGet || savedCommand == nullptr)
|
||||
{
|
||||
savedParameters = GetCurrentValues( aCommand );
|
||||
}
|
||||
@@ -223,11 +223,11 @@ G4int parameterNumber, G4bool reGet)
|
||||
G4String G4UImanager::GetCurrentStringValue(const char * aCommand,
|
||||
const char * aParameterName, G4bool reGet)
|
||||
{
|
||||
if(reGet || savedCommand == NULL)
|
||||
if(reGet || savedCommand == nullptr)
|
||||
{
|
||||
G4String parameterValues = GetCurrentValues( aCommand );
|
||||
}
|
||||
for(G4int i=0;i<savedCommand->GetParameterEntries();i++)
|
||||
for(size_t i=0;i<savedCommand->GetParameterEntries();++i)
|
||||
{
|
||||
if( aParameterName ==
|
||||
savedCommand->GetParameter(i)->GetParameterName() )
|
||||
@@ -480,8 +480,8 @@ G4int G4UImanager::ApplyCommand(const char * aCmd)
|
||||
G4String commandString;
|
||||
G4String commandParameter;
|
||||
|
||||
G4int i = aCommand.index(" ");
|
||||
if( i != G4int(std::string::npos) )
|
||||
size_t i = aCommand.index(" ");
|
||||
if( i != std::string::npos )
|
||||
{
|
||||
commandString = aCommand(0,i);
|
||||
commandParameter = aCommand(i+1,aCommand.length()-(i+1));
|
||||
@@ -526,7 +526,7 @@ G4int G4UImanager::ApplyCommand(const char * aCmd)
|
||||
}
|
||||
|
||||
G4UIcommand * targetCommand = treeTop->FindPath( commandString );
|
||||
if( targetCommand == NULL )
|
||||
if( targetCommand == nullptr )
|
||||
{
|
||||
if(ignoreCmdNotFound)
|
||||
{
|
||||
@@ -616,8 +616,8 @@ G4UIcommandTree* G4UImanager::FindDirectory(const char* dirName)
|
||||
G4int i = targetDir.index("/",idx);
|
||||
G4String targetDirString = targetDir(0,i+1);
|
||||
comTree = comTree->GetTree(targetDirString);
|
||||
if( comTree == NULL )
|
||||
{ return NULL; }
|
||||
if( comTree == nullptr )
|
||||
{ return nullptr; }
|
||||
idx = i+1;
|
||||
}
|
||||
return comTree;
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "G4ios.hh"
|
||||
#include <sstream>
|
||||
|
||||
#include "G4UItokenNum.hh"
|
||||
using namespace G4UItokenNum;
|
||||
|
||||
G4UIparameter::G4UIparameter():paramERR(0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user