Import Geant4 11.1.0.beta source tree
This commit is contained in:
@@ -53,8 +53,8 @@
|
||||
class G4BadArgument : public std::bad_cast
|
||||
{
|
||||
public:
|
||||
G4BadArgument() {}
|
||||
virtual const char* what() const throw()
|
||||
G4BadArgument() = default;
|
||||
const char* what() const throw() override
|
||||
{
|
||||
return "G4BadArgument: failed operator()";
|
||||
}
|
||||
@@ -70,13 +70,12 @@ class G4AnyMethod
|
||||
|
||||
/** contructors */
|
||||
|
||||
G4AnyMethod()
|
||||
{}
|
||||
G4AnyMethod() = default;
|
||||
|
||||
template <class S, class T>
|
||||
G4AnyMethod(S (T::*f)())
|
||||
{
|
||||
fContent = new FuncRef<S, T>(f);
|
||||
template <class S, class T>
|
||||
G4AnyMethod(S (T::*f)())
|
||||
{
|
||||
fContent = new FuncRef<S, T>(f);
|
||||
}
|
||||
|
||||
template <class S, class T, class A0>
|
||||
@@ -94,7 +93,7 @@ class G4AnyMethod
|
||||
}
|
||||
|
||||
G4AnyMethod(const G4AnyMethod& other)
|
||||
: fContent(other.fContent ? other.fContent->Clone() : nullptr)
|
||||
: fContent(other.fContent != nullptr ? other.fContent->Clone() : nullptr)
|
||||
, narg(other.narg)
|
||||
{}
|
||||
|
||||
@@ -143,7 +142,7 @@ class G4AnyMethod
|
||||
|
||||
/** Query */
|
||||
|
||||
G4bool Empty() const { return !fContent; }
|
||||
G4bool Empty() const { return fContent == nullptr; }
|
||||
|
||||
/** call operators */
|
||||
|
||||
@@ -159,7 +158,7 @@ class G4AnyMethod
|
||||
|
||||
const std::type_info& ArgType(size_t n = 0) const
|
||||
{
|
||||
return fContent ? fContent->ArgType(n) : typeid(void);
|
||||
return fContent != nullptr ? fContent->ArgType(n) : typeid(void);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -167,13 +166,12 @@ class G4AnyMethod
|
||||
class Placeholder
|
||||
{
|
||||
public:
|
||||
|
||||
Placeholder() {}
|
||||
virtual ~Placeholder() {}
|
||||
virtual Placeholder* Clone() const = 0;
|
||||
virtual void operator()(void*) = 0;
|
||||
virtual void operator()(void*, const std::string&) = 0;
|
||||
virtual const std::type_info& ArgType(size_t) const = 0;
|
||||
Placeholder() = default;
|
||||
virtual ~Placeholder() = default;
|
||||
virtual Placeholder* Clone() const = 0;
|
||||
virtual void operator()(void*) = 0;
|
||||
virtual void operator()(void*, const std::string&) = 0;
|
||||
virtual const std::type_info& ArgType(size_t) const = 0;
|
||||
};
|
||||
|
||||
template <class S, class T>
|
||||
@@ -183,13 +181,13 @@ class G4AnyMethod
|
||||
: fRef(f)
|
||||
{}
|
||||
|
||||
virtual void operator()(void* obj) { ((T*) obj->*fRef)(); }
|
||||
virtual void operator()(void*, const std::string&)
|
||||
void operator()(void* obj) override { ((T*) obj->*fRef)(); }
|
||||
void operator()(void*, const std::string&) override
|
||||
{
|
||||
throw G4BadArgument();
|
||||
}
|
||||
virtual Placeholder* Clone() const { return new FuncRef(fRef); }
|
||||
virtual const std::type_info& ArgType(std::size_t) const
|
||||
Placeholder* Clone() const override { return new FuncRef(fRef); }
|
||||
const std::type_info& ArgType(std::size_t) const override
|
||||
{
|
||||
return typeid(void);
|
||||
}
|
||||
@@ -199,40 +197,43 @@ class G4AnyMethod
|
||||
template <class S, class T, class A0>
|
||||
struct FuncRef1 : public Placeholder
|
||||
{
|
||||
typedef
|
||||
typename remove_const<typename remove_reference<A0>::type>::type nakedA0;
|
||||
using nakedA0 =
|
||||
typename remove_const<typename remove_reference<A0>::type>::type;
|
||||
|
||||
FuncRef1(S (T::*f)(A0))
|
||||
: fRef(f)
|
||||
{}
|
||||
|
||||
virtual void operator()(void*) { throw G4BadArgument(); }
|
||||
virtual void operator()(void* obj, const std::string& s0)
|
||||
void operator()(void*) override { throw G4BadArgument(); }
|
||||
void operator()(void* obj, const std::string& s0) override
|
||||
{
|
||||
nakedA0 a0;
|
||||
std::stringstream strs(s0);
|
||||
strs >> a0;
|
||||
((T*) obj->*fRef)(a0);
|
||||
}
|
||||
virtual Placeholder* Clone() const { return new FuncRef1(fRef); }
|
||||
virtual const std::type_info& ArgType(size_t) const { return typeid(A0); }
|
||||
Placeholder* Clone() const override { return new FuncRef1(fRef); }
|
||||
const std::type_info& ArgType(size_t) const override
|
||||
{
|
||||
return typeid(A0);
|
||||
}
|
||||
S (T::*fRef)(A0);
|
||||
};
|
||||
|
||||
template <class S, class T, class A0, class A1>
|
||||
struct FuncRef2 : public Placeholder
|
||||
{
|
||||
typedef
|
||||
typename remove_const<typename remove_reference<A0>::type>::type nakedA0;
|
||||
typedef
|
||||
typename remove_const<typename remove_reference<A1>::type>::type nakedA1;
|
||||
using nakedA0 =
|
||||
typename remove_const<typename remove_reference<A0>::type>::type;
|
||||
using nakedA1 =
|
||||
typename remove_const<typename remove_reference<A1>::type>::type;
|
||||
|
||||
FuncRef2(S (T::*f)(A0, A1))
|
||||
: fRef(f)
|
||||
{}
|
||||
|
||||
virtual void operator()(void*) { throw G4BadArgument(); }
|
||||
virtual void operator()(void* obj, const std::string& s0)
|
||||
void operator()(void*) override { throw G4BadArgument(); }
|
||||
void operator()(void* obj, const std::string& s0) override
|
||||
{
|
||||
nakedA0 a0;
|
||||
nakedA1 a1;
|
||||
@@ -240,8 +241,8 @@ class G4AnyMethod
|
||||
strs >> a0 >> a1;
|
||||
((T*) obj->*fRef)(a0, a1);
|
||||
}
|
||||
virtual Placeholder* Clone() const { return new FuncRef2(fRef); }
|
||||
virtual const std::type_info& ArgType(size_t i) const
|
||||
Placeholder* Clone() const override { return new FuncRef2(fRef); }
|
||||
const std::type_info& ArgType(size_t i) const override
|
||||
{
|
||||
return i == 0 ? typeid(A0) : typeid(A1);
|
||||
}
|
||||
|
||||
@@ -66,34 +66,33 @@ class G4AnyType
|
||||
|
||||
/** Constructors */
|
||||
|
||||
G4AnyType()
|
||||
{}
|
||||
G4AnyType() = default;
|
||||
|
||||
template <typename ValueType>
|
||||
G4AnyType(ValueType& value)
|
||||
: fContent(new Ref<ValueType>(value))
|
||||
{}
|
||||
template <typename ValueType>
|
||||
G4AnyType(ValueType& value)
|
||||
: fContent(new Ref<ValueType>(value))
|
||||
{}
|
||||
|
||||
/** Copy Constructor */
|
||||
/** Copy Constructor */
|
||||
|
||||
G4AnyType(const G4AnyType& other)
|
||||
: fContent(other.fContent ? other.fContent->Clone() : 0)
|
||||
{}
|
||||
G4AnyType(const G4AnyType& other)
|
||||
: fContent(other.fContent != nullptr ? other.fContent->Clone() : nullptr)
|
||||
{}
|
||||
|
||||
/** Destructor */
|
||||
/** Destructor */
|
||||
|
||||
~G4AnyType() { delete fContent; }
|
||||
~G4AnyType() { delete fContent; }
|
||||
|
||||
/** bool operator */
|
||||
/** bool operator */
|
||||
|
||||
operator bool() { return !Empty(); }
|
||||
operator bool() { return !Empty(); }
|
||||
|
||||
/** Modifiers */
|
||||
/** Modifiers */
|
||||
|
||||
G4AnyType& Swap(G4AnyType& rhs)
|
||||
{
|
||||
std::swap(fContent, rhs.fContent);
|
||||
return *this;
|
||||
G4AnyType& Swap(G4AnyType& rhs)
|
||||
{
|
||||
std::swap(fContent, rhs.fContent);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename ValueType>
|
||||
@@ -111,16 +110,18 @@ class G4AnyType
|
||||
|
||||
/** Queries */
|
||||
|
||||
G4bool Empty() const { return !fContent; }
|
||||
G4bool Empty() const { return fContent == nullptr; }
|
||||
|
||||
const std::type_info& TypeInfo() const
|
||||
{
|
||||
return fContent ? fContent->TypeInfo() : typeid(void);
|
||||
return fContent != nullptr ? fContent->TypeInfo() : typeid(void);
|
||||
}
|
||||
|
||||
/** Address */
|
||||
|
||||
void* Address() const { return fContent ? fContent->Address() : 0; }
|
||||
void* Address() const {
|
||||
return fContent != nullptr ? fContent->Address() : nullptr;
|
||||
}
|
||||
|
||||
/** String conversions */
|
||||
|
||||
@@ -133,26 +134,25 @@ class G4AnyType
|
||||
class Placeholder
|
||||
{
|
||||
public:
|
||||
|
||||
Placeholder() {}
|
||||
Placeholder() = default;
|
||||
|
||||
virtual ~Placeholder() {}
|
||||
virtual ~Placeholder() = default;
|
||||
|
||||
/** Queries */
|
||||
/** Queries */
|
||||
|
||||
virtual const std::type_info& TypeInfo() const = 0;
|
||||
virtual const std::type_info& TypeInfo() const = 0;
|
||||
|
||||
virtual Placeholder* Clone() const = 0;
|
||||
virtual Placeholder* Clone() const = 0;
|
||||
|
||||
virtual void* Address() const = 0;
|
||||
virtual void* Address() const = 0;
|
||||
|
||||
/** ToString */
|
||||
/** ToString */
|
||||
|
||||
virtual std::string ToString() const = 0;
|
||||
virtual std::string ToString() const = 0;
|
||||
|
||||
/** FromString */
|
||||
/** FromString */
|
||||
|
||||
virtual void FromString(const std::string& val) = 0;
|
||||
virtual void FromString(const std::string& val) = 0;
|
||||
};
|
||||
|
||||
template <typename ValueType>
|
||||
@@ -168,22 +168,22 @@ class G4AnyType
|
||||
|
||||
/** Query */
|
||||
|
||||
virtual const std::type_info& TypeInfo() const
|
||||
const std::type_info& TypeInfo() const override
|
||||
{
|
||||
return typeid(ValueType);
|
||||
}
|
||||
|
||||
/** Clone */
|
||||
|
||||
virtual Placeholder* Clone() const { return new Ref(fRef); }
|
||||
Placeholder* Clone() const override { return new Ref(fRef); }
|
||||
|
||||
/** Address */
|
||||
|
||||
virtual void* Address() const { return (void*) (&fRef); }
|
||||
void* Address() const override { return (void*) (&fRef); }
|
||||
|
||||
/** ToString */
|
||||
|
||||
virtual std::string ToString() const
|
||||
std::string ToString() const override
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << fRef;
|
||||
@@ -192,7 +192,7 @@ class G4AnyType
|
||||
|
||||
/** FromString */
|
||||
|
||||
virtual void FromString(const std::string& val)
|
||||
void FromString(const std::string& val) override
|
||||
{
|
||||
std::stringstream ss(val);
|
||||
ss >> fRef;
|
||||
@@ -223,9 +223,13 @@ template <>
|
||||
inline void G4AnyType::Ref<G4String>::FromString(const std::string& val)
|
||||
{
|
||||
if(val[0] == '"')
|
||||
{
|
||||
fRef = val.substr(1, val.size() - 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
fRef = val;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -241,12 +245,11 @@ inline void G4AnyType::Ref<G4ThreeVector>::FromString(const std::string& val)
|
||||
class G4BadAnyCast : public std::bad_cast
|
||||
{
|
||||
public:
|
||||
G4BadAnyCast() = default;
|
||||
|
||||
G4BadAnyCast() {}
|
||||
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return "G4BadAnyCast: failed conversion using any_cast";
|
||||
const char* what() const throw() override
|
||||
{
|
||||
return "G4BadAnyCast: failed conversion using any_cast";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -53,17 +53,17 @@ class G4GenericMessenger : public G4UImessenger
|
||||
const G4String& doc = "");
|
||||
// Contructor
|
||||
|
||||
virtual ~G4GenericMessenger();
|
||||
// Destructor
|
||||
~G4GenericMessenger() override;
|
||||
// Destructor
|
||||
|
||||
virtual G4String GetCurrentValue(G4UIcommand* command);
|
||||
// The concrete, but generic implementation of this method.
|
||||
G4String GetCurrentValue(G4UIcommand* command) override;
|
||||
// The concrete, but generic implementation of this method.
|
||||
|
||||
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
// The concrete, generic implementation of this method converts
|
||||
// the string "newValue" to action.
|
||||
void SetNewValue(G4UIcommand* command, G4String newValue) override;
|
||||
// The concrete, generic implementation of this method converts
|
||||
// the string "newValue" to action.
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
struct Command
|
||||
{
|
||||
@@ -76,8 +76,7 @@ class G4GenericMessenger : public G4UImessenger
|
||||
: command(cmd)
|
||||
, type(&ti)
|
||||
{}
|
||||
Command()
|
||||
{}
|
||||
Command() = default;
|
||||
|
||||
Command& SetStates(G4ApplicationState s0)
|
||||
{
|
||||
@@ -161,7 +160,7 @@ class G4GenericMessenger : public G4UImessenger
|
||||
: Command(cmd, var.TypeInfo())
|
||||
, variable(var)
|
||||
{}
|
||||
Property() {}
|
||||
Property() = default;
|
||||
G4AnyType variable;
|
||||
};
|
||||
|
||||
@@ -172,8 +171,7 @@ class G4GenericMessenger : public G4UImessenger
|
||||
, method(fun)
|
||||
, object(obj)
|
||||
{}
|
||||
Method()
|
||||
{}
|
||||
Method() = default;
|
||||
G4AnyMethod method;
|
||||
void* object = nullptr;
|
||||
};
|
||||
@@ -195,7 +193,12 @@ class G4GenericMessenger : public G4UImessenger
|
||||
void SetDirectory(const G4String& dir) { directory = dir; }
|
||||
void SetGuidance(const G4String& s);
|
||||
void Sort(G4bool val = true)
|
||||
{ if(dircmd) dircmd->Sort(val); }
|
||||
{
|
||||
if(dircmd != nullptr)
|
||||
{
|
||||
dircmd->Sort(val);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -48,11 +48,11 @@ class G4LocalThreadCoutMessenger : public G4UImessenger
|
||||
public:
|
||||
|
||||
G4LocalThreadCoutMessenger();
|
||||
~G4LocalThreadCoutMessenger();
|
||||
~G4LocalThreadCoutMessenger() override;
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
void SetNewValue(G4UIcommand*, G4String) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
G4UIdirectory* coutDir = nullptr;
|
||||
G4UIcommand* coutFileNameCmd = nullptr;
|
||||
|
||||
@@ -50,7 +50,7 @@ class G4ProfilerMessenger : public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4ProfilerMessenger();
|
||||
~G4ProfilerMessenger();
|
||||
~G4ProfilerMessenger() override;
|
||||
|
||||
// no copy but move is fine
|
||||
G4ProfilerMessenger(const G4ProfilerMessenger&) = delete;
|
||||
@@ -60,7 +60,7 @@ class G4ProfilerMessenger : public G4UImessenger
|
||||
G4ProfilerMessenger& operator=(const G4ProfilerMessenger&) = delete;
|
||||
G4ProfilerMessenger& operator=(G4ProfilerMessenger&&) = default;
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
void SetNewValue(G4UIcommand*, G4String) override;
|
||||
// G4String GetCurrentValue(G4UIcommand* command);
|
||||
|
||||
private:
|
||||
|
||||
@@ -43,7 +43,7 @@ class G4UIaliasList
|
||||
{
|
||||
public:
|
||||
|
||||
G4UIaliasList();
|
||||
G4UIaliasList() = default;
|
||||
~G4UIaliasList();
|
||||
|
||||
void RemoveAlias(const char* aliasName);
|
||||
|
||||
@@ -50,14 +50,14 @@ class G4UIbatch : public G4UIsession
|
||||
G4UIbatch(const char* fileName, G4UIsession* prevSession = nullptr);
|
||||
// "prevSession" must be null if this class is constructed from main().
|
||||
|
||||
~G4UIbatch();
|
||||
~G4UIbatch() override;
|
||||
|
||||
inline G4UIsession* GetPreviousSession() const;
|
||||
|
||||
virtual G4UIsession* SessionStart();
|
||||
virtual void PauseSessionStart(const G4String& Prompt);
|
||||
G4UIsession* SessionStart() override;
|
||||
void PauseSessionStart(const G4String& Prompt) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
G4String ReadCommand();
|
||||
// Get command from a batch script file
|
||||
|
||||
@@ -48,7 +48,7 @@ class G4UIbridge
|
||||
public:
|
||||
|
||||
G4UIbridge(G4UImanager* localUI, G4String dir);
|
||||
~G4UIbridge();
|
||||
~G4UIbridge() = default;
|
||||
|
||||
G4int ApplyCommand(const G4String& aCmd);
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ class G4UIcmdWith3Vector : public G4UIcommand
|
||||
// the user omits some of the parameters. If this flag is false, the
|
||||
// values given by the next SetDefaultValue() method are used
|
||||
|
||||
void SetDefaultValue(G4ThreeVector defVal);
|
||||
// Set the default values of the parameters. These default values are
|
||||
// used when the user of this command omits some of the parameter values,
|
||||
// and "omittable" is true and "currentAsDefault" is false
|
||||
void SetDefaultValue(const G4ThreeVector& defVal);
|
||||
// Set the default values of the parameters. These default values are
|
||||
// used when the user of this command omits some of the parameter values,
|
||||
// and "omittable" is true and "currentAsDefault" is false
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ class G4UIcmdWith3VectorAndUnit : public G4UIcommand
|
||||
// Constructor. The command string with full path directory
|
||||
// and the pointer to the messenger must be given
|
||||
|
||||
virtual G4int DoIt(G4String parameterList);
|
||||
G4int DoIt(G4String parameterList) override;
|
||||
|
||||
static G4ThreeVector GetNew3VectorValue(const char* paramString);
|
||||
// Convert string which represents three double values and a unit to
|
||||
@@ -63,15 +63,15 @@ class G4UIcmdWith3VectorAndUnit : public G4UIcommand
|
||||
// Convert the unit string to the value of the unit. "paramString"
|
||||
// must contain three double values AND a unit string
|
||||
|
||||
G4String ConvertToStringWithBestUnit(G4ThreeVector vec);
|
||||
// Convert a 3 vector value to a string of digits and unit. Best unit is
|
||||
// chosen from the unit category of default unit (in case SetDefaultUnit()
|
||||
// is defined) or category defined by SetUnitCategory()
|
||||
G4String ConvertToStringWithBestUnit(const G4ThreeVector& vec);
|
||||
// Convert a 3 vector value to a string of digits and unit. Best unit is
|
||||
// chosen from the unit category of default unit (in case SetDefaultUnit()
|
||||
// is defined) or category defined by SetUnitCategory()
|
||||
|
||||
G4String ConvertToStringWithDefaultUnit(G4ThreeVector vec);
|
||||
// Convert a 3 vector value to a string of digits and unit. Best unit is
|
||||
// chosen from the category defined by SetUnitCategory() in case default
|
||||
// unit is not defined
|
||||
G4String ConvertToStringWithDefaultUnit(const G4ThreeVector& vec);
|
||||
// Convert a 3 vector value to a string of digits and unit. Best unit is
|
||||
// chosen from the category defined by SetUnitCategory() in case default
|
||||
// unit is not defined
|
||||
|
||||
void SetParameterName(const char* theNameX, const char* theNameY,
|
||||
const char* theNameZ, G4bool omittable,
|
||||
@@ -86,10 +86,10 @@ class G4UIcmdWith3VectorAndUnit : public G4UIcommand
|
||||
// the user omit some of the parameters. If this flag is false, the values
|
||||
// given by the next SetDefaultValue() method are used
|
||||
|
||||
void SetDefaultValue(G4ThreeVector defVal);
|
||||
// Set the default values of the parameters. These default values are used
|
||||
// when the user of this command omits some of the parameter values, and
|
||||
// "omittable" is true and "currentAsDefault" is false
|
||||
void SetDefaultValue(const G4ThreeVector& defVal);
|
||||
// Set the default values of the parameters. These default values are used
|
||||
// when the user of this command omits some of the parameter values, and
|
||||
// "omittable" is true and "currentAsDefault" is false
|
||||
|
||||
void SetUnitCategory(const char* unitCategory);
|
||||
void SetUnitCandidates(const char* candidateList);
|
||||
|
||||
@@ -47,7 +47,7 @@ class G4UIcmdWithADoubleAndUnit : public G4UIcommand
|
||||
// Constructor. The command string with full path directory
|
||||
// and the pointer to the messenger must be given
|
||||
|
||||
virtual G4int DoIt(G4String parameterList);
|
||||
G4int DoIt(G4String parameterList) override;
|
||||
|
||||
static G4double GetNewDoubleValue(const char* paramString);
|
||||
// Convert string which represents a double value and a unit to
|
||||
|
||||
@@ -52,7 +52,7 @@ class G4UIcommand
|
||||
{
|
||||
public:
|
||||
|
||||
G4UIcommand();
|
||||
G4UIcommand() = default;
|
||||
// Dummy default constructor
|
||||
|
||||
G4UIcommand(const char* theCommandPath, G4UImessenger* theMessenger,
|
||||
@@ -94,11 +94,12 @@ class G4UIcommand
|
||||
static G4String ConvertToString(G4long longValue);
|
||||
static G4String ConvertToString(G4double doubleValue);
|
||||
static G4String ConvertToString(G4double doubleValue, const char* unitName);
|
||||
static G4String ConvertToString(G4ThreeVector vec);
|
||||
static G4String ConvertToString(G4ThreeVector vec, const char* unitName);
|
||||
// Static methods for conversion from value(s) to a string.
|
||||
// These methods are to be used by GetCurrentValues() methods
|
||||
// of concrete messengers
|
||||
static G4String ConvertToString(const G4ThreeVector& vec);
|
||||
static G4String ConvertToString(const G4ThreeVector& vec,
|
||||
const char* unitName);
|
||||
// Static methods for conversion from value(s) to a string.
|
||||
// These methods are to be used by GetCurrentValues() methods
|
||||
// of concrete messengers
|
||||
|
||||
static G4bool ConvertToBool(const char* st);
|
||||
static G4int ConvertToInt(const char* st);
|
||||
@@ -159,14 +160,13 @@ class G4UIcommand
|
||||
// The first line of the guidance will be used as the title of the
|
||||
// command, i.e. one line list of the commands
|
||||
{
|
||||
commandGuidance.push_back(G4String(aGuidance));
|
||||
commandGuidance.emplace_back(aGuidance);
|
||||
}
|
||||
|
||||
inline const G4String GetTitle() const
|
||||
{
|
||||
return (commandGuidance.size() == 0)
|
||||
? G4String("...Title not available...")
|
||||
: commandGuidance[0];
|
||||
return (commandGuidance.empty()) ? G4String("...Title not available...")
|
||||
: commandGuidance[0];
|
||||
}
|
||||
|
||||
inline void SetToBeBroadcasted(G4bool val) { toBeBroadcasted = val; }
|
||||
@@ -235,25 +235,25 @@ class G4UIcommand
|
||||
G4int IsDouble(const char* str);
|
||||
G4int ExpectExponent(const char* str);
|
||||
// syntax nodes
|
||||
yystype Expression(void);
|
||||
yystype LogicalORExpression(void);
|
||||
yystype LogicalANDExpression(void);
|
||||
yystype EqualityExpression(void);
|
||||
yystype RelationalExpression(void);
|
||||
yystype AdditiveExpression(void);
|
||||
yystype MultiplicativeExpression(void);
|
||||
yystype UnaryExpression(void);
|
||||
yystype PrimaryExpression(void);
|
||||
yystype Expression();
|
||||
yystype LogicalORExpression();
|
||||
yystype LogicalANDExpression();
|
||||
yystype EqualityExpression();
|
||||
yystype RelationalExpression();
|
||||
yystype AdditiveExpression();
|
||||
yystype MultiplicativeExpression();
|
||||
yystype UnaryExpression();
|
||||
yystype PrimaryExpression();
|
||||
// semantics routines
|
||||
G4int Eval2(yystype arg1, G4int op, yystype arg2);
|
||||
G4int Eval2(const yystype& arg1, G4int op, const yystype& arg2);
|
||||
G4int CompareInt(G4int arg1, G4int op, G4int arg2);
|
||||
G4int CompareLong(G4long arg1, G4int op, G4long arg2);
|
||||
G4int CompareDouble(G4double arg1, G4int op, G4double arg2);
|
||||
// utility
|
||||
tokenNum Yylex(void); // returns next token
|
||||
tokenNum Yylex(); // returns next token
|
||||
unsigned IndexOf(const char*); // returns the index of the var name
|
||||
unsigned IsParameter(const char*); // returns 1 or 0
|
||||
G4int G4UIpGetc(void); // read one char from rangeBuf
|
||||
G4int G4UIpGetc(); // read one char from rangeBuf
|
||||
G4int G4UIpUngetc(G4int c); // put back
|
||||
G4int Backslash(G4int c);
|
||||
G4int Follow(G4int expect, G4int ifyes, G4int ifno);
|
||||
|
||||
@@ -45,7 +45,7 @@ class G4UIcommandTree
|
||||
{
|
||||
public:
|
||||
|
||||
G4UIcommandTree();
|
||||
G4UIcommandTree() = default;
|
||||
G4UIcommandTree(const char* thePathName);
|
||||
|
||||
~G4UIcommandTree();
|
||||
@@ -66,7 +66,7 @@ class G4UIcommandTree
|
||||
void List() const;
|
||||
void ListCurrent() const;
|
||||
void ListCurrentWithNum() const;
|
||||
void CreateHTML(G4String = "");
|
||||
void CreateHTML(const G4String& = "");
|
||||
|
||||
inline const G4UIcommand* GetGuidance() const { return guidance; }
|
||||
inline const G4String& GetPathName() const { return pathName; }
|
||||
|
||||
@@ -82,11 +82,11 @@ class G4UIcontrolMessenger : public G4UImessenger
|
||||
public:
|
||||
|
||||
G4UIcontrolMessenger();
|
||||
~G4UIcontrolMessenger();
|
||||
void SetNewValue(G4UIcommand* command, G4String newValue);
|
||||
G4String GetCurrentValue(G4UIcommand* command);
|
||||
~G4UIcontrolMessenger() override;
|
||||
void SetNewValue(G4UIcommand* command, G4String newValue) override;
|
||||
G4String GetCurrentValue(G4UIcommand* command) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
G4UIdirectory* controlDirectory = nullptr;
|
||||
G4UIcmdWithAString* macroPathCommand = nullptr;
|
||||
|
||||
@@ -63,7 +63,7 @@ class G4UImanager : public G4VStateDependent
|
||||
// A static method to get the pointer to the only existing object
|
||||
// of this class
|
||||
|
||||
~G4UImanager();
|
||||
~G4UImanager() override;
|
||||
|
||||
G4UImanager(const G4UImanager&) = delete;
|
||||
const G4UImanager& operator=(const G4UImanager&) = delete;
|
||||
@@ -146,8 +146,8 @@ class G4UImanager : public G4VStateDependent
|
||||
// These methods are used by G4UIcontrolMessenger to use Loop()
|
||||
// and Foreach() methods
|
||||
|
||||
virtual G4bool Notify(G4ApplicationState requestedState);
|
||||
// This method is exclusively invoked by G4StateManager
|
||||
G4bool Notify(G4ApplicationState requestedState) override;
|
||||
// This method is exclusively invoked by G4StateManager
|
||||
|
||||
G4String GetCurrentStringValue(const char* aCommand,
|
||||
G4int parameterNumber = 1,
|
||||
@@ -220,7 +220,7 @@ class G4UImanager : public G4VStateDependent
|
||||
{
|
||||
isMaster = val;
|
||||
stackCommandsForBroadcast = val;
|
||||
if(val && !bridges)
|
||||
if(val && (bridges == nullptr))
|
||||
{
|
||||
bridges = new std::vector<G4UIbridge*>;
|
||||
fMasterUImanager() = this;
|
||||
@@ -234,7 +234,7 @@ class G4UImanager : public G4VStateDependent
|
||||
void SetUpForAThread(G4int tId);
|
||||
// Setups as above but for a non-worker thread (e.g. vis)
|
||||
|
||||
void SetUpForSpecialThread(G4String aPrefix);
|
||||
void SetUpForSpecialThread(const G4String& aPrefix);
|
||||
|
||||
inline G4int GetThreadID() const { return threadID; }
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class G4UImessenger
|
||||
{
|
||||
public:
|
||||
|
||||
G4UImessenger();
|
||||
G4UImessenger() = default;
|
||||
G4UImessenger(const G4String& path, const G4String& dsc,
|
||||
G4bool commandsToBeBroadcasted = true);
|
||||
// Constructor. In the implementation of the concrete messenger,
|
||||
@@ -84,9 +84,9 @@ class G4UImessenger
|
||||
G4String ItoS(G4int i);
|
||||
G4String DtoS(G4double a);
|
||||
G4String BtoS(G4bool b);
|
||||
G4int StoI(G4String s);
|
||||
G4long StoL(G4String s);
|
||||
G4double StoD(G4String s);
|
||||
G4int StoI(const G4String& s);
|
||||
G4long StoL(const G4String& s);
|
||||
G4double StoD(const G4String& s);
|
||||
G4bool StoB(G4String s);
|
||||
|
||||
void AddUIcommand(G4UIcommand* newCommand);
|
||||
@@ -114,7 +114,9 @@ T* G4UImessenger::CreateCommand(const G4String& cname, const G4String& dsc)
|
||||
{
|
||||
path = baseDirName + cname;
|
||||
if(path[0] != '/')
|
||||
{
|
||||
path = "/" + path;
|
||||
}
|
||||
}
|
||||
|
||||
T* command = new T(path.c_str(), this);
|
||||
|
||||
@@ -46,7 +46,7 @@ class G4UIparameter
|
||||
{
|
||||
public:
|
||||
|
||||
G4UIparameter();
|
||||
G4UIparameter() = default;
|
||||
G4UIparameter(char theType);
|
||||
G4UIparameter(const char* theName, char theType, G4bool theOmittable);
|
||||
// Constructors, where "theName" is the name of the parameter which will
|
||||
@@ -144,23 +144,23 @@ class G4UIparameter
|
||||
G4int IsDouble(const char* str);
|
||||
G4int ExpectExponent(const char* str);
|
||||
// syntax nodes
|
||||
yystype Expression(void);
|
||||
yystype LogicalORExpression(void);
|
||||
yystype LogicalANDExpression(void);
|
||||
yystype EqualityExpression(void);
|
||||
yystype RelationalExpression(void);
|
||||
yystype AdditiveExpression(void);
|
||||
yystype MultiplicativeExpression(void);
|
||||
yystype UnaryExpression(void);
|
||||
yystype PrimaryExpression(void);
|
||||
yystype Expression();
|
||||
yystype LogicalORExpression();
|
||||
yystype LogicalANDExpression();
|
||||
yystype EqualityExpression();
|
||||
yystype RelationalExpression();
|
||||
yystype AdditiveExpression();
|
||||
yystype MultiplicativeExpression();
|
||||
yystype UnaryExpression();
|
||||
yystype PrimaryExpression();
|
||||
// semantics routines
|
||||
G4int Eval2(yystype arg1, G4int op, yystype arg2);
|
||||
G4int Eval2(const yystype& arg1, G4int op, const yystype& arg2);
|
||||
G4int CompareInt(G4int arg1, G4int op, G4int arg2);
|
||||
G4int CompareLong(G4long arg1, G4int op, G4long arg2);
|
||||
G4int CompareDouble(double arg1, G4int op, double arg2);
|
||||
// utility
|
||||
tokenNum Yylex(void); // returns next token
|
||||
G4int G4UIpGetc(void); // read one char from rangeBuf
|
||||
tokenNum Yylex(); // returns next token
|
||||
G4int G4UIpGetc(); // read one char from rangeBuf
|
||||
G4int G4UIpUngetc(G4int c); // put back
|
||||
G4int Backslash(G4int c);
|
||||
G4int Follow(G4int expect, G4int ifyes, G4int ifno);
|
||||
|
||||
@@ -45,7 +45,7 @@ class G4UIsession : public G4coutDestination
|
||||
|
||||
G4UIsession();
|
||||
G4UIsession(G4int iBatch);
|
||||
virtual ~G4UIsession();
|
||||
~G4UIsession() override;
|
||||
|
||||
virtual G4UIsession* SessionStart();
|
||||
// This method will be invoked by main().
|
||||
@@ -55,9 +55,9 @@ class G4UIsession : public G4coutDestination
|
||||
// This method will be invoked by G4UImanager
|
||||
// when the kernel comes to Pause state
|
||||
|
||||
virtual G4int ReceiveG4cout(const G4String& coutString);
|
||||
virtual G4int ReceiveG4cerr(const G4String& cerrString);
|
||||
// These two methods will be invoked by G4strstreambuf
|
||||
G4int ReceiveG4cout(const G4String& coutString) override;
|
||||
G4int ReceiveG4cerr(const G4String& cerrString) override;
|
||||
// These two methods will be invoked by G4strstreambuf
|
||||
|
||||
static G4int InSession();
|
||||
inline G4int GetLastReturnCode() const { return lastRC; }
|
||||
|
||||
@@ -62,31 +62,25 @@ namespace G4UItokenNum
|
||||
MINUS = 45
|
||||
};
|
||||
|
||||
typedef struct yystype
|
||||
using yystype = struct yystype
|
||||
{
|
||||
tokenNum type;
|
||||
G4double D;
|
||||
G4int I;
|
||||
G4long L;
|
||||
char C;
|
||||
tokenNum type{ tokenNum::NONE };
|
||||
G4double D{ 0.0 };
|
||||
G4int I{ 0 };
|
||||
G4long L{ 0 };
|
||||
char C{ ' ' };
|
||||
G4String S;
|
||||
|
||||
yystype()
|
||||
: type(tokenNum::NONE)
|
||||
, D(0.0)
|
||||
, I(0)
|
||||
, L(0)
|
||||
, C(' ')
|
||||
, S("")
|
||||
: S("")
|
||||
{}
|
||||
G4bool operator==(const yystype& right) const
|
||||
{
|
||||
return (this == &right) ? 1 : 0;
|
||||
}
|
||||
G4bool operator==(const yystype& right) const { return this == &right; }
|
||||
yystype& operator=(const yystype& right)
|
||||
{
|
||||
if(&right == this)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
type = right.type;
|
||||
D = right.D;
|
||||
I = right.I;
|
||||
@@ -96,7 +90,7 @@ namespace G4UItokenNum
|
||||
return *this;
|
||||
}
|
||||
yystype(const yystype& right) { *this = right; }
|
||||
} yystype;
|
||||
};
|
||||
} // namespace G4UItokenNum
|
||||
|
||||
#endif
|
||||
|
||||
@@ -46,11 +46,11 @@ class G4UnitsMessenger : public G4UImessenger
|
||||
public:
|
||||
|
||||
G4UnitsMessenger();
|
||||
~G4UnitsMessenger();
|
||||
~G4UnitsMessenger() override;
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
void SetNewValue(G4UIcommand*, G4String) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
G4UIdirectory* UnitsTableDir = nullptr;
|
||||
G4UIcmdWithoutParameter* ListCmd = nullptr;
|
||||
|
||||
@@ -63,7 +63,7 @@ class G4VGlobalFastSimulationManager
|
||||
// Returns pointer to the actual Global Fast Simulation manager if
|
||||
// at least a parameterisation envelope exists
|
||||
|
||||
virtual ~G4VGlobalFastSimulationManager() {}
|
||||
virtual ~G4VGlobalFastSimulationManager() = default;
|
||||
|
||||
virtual G4VFlavoredParallelWorld* GetFlavoredWorldForThis(
|
||||
G4ParticleDefinition*) = 0;
|
||||
|
||||
Reference in New Issue
Block a user