Import Geant4 11.2.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2023-06-30 09:09:57 +02:00
parent aef78ca386
commit dd1f179cda
3780 changed files with 212808 additions and 142780 deletions
+67 -102
View File
@@ -47,58 +47,47 @@
#ifndef G4AnyMethod_hh
#define G4AnyMethod_hh 1
#include "G4Types.hh"
#include <functional>
#include <sstream>
#include <type_traits>
/** Bad Argument exception */
class G4BadArgument : public std::bad_cast
{
public:
G4BadArgument() = default;
const char* what() const throw() override
{
return "G4BadArgument: failed operator()";
}
public:
G4BadArgument() = default;
const char* what() const throw() override { return "G4BadArgument: failed operator()"; }
};
#include <type_traits>
using std::remove_const;
using std::remove_reference;
class G4AnyMethod
{
public:
G4AnyMethod() = default;
/** contructors */
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>
G4AnyMethod(S (T::*f)(A0))
: narg(1)
template<class S, class T, class A0>
G4AnyMethod(S (T::*f)(A0)) : narg(1)
{
fContent = new FuncRef1<S, T, A0>(f);
}
template <class S, class T, class A0, class A1>
G4AnyMethod(S (T::*f)(A0, A1))
: narg(2)
template<class S, class T, class A0, class A1>
G4AnyMethod(S (T::*f)(A0, A1)) : narg(2)
{
fContent = new FuncRef2<S, T, A0, A1>(f);
}
G4AnyMethod(const G4AnyMethod& other)
: fContent(other.fContent != nullptr ? other.fContent->Clone() : nullptr)
, narg(other.narg)
: fContent(other.fContent != nullptr ? other.fContent->Clone() : nullptr), narg(other.narg)
{}
/** destructor */
~G4AnyMethod() { delete fContent; }
G4AnyMethod& Swap(G4AnyMethod& rhs)
@@ -108,9 +97,7 @@ class G4AnyMethod
return *this;
}
/** Assignment operators */
template <class S, class T>
template<class S, class T>
G4AnyMethod& operator=(S (T::*f)())
{
G4AnyMethod(f).Swap(*this);
@@ -118,14 +105,14 @@ class G4AnyMethod
return *this;
}
template <class S, class T, class A0>
template<class S, class T, class A0>
G4AnyMethod& operator=(S (T::*f)(A0))
{
G4AnyMethod(f).Swap(*this);
narg = 1;
return *this;
}
template <class S, class T, class A0, class A1>
template<class S, class T, class A0, class A1>
G4AnyMethod& operator=(S (T::*f)(A0, A1))
{
G4AnyMethod(f).Swap(*this);
@@ -147,10 +134,7 @@ class G4AnyMethod
/** call operators */
void operator()(void* obj) { fContent->operator()(obj); }
void operator()(void* obj, const std::string& a0)
{
fContent->operator()(obj, a0);
}
void operator()(void* obj, const std::string& a0) { fContent->operator()(obj, a0); }
/** Number of arguments */
@@ -162,91 +146,72 @@ class G4AnyMethod
}
private:
class Placeholder
{
public:
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;
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>
template<class S, class T>
struct FuncRef : public Placeholder
{
FuncRef(S (T::*f)())
: fRef(f)
{}
FuncRef(S (T::*f)()) : fRef(f) {}
void operator()(void* obj) override { ((T*) obj->*fRef)(); }
void operator()(void*, const std::string&) override
{
throw G4BadArgument();
}
Placeholder* Clone() const override { return new FuncRef(fRef); }
const std::type_info& ArgType(std::size_t) const override
{
return typeid(void);
}
S (T::*fRef)();
void operator()(void* obj) override { ((T*)obj->*fRef)(); }
void operator()(void*, const std::string&) override { throw G4BadArgument(); }
Placeholder* Clone() const override { return new FuncRef(fRef); }
const std::type_info& ArgType(std::size_t) const override { return typeid(void); }
S (T::*fRef)();
};
template <class S, class T, class A0>
template<class S, class T, class A0>
struct FuncRef1 : public Placeholder
{
using nakedA0 =
typename remove_const<typename remove_reference<A0>::type>::type;
using nakedA0 = std::remove_const_t<std::remove_reference_t<A0>>;
FuncRef1(S (T::*f)(A0))
: fRef(f)
{}
FuncRef1(S (T::*f)(A0)) : fRef(f) {}
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);
}
Placeholder* Clone() const override { return new FuncRef1(fRef); }
const std::type_info& ArgType(size_t) const override
{
return typeid(A0);
}
S (T::*fRef)(A0);
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);
}
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>
template<class S, class T, class A0, class A1>
struct FuncRef2 : public Placeholder
{
using nakedA0 =
typename remove_const<typename remove_reference<A0>::type>::type;
using nakedA1 =
typename remove_const<typename remove_reference<A1>::type>::type;
using nakedA0 = std::remove_const_t<std::remove_reference_t<A0>>;
using nakedA1 = std::remove_const_t<std::remove_reference_t<A1>>;
FuncRef2(S (T::*f)(A0, A1))
: fRef(f)
{}
FuncRef2(S (T::*f)(A0, A1)) : fRef(f) {}
void operator()(void*) override { throw G4BadArgument(); }
void operator()(void* obj, const std::string& s0) override
{
nakedA0 a0;
nakedA1 a1;
std::stringstream strs(s0);
strs >> a0 >> a1;
((T*) obj->*fRef)(a0, a1);
}
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);
}
S (T::*fRef)(A0, A1);
void operator()(void*) override { throw G4BadArgument(); }
void operator()(void* obj, const std::string& s0) override
{
nakedA0 a0;
nakedA1 a1;
std::stringstream strs(s0);
strs >> a0 >> a1;
((T*)obj->*fRef)(a0, a1);
}
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);
}
S (T::*fRef)(A0, A1);
};
Placeholder* fContent = nullptr;
+52 -66
View File
@@ -26,7 +26,7 @@
// G4AnyType
//
// Class description:
//
//
// The class G4AnyType represents any data type.
// The class only holds a reference to the type and not the value.
@@ -47,55 +47,53 @@
#ifndef G4AnyType_hh
#define G4AnyType_hh 1
#include "G4UIcommand.hh"
#include <algorithm>
#include <typeinfo>
#include <iostream>
#include <sstream>
#include "G4UIcommand.hh"
#include <typeinfo>
class G4String;
namespace CLHEP
{
class Hep3Vector;
class Hep3Vector;
}
class G4AnyType
{
public:
/** Constructors */
G4AnyType() = default;
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 != nullptr ? other.fContent->Clone() : nullptr)
{}
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>
template<typename ValueType>
G4AnyType& operator=(const ValueType& rhs)
{
G4AnyType(rhs).Swap(*this);
@@ -119,9 +117,7 @@ class G4AnyType
/** Address */
void* Address() const {
return fContent != nullptr ? fContent->Address() : nullptr;
}
void* Address() const { return fContent != nullptr ? fContent->Address() : nullptr; }
/** String conversions */
@@ -130,48 +126,41 @@ class G4AnyType
void FromString(const std::string& val) { fContent->FromString(val); }
private:
class Placeholder
{
public:
Placeholder() = default;
Placeholder() = default;
virtual ~Placeholder() = default;
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>
template<typename ValueType>
class Ref : public Placeholder
{
public:
/** Constructor */
Ref(ValueType& value)
: fRef(value)
{}
Ref(ValueType& value) : fRef(value) {}
/** Query */
const std::type_info& TypeInfo() const override
{
return typeid(ValueType);
}
const std::type_info& TypeInfo() const override { return typeid(ValueType); }
/** Clone */
@@ -179,7 +168,7 @@ class G4AnyType
/** Address */
void* Address() const override { return (void*) (&fRef); }
void* Address() const override { return (void*)(&fRef); }
/** ToString */
@@ -203,7 +192,7 @@ class G4AnyType
/** representation */
template <typename ValueType>
template<typename ValueType>
friend ValueType* any_cast(G4AnyType*);
Placeholder* fContent = nullptr;
@@ -213,26 +202,24 @@ class G4AnyType
// Specializations
//
template <>
template<>
inline void G4AnyType::Ref<bool>::FromString(const std::string& val)
{
fRef = G4UIcommand::ConvertToBool(val.c_str());
}
template <>
template<>
inline void G4AnyType::Ref<G4String>::FromString(const std::string& val)
{
if(val[0] == '"')
{
if (val[0] == '"') {
fRef = val.substr(1, val.size() - 2);
}
else
{
else {
fRef = val;
}
}
template <>
template<>
inline void G4AnyType::Ref<G4ThreeVector>::FromString(const std::string& val)
{
fRef = G4UIcommand::ConvertTo3Vector(val.c_str());
@@ -245,17 +232,17 @@ inline void G4AnyType::Ref<G4ThreeVector>::FromString(const std::string& val)
class G4BadAnyCast : public std::bad_cast
{
public:
G4BadAnyCast() = default;
G4BadAnyCast() = default;
const char* what() const throw() override
{
return "G4BadAnyCast: failed conversion using any_cast";
const char* what() const throw() override
{
return "G4BadAnyCast: failed conversion using any_cast";
}
};
/** value */
template <typename ValueType>
template<typename ValueType>
ValueType* any_cast(G4AnyType* operand)
{
return operand && operand->TypeInfo() == typeid(ValueType)
@@ -263,18 +250,17 @@ ValueType* any_cast(G4AnyType* operand)
: nullptr;
}
template <typename ValueType>
template<typename ValueType>
const ValueType* any_cast(const G4AnyType* operand)
{
return any_cast<ValueType>(const_cast<G4AnyType*>(operand));
}
template <typename ValueType>
template<typename ValueType>
ValueType any_cast(const G4AnyType& operand)
{
const ValueType* result = any_cast<ValueType>(&operand);
if(!result)
{
if (!result) {
throw G4BadAnyCast();
}
return *result;
+98 -122
View File
@@ -34,11 +34,11 @@
#ifndef G4GenericMessenger_hh
#define G4GenericMessenger_hh 1
#include "G4UImessenger.hh"
#include "G4UIcommand.hh"
#include "G4AnyType.hh"
#include "G4AnyMethod.hh"
#include "G4AnyType.hh"
#include "G4ApplicationState.hh"
#include "G4UIcommand.hh"
#include "G4UImessenger.hh"
#include <map>
#include <vector>
@@ -48,160 +48,136 @@ class G4UIdirectory;
class G4GenericMessenger : public G4UImessenger
{
public:
// Contructor
G4GenericMessenger(void* obj, const G4String& dir = "", const G4String& doc = "");
G4GenericMessenger(void* obj, const G4String& dir = "",
const G4String& doc = "");
// Contructor
~G4GenericMessenger() override;
// Destructor
~G4GenericMessenger() override;
G4String GetCurrentValue(G4UIcommand* command) override;
// The concrete, but generic implementation of this method.
G4String GetCurrentValue(G4UIcommand* command) override;
void SetNewValue(G4UIcommand* command, G4String newValue) override;
// The concrete, generic implementation of this method converts
// the string "newValue" to action.
void SetNewValue(G4UIcommand* command, G4String newValue) override;
public:
public:
struct Command
{
enum UnitSpec
{
UnitCategory,
UnitDefault
};
Command(G4UIcommand* cmd, const std::type_info& ti)
: command(cmd)
, type(&ti)
{}
Command() = default;
enum UnitSpec
{
UnitCategory,
UnitDefault
};
Command(G4UIcommand* cmd, const std::type_info& ti) : command(cmd), type(&ti) {}
Command() = default;
Command& SetStates(G4ApplicationState s0)
{
command->AvailableForStates(s0);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1)
{
command->AvailableForStates(s0, s1);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1,
G4ApplicationState s2)
{
command->AvailableForStates(s0, s1, s2);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1,
G4ApplicationState s2, G4ApplicationState s3)
{
command->AvailableForStates(s0, s1, s2, s3);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1,
G4ApplicationState s2, G4ApplicationState s3,
G4ApplicationState s4)
{
command->AvailableForStates(s0, s1, s2, s3, s4);
return *this;
}
Command& SetRange(const G4String& range)
{
command->SetRange(range.c_str());
return *this;
}
Command& SetGuidance(const G4String& s0)
{
command->SetGuidance(s0);
return *this;
}
Command& SetUnit(const G4String&, UnitSpec = UnitDefault);
Command& SetUnitCategory(const G4String& u)
{
return SetUnit(u, UnitCategory);
}
Command& SetDefaultUnit(const G4String& u)
{
return SetUnit(u, UnitDefault);
}
Command& SetParameterName(const G4String&, G4bool, G4bool = false);
Command& SetParameterName(G4int pIdx, const G4String&, G4bool, G4bool = false);
Command& SetParameterName(const G4String&, const G4String&, const G4String&,
G4bool, G4bool = false);
Command& SetDefaultValue(const G4String&);
Command& SetDefaultValue(G4int pIdx, const G4String&);
Command& SetCandidates(const G4String&);
Command& SetCandidates(G4int pIdx, const G4String&);
Command& SetToBeBroadcasted(G4bool s0)
{
command->SetToBeBroadcasted(s0);
return *this;
}
Command& SetToBeFlushed(G4bool s0)
{
command->SetToBeFlushed(s0);
return *this;
}
Command& SetWorkerThreadOnly(G4bool s0)
{
command->SetWorkerThreadOnly(s0);
return *this;
}
Command& SetStates(G4ApplicationState s0)
{
command->AvailableForStates(s0);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1)
{
command->AvailableForStates(s0, s1);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1, G4ApplicationState s2)
{
command->AvailableForStates(s0, s1, s2);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1, G4ApplicationState s2,
G4ApplicationState s3)
{
command->AvailableForStates(s0, s1, s2, s3);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1, G4ApplicationState s2,
G4ApplicationState s3, G4ApplicationState s4)
{
command->AvailableForStates(s0, s1, s2, s3, s4);
return *this;
}
Command& SetRange(const G4String& range)
{
command->SetRange(range.c_str());
return *this;
}
Command& SetGuidance(const G4String& s0)
{
command->SetGuidance(s0);
return *this;
}
Command& SetUnit(const G4String&, UnitSpec = UnitDefault);
Command& SetUnitCategory(const G4String& u) { return SetUnit(u, UnitCategory); }
Command& SetDefaultUnit(const G4String& u) { return SetUnit(u, UnitDefault); }
Command& SetParameterName(const G4String&, G4bool, G4bool = false);
Command& SetParameterName(G4int pIdx, const G4String&, G4bool, G4bool = false);
Command& SetParameterName(const G4String&, const G4String&, const G4String&, G4bool,
G4bool = false);
Command& SetDefaultValue(const G4String&);
Command& SetDefaultValue(G4int pIdx, const G4String&);
Command& SetCandidates(const G4String&);
Command& SetCandidates(G4int pIdx, const G4String&);
Command& SetToBeBroadcasted(G4bool s0)
{
command->SetToBeBroadcasted(s0);
return *this;
}
Command& SetToBeFlushed(G4bool s0)
{
command->SetToBeFlushed(s0);
return *this;
}
Command& SetWorkerThreadOnly(G4bool s0)
{
command->SetWorkerThreadOnly(s0);
return *this;
}
G4UIcommand* command = nullptr;
const std::type_info* type = nullptr;
G4UIcommand* command = nullptr;
const std::type_info* type = nullptr;
};
struct Property : public Command
{
Property(const G4AnyType& var, G4UIcommand* cmd)
: Command(cmd, var.TypeInfo())
, variable(var)
{}
Property() = default;
G4AnyType variable;
Property(const G4AnyType& var, G4UIcommand* cmd)
: Command(cmd, var.TypeInfo()), variable(var)
{}
Property() = default;
G4AnyType variable;
};
struct Method : public Command
{
Method(const G4AnyMethod& fun, void* obj, G4UIcommand* cmd)
: Command(cmd, fun.ArgType())
, method(fun)
, object(obj)
{}
Method() = default;
G4AnyMethod method;
void* object = nullptr;
Method(const G4AnyMethod& fun, void* obj, G4UIcommand* cmd)
: Command(cmd, fun.ArgType()), method(fun), object(obj)
{}
Method() = default;
G4AnyMethod method;
void* object = nullptr;
};
// Declare Methods
Command& DeclareProperty(const G4String& name, const G4AnyType& variable,
const G4String& doc = "");
Command& DeclarePropertyWithUnit(const G4String& name,
const G4String& defaultUnit,
const G4AnyType& variable,
const G4String& doc = "");
Command& DeclareMethod(const G4String& name, const G4AnyMethod& fun,
const G4String& doc = "");
Command& DeclareMethodWithUnit(const G4String& name,
const G4String& defaultUnit,
const G4AnyMethod& fun,
const G4String& doc = "");
Command& DeclarePropertyWithUnit(const G4String& name, const G4String& defaultUnit,
const G4AnyType& variable, const G4String& doc = "");
Command& DeclareMethod(const G4String& name, const G4AnyMethod& fun, const G4String& doc = "");
Command& DeclareMethodWithUnit(const G4String& name, const G4String& defaultUnit,
const G4AnyMethod& fun, const G4String& doc = "");
void SetDirectory(const G4String& dir) { directory = dir; }
void SetGuidance(const G4String& s);
void Sort(G4bool val = true)
{
if(dircmd != nullptr)
{
if (dircmd != nullptr) {
dircmd->Sort(val);
}
}
private:
std::map<G4String, Property> properties;
std::map<G4String, Method> methods;
G4UIdirectory* dircmd = nullptr;
+6 -7
View File
@@ -39,16 +39,15 @@
#ifndef G4UI_BATCH_HH
#define G4UI_BATCH_HH 1
#include <fstream>
#include "G4UIsession.hh"
#include <fstream>
class G4UIbatch : public G4UIsession
{
public:
// "prevSession" must be null if this class is constructed from main().
G4UIbatch(const char* fileName, G4UIsession* prevSession = nullptr);
// "prevSession" must be null if this class is constructed from main().
~G4UIbatch() override;
@@ -57,13 +56,13 @@ class G4UIbatch : public G4UIsession
G4UIsession* SessionStart() override;
void PauseSessionStart(const G4String& Prompt) override;
private:
private:
// Get command from a batch script file
G4String ReadCommand();
// Get command from a batch script file
G4int ExecCommand(const G4String& command);
private:
G4UIsession* previousSession = nullptr;
std::ifstream macroStream;
-2
View File
@@ -46,7 +46,6 @@ class G4UImanager;
class G4UIbridge
{
public:
G4UIbridge(G4UImanager* localUI, G4String dir);
~G4UIbridge() = default;
@@ -57,7 +56,6 @@ class G4UIbridge
inline G4int DirLength() const { return (G4int)dirName.length(); }
private:
G4UImanager* localUImanager = nullptr;
G4String dirName;
};
+18 -21
View File
@@ -36,38 +36,35 @@
#ifndef G4UIcmdWith3Vector_hh
#define G4UIcmdWith3Vector_hh 1
#include "G4UIcommand.hh"
#include "G4ThreeVector.hh"
#include "G4UIcommand.hh"
class G4UIcmdWith3Vector : public G4UIcommand
{
public:
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWith3Vector(const char* theCommandPath, G4UImessenger* theMessenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
static G4ThreeVector GetNew3VectorValue(const char* paramString);
// Convert string which represents three double values to
// G4ThreeVector
// Set the parameter names for three parameters. Names are used by
// the range checking function.
// If "omittable" is set as true, the user of this command can omit
// the value(s) when the command is applied. If "omittable" is false,
// the user must supply all three values.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current values are used as the default values when
// the user omits some of the parameters. If this flag is false, the
// values given by the next SetDefaultValue() method are used
void SetParameterName(const char* theNameX, const char* theNameY, const char* theNameZ,
G4bool omittable, G4bool currentAsDefault = false);
void SetParameterName(const char* theNameX, const char* theNameY,
const char* theNameZ, G4bool omittable,
G4bool currentAsDefault = false);
// Set the parameter names for three parameters. Names are used by
// the range checking function.
// If "omittable" is set as true, the user of this command can omit
// the value(s) when the command is applied. If "omittable" is false,
// the user must supply all three values.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current values are used as the default values when
// the user omits some of the parameters. If this flag is false, the
// values given by the next SetDefaultValue() method are used
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 SetDefaultValue(const G4ThreeVector& defVal);
// Convert string which represents three double values to G4ThreeVector
static G4ThreeVector GetNew3VectorValue(const char* paramString);
};
#endif
@@ -36,81 +36,78 @@
#ifndef G4UIcmdWith3VectorAndUnit_hh
#define G4UIcmdWith3VectorAndUnit_hh 1
#include "G4UIcommand.hh"
#include "G4ThreeVector.hh"
#include "G4UIcommand.hh"
class G4UIcmdWith3VectorAndUnit : public G4UIcommand
{
public:
G4UIcmdWith3VectorAndUnit(const char* theCommandPath,
G4UImessenger* theMessenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWith3VectorAndUnit(const char* theCommandPath, G4UImessenger* theMessenger);
G4int DoIt(G4String parameterList) override;
static G4ThreeVector GetNew3VectorValue(const char* paramString);
// Convert string which represents three double values and a unit to
// G4ThreeVector. Values are converted to the Geant4 internal unit
static G4ThreeVector GetNew3VectorRawValue(const char* paramString);
// Convert string which represents three double values and a unit to
// G4ThreeVector. Values are NOT converted to the Geant4 internal unit
// but just as the given string
static G4double GetNewUnitValue(const char* paramString);
// Convert the unit string to the value of the unit. "paramString"
// must contain three double values AND a unit string
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 ConvertToStringWithBestUnit(const G4ThreeVector& vec);
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
G4String ConvertToStringWithDefaultUnit(const G4ThreeVector& vec);
void SetParameterName(const char* theNameX, const char* theNameY,
const char* theNameZ, G4bool omittable,
G4bool currentAsDefault = false);
// Set the parameter names for three parameters. Names are used by
// the range checking routine.
// If "omittable" is set as true, the user of this command can omit
// the value(s) when the command is applied. If "omittable" is false,
// the user must supply all three values.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current values are used as the default values when
// the user omit some of the parameters. If this flag is false, the values
// given by the next SetDefaultValue() method are used
// Set the parameter names for three parameters. Names are used by
// the range checking routine.
// If "omittable" is set as true, the user of this command can omit
// the value(s) when the command is applied. If "omittable" is false,
// the user must supply all three values.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current values are used as the default values when
// the user omit some of the parameters. If this flag is false, the values
// given by the next SetDefaultValue() method are used
void SetParameterName(const char* theNameX, const char* theNameY, const char* theNameZ,
G4bool omittable, G4bool currentAsDefault = 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 SetDefaultValue(const G4ThreeVector& defVal);
// These three methods must be used alternatively.
// The user cannot omit the unit as the fourth parameter of the command
// if SetUnitCategory() or SetUnitCandidates() is used, while the unit
// defined by SetDefaultUnit() method is used as the default unit so that
// the user can omit the fourth parameter.
// SetUnitCategory() defines the category of the units which will be
// accepted.
// The available categories can be found in G4SystemOfUnits.hh in 'global'
// category. Only the units categorized in the given category are accepted
// as the fourth parameter of the command.
// SetUnitCandidates() defines the candidates of units. Units listed in
// the argument of this method must be separated by space(s). Only the
// units listed in the candidate list are accepted as the fourth parameter
// of the command.
// SetDefaultUnit() defines the default unit and also defines the category
// of the allowed units. Thus only the units categorized as the given
// default unit will be accepted.
void SetUnitCategory(const char* unitCategory);
void SetUnitCandidates(const char* candidateList);
void SetDefaultUnit(const char* defUnit);
// These three methods must be used alternatively.
// The user cannot omit the unit as the fourth parameter of the command
// if SetUnitCategory() or SetUnitCandidates() is used, while the unit
// defined by SetDefaultUnit() method is used as the default unit so that
// the user can omit the fourth parameter.
// SetUnitCategory() defines the category of the units which will be
// accepted.
// The available categories can be found in G4SystemOfUnits.hh in 'global'
// category. Only the units categorized in the given category are accepted
// as the fourth parameter of the command.
// SetUnitCandidates() defines the candidates of units. Units listed in
// the argument of this method must be separated by space(s). Only the
// units listed in the candidate list are accepted as the fourth parameter
// of the command.
// SetDefaultUnit() defines the default unit and also defines the category
// of the allowed units. Thus only the units categorized as the given
// default unit will be accepted.
// Convert string which represents three double values and a unit to
// G4ThreeVector. Values are converted to the Geant4 internal unit
static G4ThreeVector GetNew3VectorValue(const char* paramString);
// Convert string which represents three double values and a unit to
// G4ThreeVector. Values are NOT converted to the Geant4 internal unit
// but just as the given string
static G4ThreeVector GetNew3VectorRawValue(const char* paramString);
// Convert the unit string to the value of the unit. "paramString"
// must contain three double values AND a unit string
static G4double GetNewUnitValue(const char* paramString);
};
#endif
+17 -19
View File
@@ -45,29 +45,27 @@
class G4UIcmdWithABool : public G4UIcommand
{
public:
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWithABool(const char* theCommandPath, G4UImessenger* theMessenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
static G4bool GetNewBoolValue(const char* paramString);
// Convert string which represents a boolean value to G4bool
void SetParameterName(const char* theName, G4bool omittable,
G4bool currentAsDefault = false);
// Set the parameter name for a Boolean parameter.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply a Boolean value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by the
// next SetDefaultValue() method is used
// Set the parameter name for a Boolean parameter.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply a Boolean value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by the
// next SetDefaultValue() method is used
void SetParameterName(const char* theName, G4bool omittable, G4bool currentAsDefault = false);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
void SetDefaultValue(G4bool defVal);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
// Convert string which represents a boolean value to G4bool
static G4bool GetNewBoolValue(const char* paramString);
};
#endif
+17 -19
View File
@@ -41,29 +41,27 @@
class G4UIcmdWithADouble : public G4UIcommand
{
public:
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWithADouble(const char* theCommandPath, G4UImessenger* theMessenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
static G4double GetNewDoubleValue(const char* paramString);
// Convert string which represents a double value to a double
void SetParameterName(const char* theName, G4bool omittable,
G4bool currentAsDefault = false);
// Set the parameter name. The name is used by the range checking.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply a double value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by
// the next SetDefaultValue() method is used
// Set the parameter name. The name is used by the range checking.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply a double value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by
// the next SetDefaultValue() method is used
void SetParameterName(const char* theName, G4bool omittable, G4bool currentAsDefault = false);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
void SetDefaultValue(G4double defVal);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
// Convert string which represents a double value to a double
static G4double GetNewDoubleValue(const char* paramString);
};
#endif
@@ -41,74 +41,71 @@
class G4UIcmdWithADoubleAndUnit : public G4UIcommand
{
public:
G4UIcmdWithADoubleAndUnit(const char* theCommandPath,
G4UImessenger* theMessenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWithADoubleAndUnit(const char* theCommandPath, G4UImessenger* theMessenger);
G4int DoIt(G4String parameterList) override;
static G4double GetNewDoubleValue(const char* paramString);
// Convert string which represents a double value and a unit to
// double. Value is converted to the Geant4 internal unit
static G4double GetNewDoubleRawValue(const char* paramString);
// Convert string which represents a double value and a unit to
// double. Value is NOT converted to the Geant4 internal unit
// but just as the given string
static G4double GetNewUnitValue(const char* paramString);
// Convert the unit string to the value of the unit. "paramString"
// must contain a double value AND a unit string
// Convert a double 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(G4double val);
// Convert a double 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()
// Convert a double 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(G4double val);
// Convert a double 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* theName, G4bool omittable,
G4bool currentAsDefault = false);
// Set the parameter name for double parameters. Name is used by
// the range checking function.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply a value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the double parameter. If this flag is false, the value
// given by the next SetDefaultValue() method is used
// Set the parameter name for double parameters. Name is used by
// the range checking function.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply a value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the double parameter. If this flag is false, the value
// given by the next SetDefaultValue() method is used
void SetParameterName(const char* theName, G4bool omittable, G4bool currentAsDefault = false);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
void SetDefaultValue(G4double defVal);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
// These three methods must be used alternatively.
// The user cannot omit the unit as the second parameter of the command
// if SetUnitCategory() or SetUnitCandidates() is used, while the unit
// defined by SetDefaultUnit() method is used as the default unit so that
// the user can omit the second parameter.
// SetUnitCategory() defines the category of the units which will be
// accepted.
// The available categories can be found in G4SystemOfUnits.hh in 'global'
// category. Only the units categorized in the given category are accepted
// as the second parameter of the command.
// SetUnitCandidates() defines the candidates of units. Units listed in
// the argument of this method must be separated by space(s). Only the
// units listed in the candidate list are accepted as the second parameter
// of the command.
// SetDefaultUnit() defines the default unit and also defines the category
// of the allowed units. Thus only the units categorized as the given
// default unit will be accepted
void SetUnitCategory(const char* unitCategory);
void SetUnitCandidates(const char* candidateList);
void SetDefaultUnit(const char* defUnit);
// These three methods must be used alternatively.
// The user cannot omit the unit as the second parameter of the command
// if SetUnitCategory() or SetUnitCandidates() is used, while the unit
// defined by SetDefaultUnit() method is used as the default unit so that
// the user can omit the second parameter.
// SetUnitCategory() defines the category of the units which will be
// accepted.
// The available categories can be found in G4SystemOfUnits.hh in 'global'
// category. Only the units categorized in the given category are accepted
// as the second parameter of the command.
// SetUnitCandidates() defines the candidates of units. Units listed in
// the argument of this method must be separated by space(s). Only the
// units listed in the candidate list are accepted as the second parameter
// of the command.
// SetDefaultUnit() defines the default unit and also defines the category
// of the allowed units. Thus only the units categorized as the given
// default unit will be accepted
// Convert string which represents a double value and a unit to
// double. Value is converted to the Geant4 internal unit
static G4double GetNewDoubleValue(const char* paramString);
// Convert string which represents a double value and a unit to
// double. Value is NOT converted to the Geant4 internal unit
// but just as the given string
static G4double GetNewDoubleRawValue(const char* paramString);
// Convert the unit string to the value of the unit. "paramString"
// must contain a double value AND a unit string
static G4double GetNewUnitValue(const char* paramString);
};
#endif
+17 -19
View File
@@ -41,29 +41,27 @@
class G4UIcmdWithALongInt : public G4UIcommand
{
public:
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWithALongInt(const char* commandPath, G4UImessenger* messenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
static G4long GetNewLongIntValue(const char* paramString);
// Convert string to long int
void SetParameterName(const char* theName, G4bool omittable,
G4bool currentAsDefault = false);
// Set the parameter name. The name is used by the range checking.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply an integer value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by
// the next SetDefaultValue() method is used
// Set the parameter name. The name is used by the range checking.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply an integer value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by
// the next SetDefaultValue() method is used
void SetParameterName(const char* theName, G4bool omittable, G4bool currentAsDefault = false);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
void SetDefaultValue(G4long defVal);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
// Convert string to long int
static G4long GetNewLongIntValue(const char* paramString);
};
#endif
+15 -17
View File
@@ -42,29 +42,27 @@
class G4UIcmdWithAString : public G4UIcommand
{
public:
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWithAString(const char* theCommandPath, G4UImessenger* theMessenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
void SetParameterName(const char* theName, G4bool omittable,
G4bool currentAsDefault = false);
// If "omittable" is set to true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply the parameter string.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by the
// next SetDefaultValue() method is used
// If "omittable" is set to true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply the parameter string.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by the
// next SetDefaultValue() method is used
void SetParameterName(const char* theName, G4bool omittable, G4bool currentAsDefault = false);
// Defines the candidates of the parameter string. Candidates listed in
// the argument must be separated by space(s)
void SetCandidates(const char* candidateList);
// Defines the candidates of the parameter string. Candidates listed in
// the argument must be separated by space(s)
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
void SetDefaultValue(const char* defVal);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
};
#endif
@@ -41,29 +41,27 @@
class G4UIcmdWithAnInteger : public G4UIcommand
{
public:
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWithAnInteger(const char* commandPath, G4UImessenger* messenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
static G4int GetNewIntValue(const char* paramString);
// Convert string which represents an integer to an integer
void SetParameterName(const char* theName, G4bool omittable,
G4bool currentAsDefault = false);
// Set the parameter name. The name is used by the range checking.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply an integer value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by
// the next SetDefaultValue() method is used
// Set the parameter name. The name is used by the range checking.
// If "omittable" is set as true, the user of this command can omit
// the value when the command is applied. If "omittable" is false,
// the user must supply an integer value.
// "currentAsDefault" flag is valid only if "omittable" is true. If this
// flag is true, the current value is used as the default value when the
// user omits the parameter. If this flag is false, the value given by
// the next SetDefaultValue() method is used
void SetParameterName(const char* theName, G4bool omittable, G4bool currentAsDefault = false);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
void SetDefaultValue(G4int defVal);
// Set the default value of the parameter. This default value is used
// when the user of this command omits the parameter value, and
// "omittable" is true and "currentAsDefault" is false
// Convert string which represents an integer to an integer
static G4int GetNewIntValue(const char* paramString);
};
#endif
@@ -41,11 +41,9 @@
class G4UIcmdWithoutParameter : public G4UIcommand
{
public:
G4UIcmdWithoutParameter(const char* theCommandPath,
G4UImessenger* theMessenger);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given
G4UIcmdWithoutParameter(const char* theCommandPath, G4UImessenger* theMessenger);
};
#endif
+77 -99
View File
@@ -38,30 +38,28 @@
#ifndef G4UIcommand_hh
#define G4UIcommand_hh 1
#include <vector>
#include "G4UIparameter.hh"
#include "globals.hh"
#include "G4ApplicationState.hh"
#include "G4UItokenNum.hh"
#include "G4ThreeVector.hh"
#include "G4UIparameter.hh"
#include "G4UItokenNum.hh"
#include "globals.hh"
#include <vector>
class G4UImessenger;
class G4UIcommand
{
public:
// Dummy default constructor
G4UIcommand() = default;
// Dummy default constructor
G4UIcommand(const char* theCommandPath, G4UImessenger* theMessenger,
G4bool tBB = true);
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given.
// If tBB is set to false, this command won't be sent to worker threads.
// This tBB parameter could be changed with SetToBeBroadcasted() method
// except for G4UIdirectory
// Constructor. The command string with full path directory
// and the pointer to the messenger must be given.
// If tBB is set to false, this command won't be sent to worker threads.
// This tBB parameter could be changed with SetToBeBroadcasted() method
// except for G4UIdirectory
G4UIcommand(const char* theCommandPath, G4UImessenger* theMessenger, G4bool tBB = true);
virtual ~G4UIcommand();
@@ -72,35 +70,36 @@ class G4UIcommand
G4String GetCurrentValue();
// These methods define the states where the command is available.
// Once one of these commands is invoked, the command application will
// be denied when Geant4 is NOT in the assigned states
void AvailableForStates(G4ApplicationState s1);
void AvailableForStates(G4ApplicationState s1, G4ApplicationState s2);
void AvailableForStates(G4ApplicationState s1, G4ApplicationState s2,
G4ApplicationState s3);
void AvailableForStates(G4ApplicationState s1, G4ApplicationState s2,
G4ApplicationState s3, G4ApplicationState s4);
void AvailableForStates(G4ApplicationState s1, G4ApplicationState s2,
G4ApplicationState s3, G4ApplicationState s4,
G4ApplicationState s5);
// These methods define the states where the command is available.
// Once one of these commands is invoked, the command application will
// be denied when Geant4 is NOT in the assigned states
void AvailableForStates(G4ApplicationState s1, G4ApplicationState s2, G4ApplicationState s3);
void AvailableForStates(G4ApplicationState s1, G4ApplicationState s2, G4ApplicationState s3,
G4ApplicationState s4);
void AvailableForStates(G4ApplicationState s1, G4ApplicationState s2, G4ApplicationState s3,
G4ApplicationState s4, G4ApplicationState s5);
G4bool IsAvailable();
virtual void List();
// 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(G4bool boolVal);
static G4String ConvertToString(G4int intValue);
static G4String ConvertToString(G4long longValue);
static G4String ConvertToString(G4double doubleValue);
static G4String ConvertToString(G4double doubleValue, const char* unitName);
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 G4String ConvertToString(const G4ThreeVector& vec, const char* unitName);
// Static methods for conversion from a string to a value of the returning
// type. These methods are to be used directly by SetNewValues() methods
// of concrete messengers, or GetNewXXXValue() of classes derived from
// this G4UIcommand class
static G4bool ConvertToBool(const char* st);
static G4int ConvertToInt(const char* st);
static G4long ConvertToLongInt(const char* st);
@@ -108,72 +107,55 @@ class G4UIcommand
static G4double ConvertToDimensionedDouble(const char* st);
static G4ThreeVector ConvertTo3Vector(const char* st);
static G4ThreeVector ConvertToDimensioned3Vector(const char* st);
// Static methods for conversion from a string to a value of the returning
// type. These methods are to be used directly by SetNewValues() methods
// of concrete messengers, or GetNewXXXValue() of classes derived from
// this G4UIcommand class
// Static methods for unit and its category
static G4double ValueOf(const char* unitName);
static G4String CategoryOf(const char* unitName);
static G4String UnitsList(const char* unitCategory);
// Static methods for unit and its category
inline void SetRange(const char* rs) { rangeString = rs; }
// Defines the range the command parameter(s) can take.
// The variable name(s) appear in the range expression must be the same
// as the name(s) of the parameter(s).
// All the C++ syntax of relational operators are allowed for the
// range expression
// Defines the range the command parameter(s) can take.
// The variable name(s) appear in the range expression must be the same
// as the name(s) of the parameter(s).
// All the C++ syntax of relational operators are allowed for the
// range expression
inline void SetRange(const char* rs) { rangeExpression = rs; }
inline const G4String& GetRange() const { return rangeString; }
inline std::size_t GetGuidanceEntries() const
{
return commandGuidance.size();
}
inline const G4String& GetGuidanceLine(G4int i) const
{
return commandGuidance[i];
}
inline const G4String& GetRange() const { return rangeExpression; }
inline std::size_t GetGuidanceEntries() const { return commandGuidance.size(); }
inline const G4String& GetGuidanceLine(G4int i) const { return commandGuidance[i]; }
inline const G4String& GetCommandPath() const { return commandPath; }
inline const G4String& GetCommandName() const { return commandName; }
inline std::size_t GetParameterEntries() const { return parameter.size(); }
inline G4UIparameter* GetParameter(G4int i) const { return parameter[i]; }
inline std::vector<G4ApplicationState>* GetStateList()
{
return &availabelStateList;
}
inline std::vector<G4ApplicationState>* GetStateList() { return &availabelStateList; }
inline G4UImessenger* GetMessenger() const { return messenger; }
// Defines a parameter. This method is used by the derived command
// classes but the user can directly use this command when defining
// a command, without using the derived class. For this case, the order
// of the parameters is the order of invoking this method
inline void SetParameter(G4UIparameter* const newParameter)
// Defines a parameter. This method is used by the derived command
// classes but the user can directly use this command when defining
// a command, without using the derived class. For this case, the order
// of the parameters is the order of invoking this method
{
parameter.push_back(newParameter);
newVal.resize(parameter.size());
}
inline void SetGuidance(const char* aGuidance)
// Adds a guidance line. Unlimited times of invokation of this method is
// allowed. The given lines of guidance will appear for the help.
// The first line of the guidance will be used as the title of the
// command, i.e. one line list of the commands
{
commandGuidance.emplace_back(aGuidance);
}
// Adds a guidance line. Unlimited times of invokation of this method is
// allowed. The given lines of guidance will appear for the help.
// The first line of the guidance will be used as the title of the
// command, i.e. one line list of the commands
inline void SetGuidance(const char* aGuidance) { commandGuidance.emplace_back(aGuidance); }
inline const G4String GetTitle() const
{
return (commandGuidance.empty()) ? G4String("...Title not available...")
: commandGuidance[0];
return (commandGuidance.empty()) ? G4String("...Title not available...") : commandGuidance[0];
}
inline void SetToBeBroadcasted(G4bool val) { toBeBroadcasted = val; }
inline G4bool ToBeBroadcasted() const { return toBeBroadcasted; }
inline void SetToBeFlushed(G4bool val) { toBeFlushed = val; }
inline G4bool ToBeFlushed() const { return toBeFlushed; }
inline void SetWorkerThreadOnly(G4bool val = true) { workerThreadOnly=val; }
inline void SetWorkerThreadOnly(G4bool val = true) { workerThreadOnly = val; }
inline G4bool IsWorkerThreadOnly() const { return workerThreadOnly; }
inline void CommandFailed(G4int errCode, G4ExceptionDescription& ed)
@@ -187,7 +169,7 @@ class G4UIcommand
failureDescription = ed.str();
}
inline G4int IfCommandFailed() { return commandFailureCode; }
inline const G4String& GetFailureDescription() {return failureDescription;}
inline const G4String& GetFailureDescription() { return failureDescription; }
inline void ResetFailure()
{
commandFailureCode = 0;
@@ -195,23 +177,29 @@ class G4UIcommand
}
public:
enum CommandType
{ BaseClassCmd, WithoutParameterCmd,
WithABoolCmd, WithAnIntegerCmd, WithALongIntCmd,
WithADoubleCmd, WithADoubleAndUnitCmd, With3VectorCmd, With3VectorAndUnitCmd,
WithAStringCmd, CmdDirectory = -1 };
inline CommandType GetCommandType() const
{ return commandType; }
enum CommandType
{
BaseClassCmd,
WithoutParameterCmd,
WithABoolCmd,
WithAnIntegerCmd,
WithALongIntCmd,
WithADoubleCmd,
WithADoubleAndUnitCmd,
With3VectorCmd,
With3VectorAndUnitCmd,
WithAStringCmd,
CmdDirectory = -1
};
inline CommandType GetCommandType() const { return commandType; }
void SetCommandType(CommandType);
inline void SetDefaultSortFlag(G4bool val)
{ ifSort = val; }
inline void SetDefaultSortFlag(G4bool val) { ifSort = val; }
protected:
// --- the following is used by CheckNewValue() --------
using yystype = G4UItokenNum::yystype;
using yystype = G4UItokenNum::yystype;
using tokenNum = G4UItokenNum::tokenNum;
G4int CheckNewValue(const char* newValue);
@@ -226,14 +214,10 @@ class G4UIcommand
G4bool ifSort = false;
private:
void G4UIcommandCommonConstructorCode(const char* theCommandPath);
G4int TypeCheck(const char* t);
G4int RangeCheck(const char* t);
G4int IsInt(const char* str, short maxLength); // used for both int and long int
G4int IsDouble(const char* str);
G4int ExpectExponent(const char* str);
G4bool RangeCheck(const char* t);
// syntax nodes
yystype Expression();
yystype LogicalORExpression();
@@ -246,19 +230,14 @@ class G4UIcommand
yystype PrimaryExpression();
// semantics routines
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(); // returns next token
unsigned IndexOf(const char*); // returns the index of the var name
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(); // read one char from rangeBuf
G4int G4UIpUngetc(G4int c); // put back
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);
//G4String TokenToStr(G4int token);
//void PrintToken(void); // for debug
// Data -----------------------------------------------------------
@@ -267,13 +246,12 @@ class G4UIcommand
G4UImessenger* messenger = nullptr;
G4String commandPath;
G4String commandName;
G4String rangeString;
G4String rangeExpression;
std::vector<G4UIparameter*> parameter;
std::vector<G4String> commandGuidance;
std::vector<G4ApplicationState> availabelStateList;
G4String rangeBuf;
G4int bp = 0; // buffer pointer for rangeBuf
G4int bp = 0; // current index into rangeExpression
tokenNum token = G4UItokenNum::IDENTIFIER;
yystype yylval;
std::vector<yystype> newVal;
@@ -36,13 +36,13 @@
enum G4UIcommandStatus
{
fCommandSucceeded = 0,
fCommandNotFound = 100,
fIllegalApplicationState = 200,
fParameterOutOfRange = 300,
fParameterUnreadable = 400,
fCommandSucceeded = 0,
fCommandNotFound = 100,
fIllegalApplicationState = 200,
fParameterOutOfRange = 300,
fParameterUnreadable = 400,
fParameterOutOfCandidates = 500,
fAliasNotFound = 600
fAliasNotFound = 600
};
#endif
+7 -9
View File
@@ -36,15 +36,14 @@
#ifndef G4UIcommandTree_hh
#define G4UIcommandTree_hh 1
#include <vector>
#include "globals.hh"
#include "G4UIcommand.hh"
#include "globals.hh"
#include <vector>
class G4UIcommandTree
{
public:
G4UIcommandTree() = default;
G4UIcommandTree(const char* thePathName);
@@ -59,9 +58,9 @@ class G4UIcommandTree
G4UIcommandTree* FindCommandTree(const char* commandPath);
G4String GetFirstMatchedString(const G4String&, const G4String&) const;
// Complete most available characters in common into command path in the
// command line given
G4String CompleteCommandPath(const G4String& commandPath);
// Complete most available characters in common into command path in the
// command line given
void List() const;
void ListCurrent() const;
@@ -77,15 +76,14 @@ class G4UIcommandTree
inline G4UIcommand* GetCommand(G4int i) { return command[i - 1]; }
inline const G4String GetTitle() const
{
return (guidance == nullptr) ? G4String("...Title not available...")
: guidance->GetTitle();
return (guidance == nullptr) ? G4String("...Title not available...") : guidance->GetTitle();
}
private:
G4String CreateFileName(const char* pName);
G4String ModStr(const char* strS);
private:
std::vector<G4UIcommand*> command;
std::vector<G4UIcommandTree*> tree;
G4UIcommand* guidance = nullptr;
+7 -10
View File
@@ -41,18 +41,15 @@
class G4UIdirectory : public G4UIcommand
{
public:
// Constructors. The argument is a full path directory which
// starts and ends with "/".
G4UIdirectory(char* theCommandPath, G4bool commandsToBeBroadcasted = true);
G4UIdirectory(const char* theCommandPath,
G4bool commandsToBeBroadcasted = true);
// Constructors. The argument is a full path directory which
// starts and ends with "/".
G4UIdirectory(const char* theCommandPath, G4bool commandsToBeBroadcasted = true);
void Sort(G4bool val = true)
{ ifSort = val; }
G4bool IfSort() const
{ return ifSort; }
// N.B. ifSort is defined in the base class G4UIcommand
void Sort(G4bool val = true) { ifSort = val; }
// N.B. ifSort is defined in the base class G4UIcommand
G4bool IfSort() const { return ifSort; }
};
#endif
+83 -99
View File
@@ -35,13 +35,14 @@
#ifndef G4UImanager_hh
#define G4UImanager_hh 1
#include <vector>
#include <fstream>
#include "globals.hh"
#include "icomsdefs.hh"
#include "G4VStateDependent.hh"
#include "G4UIcommandStatus.hh"
#include "G4VStateDependent.hh"
#include "globals.hh"
#include "icomsdefs.hh"
#include <fstream>
#include <vector>
class G4UIcommandTree;
class G4UIcommand;
@@ -57,11 +58,10 @@ class G4ProfilerMessenger;
class G4UImanager : public G4VStateDependent
{
public:
// A static method to get the pointer to the only existing object
// of this class
static G4UImanager* GetUIpointer();
static G4UImanager* GetMasterUIpointer();
// A static method to get the pointer to the only existing object
// of this class
~G4UImanager() override;
@@ -70,131 +70,122 @@ class G4UImanager : public G4VStateDependent
G4bool operator==(const G4UImanager&) const = delete;
G4bool operator!=(const G4UImanager&) const = delete;
// This method returns a string which represents the current value(s)
// of the parameter(s) of the specified command. Null string will be
// returned if the given command is not defined or the command does
// not support the GetCurrentValues() method
G4String GetCurrentValues(const char* aCommand);
// This method returns a string which represents the current value(s)
// of the parameter(s) of the specified command. Null string will be
// returned if the given command is not defined or the command does
// not support the GetCurrentValues() method
// This method register a new command
void AddNewCommand(G4UIcommand* newCommand);
// This method register a new command
// This command removes the registered command. After invokation of this
// command, that particular command cannot be applied
void RemoveCommand(G4UIcommand* aCommand);
// This command removes the registered command. After invokation of this
// command, that particular command cannot be applied
// A macro file defined by the argument will be read by G4UIbatch object
void ExecuteMacroFile(const char* fileName);
// A macro file defined by the argument will be read by G4UIbatch object
void Loop(const char* macroFile, const char* variableName,
G4double initialValue, G4double finalValue,
G4double stepSize = 1.0);
// Execute a macro file more than once with a loop counter
// Execute a macro file more than once with a loop counter
void Loop(const char* macroFile, const char* variableName, G4double initialValue,
G4double finalValue, G4double stepSize = 1.0);
void Foreach(const char* macroFile, const char* variableName,
const char* candidates);
// Execute a macro file more than once with an aliased variable which
// takes a value in the candidate list
// Execute a macro file more than once with an aliased variable which
// takes a value in the candidate list
void Foreach(const char* macroFile, const char* variableName, const char* candidates);
// A command (and parameter(s)) given
// by the method's argument will be applied. Zero will be returned in
// case the command is successfully executed. Positive non-zero value
// will be returned if the command cannot be executed. The meaning of
// this non-zero value is the following:
// The returned number : xyy
// x00 : G4CommandStatus.hh enumeration
// yy : the problematic parameter (first found)
G4int ApplyCommand(const char* aCommand);
G4int ApplyCommand(const G4String& aCommand);
// A command (and parameter(s)) given
// by the method's argument will be applied. Zero will be returned in
// case the command is successfully executed. Positive non-zero value
// will be returned if the command cannot be executed. The meaning of
// this non-zero value is the following:
// The returned number : xyy
// x00 : G4CommandStatus.hh enumeration
// yy : the problematic parameter (first found)
// Find the G4UIcommand object. Null pointer is returned if command
// is not found.
// Please note that each thread returns different objects if this
// method is used in multi-threaded mode.
G4UIcommand* FindCommand(const char* aCommand);
G4UIcommand* FindCommand(const G4String& aCommand);
// Find the G4UIcommand object. Null pointer is returned if command
// is not found.
// Please note that each thread returns different objects if this
// method is used in multi-threaded mode.
// The executed commands will be stored in the defined file. If
// "historySwitch" is false, saving will be suspended
void StoreHistory(const char* fileName = "G4history.macro");
void StoreHistory(G4bool historySwitch,
const char* fileName = "G4history.macro");
// The executed commands will be stored in the defined file. If
// "historySwitch" is false, saving will be suspended
void StoreHistory(G4bool historySwitch, const char* fileName = "G4history.macro");
// All commands registered under the given directory will be listed to
// standard output
void ListCommands(const char* direc);
// All commands registered under the given directory will be listed to
// standard output
// Define an alias. The first word of "aliasLine" string is the
// alias name and the remaining word(s) is(are) string value
// to be aliased
void SetAlias(const char* aliasLine);
// Define an alias. The first word of "aliasLine" string is the
// alias name and the remaining word(s) is(are) string value
// to be aliased
// Remove the defined alias
void RemoveAlias(const char* aliasName);
// Remove the defined alias
// Print all aliases
void ListAlias();
// Print all aliases
// Convert a command string which contains alias(es)
G4String SolveAlias(const char* aCmd);
// Convert a command string which contains alias(es)
// Generate HTML files for defined UI commands
void CreateHTML(const char* dir = "/");
// Generate HTML files for defined UI commands
// These methods are used by G4UIcontrolMessenger to use Loop()
// and Foreach() methods
void LoopS(const char* valueList);
void ForeachS(const char* valueList);
// These methods are used by G4UIcontrolMessenger to use Loop()
// and Foreach() methods
G4bool Notify(G4ApplicationState requestedState) override;
// This method is exclusively invoked by G4StateManager
G4bool Notify(G4ApplicationState requestedState) override;
G4String GetCurrentStringValue(const char* aCommand,
G4int parameterNumber = 1,
G4bool reGet = true);
G4int GetCurrentIntValue(const char* aCommand, G4int parameterNumber = 1,
G4bool reGet = true);
G4double GetCurrentDoubleValue(const char* aCommand,
G4int parameterNumber = 1,
G4bool reGet = true);
G4String GetCurrentStringValue(const char* aCommand,
const char* aParameterName,
// These six methods return the current value of a parameter of the
// given command. For the first three methods, the ordering number of
// the parameter (1 is the first parameter) can be given, whereas,
// other three methods can give the parameter name.
// If "reGet" is true, actual request of returning the current value
// will be sent to the corresponding messenger, while, if it is false,
// the value stored in G4Umanager will be used. The later case is valid
// for the sequential invokation for the same command
G4String GetCurrentStringValue(const char* aCommand, G4int parameterNumber = 1,
G4bool reGet = true);
G4int GetCurrentIntValue(const char* aCommand, G4int parameterNumber = 1, G4bool reGet = true);
G4double GetCurrentDoubleValue(const char* aCommand, G4int parameterNumber = 1,
G4bool reGet = true);
G4String GetCurrentStringValue(const char* aCommand, const char* aParameterName,
G4bool reGet = true);
G4int GetCurrentIntValue(const char* aCommand, const char* aParameterName, G4bool reGet = true);
G4double GetCurrentDoubleValue(const char* aCommand, const char* aParameterName,
G4bool reGet = true);
G4int GetCurrentIntValue(const char* aCommand, const char* aParameterName,
G4bool reGet = true);
G4double GetCurrentDoubleValue(const char* aCommand,
const char* aParameterName,
G4bool reGet = true);
// These six methods return the current value of a parameter of the
// given command. For the first three methods, the ordering number of
// the parameter (1 is the first parameter) can be given, whereas,
// other three methods can give the parameter name.
// If "reGet" is true, actual request of returning the current value
// will be sent to the corresponding messenger, while, if it is false,
// the value stored in G4Umanager will be used. The later case is valid
// for the sequential invokation for the same command
// If the Boolean flags are true, Pause() method of G4StateManager is
// invoked at the very beginning (before generating a G4Event object)
// or at the end of each event. So that, in case a (G)UI session is
// defined, the user can interact
inline void SetPauseAtBeginOfEvent(G4bool vl) { pauseAtBeginOfEvent = vl; }
inline G4bool GetPauseAtBeginOfEvent() const { return pauseAtBeginOfEvent; }
inline void SetPauseAtEndOfEvent(G4bool vl) { pauseAtEndOfEvent = vl; }
inline G4bool GetPauseAtEndOfEvent() const { return pauseAtEndOfEvent; }
// If the Boolean flags are true, Pause() method of G4StateManager is
// invoked at the very beginning (before generating a G4Event object)
// or at the end of each event. So that, in case a (G)UI session is
// defined, the user can interact
inline G4UIcommandTree* GetTree() const { return treeTop; }
inline G4UIsession* GetSession() const { return session; }
inline G4UIsession* GetG4UIWindow() const { return g4UIWindow; }
// These methods define the active (G)UI session
inline void SetSession(G4UIsession* const value) { session = value; }
inline void SetG4UIWindow(G4UIsession* const value) { g4UIWindow = value; }
// These methods define the active (G)UI session
// This method defines the destination of G4cout/G4cerr stream.
// For usual cases, this method will be invoked by a concrete
// (G)UI session class object and thus the user needs not to invoke this
void SetCoutDestination(G4UIsession* const value);
// This method defines the destination of G4cout/G4cerr stream.
// For usual cases, this method will be invoked by a concrete
// (G)UI session class object and thus the user needs not to invoke this
inline void SetVerboseLevel(G4int val) { verboseLevel = val; }
inline G4int GetVerboseLevel() const { return verboseLevel; }
@@ -202,8 +193,7 @@ class G4UImanager : public G4VStateDependent
inline G4String GetPreviousCommand(G4int i) const
{
G4String st;
if(i >= 0 && i < G4int(histVec.size()))
{
if (i >= 0 && i < G4int(histVec.size())) {
st = histVec[i];
}
return st;
@@ -220,9 +210,8 @@ class G4UImanager : public G4VStateDependent
{
isMaster = val;
stackCommandsForBroadcast = val;
if(val && (bridges == nullptr))
{
bridges = new std::vector<G4UIbridge*>;
if (val && (bridges == nullptr)) {
bridges = new std::vector<G4UIbridge*>;
fMasterUImanager() = this;
}
}
@@ -231,17 +220,15 @@ class G4UImanager : public G4VStateDependent
std::vector<G4String>* GetCommandStack();
void RegisterBridge(G4UIbridge* brg);
// Setups as above but for a non-worker thread (e.g. vis)
void SetUpForAThread(G4int tId);
// Setups as above but for a non-worker thread (e.g. vis)
void SetUpForSpecialThread(const G4String& aPrefix);
inline G4int GetThreadID() const { return threadID; }
void SetCoutFileName(const G4String& fileN = "G4cout.txt",
G4bool ifAppend = true);
void SetCerrFileName(const G4String& fileN = "G4cerr.txt",
G4bool ifAppend = true);
void SetCoutFileName(const G4String& fileN = "G4cout.txt", G4bool ifAppend = true);
void SetCerrFileName(const G4String& fileN = "G4cerr.txt", G4bool ifAppend = true);
void SetThreadPrefixString(const G4String& prefix = "W");
void SetThreadUseBuffer(G4bool flg = true);
void SetThreadIgnore(G4int tid = 0);
@@ -257,11 +244,9 @@ class G4UImanager : public G4VStateDependent
inline void SetLastCommandOutputTreated() { fLastCommandOutputTreated = true; }
protected:
G4UImanager();
private:
void AddWorkerCommand(G4UIcommand* newCommand);
void RemoveWorkerCommand(G4UIcommand* aCommand);
@@ -270,8 +255,7 @@ class G4UImanager : public G4VStateDependent
G4UIcommandTree* FindDirectory(const char* dirName);
private:
G4ICOMS_DLL static G4UImanager*& fUImanager(); // thread-local
G4ICOMS_DLL static G4UImanager*& fUImanager(); // thread-local
G4ICOMS_DLL static G4bool& fUImanagerHasBeenKilled(); // thread-local
G4ICOMS_DLL static G4UImanager*& fMasterUImanager();
G4UIcommandTree* treeTop = nullptr;
@@ -280,7 +264,7 @@ class G4UImanager : public G4VStateDependent
G4UIcontrolMessenger* UImessenger = nullptr;
G4UnitsMessenger* UnitsMessenger = nullptr;
G4LocalThreadCoutMessenger* CoutMessenger = nullptr;
G4ProfilerMessenger* ProfileMessenger = nullptr;
G4ProfilerMessenger* ProfileMessenger = nullptr;
G4String savedParameters;
G4UIcommand* savedCommand = nullptr;
G4int verboseLevel = 0;
+24 -36
View File
@@ -39,48 +39,39 @@
#ifndef G4UImessenger_hh
#define G4UImessenger_hh 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4UIdirectory.hh"
#include "G4ios.hh"
#include "globals.hh"
class G4UImessenger
{
public:
// Constructor. In the implementation of the concrete messenger,
// all commands related to the messenger must be constructed
G4UImessenger() = default;
G4UImessenger(const G4String& path, const G4String& dsc,
G4bool commandsToBeBroadcasted = true);
// Constructor. In the implementation of the concrete messenger,
// all commands related to the messenger must be constructed
G4UImessenger(const G4String& path, const G4String& dsc, G4bool commandsToBeBroadcasted = true);
// Destructor. In the implementation of the concrete messenger,
// all commands defined in the constructor must be deleted
virtual ~G4UImessenger();
// Destructor. In the implementation of the concrete messenger,
// all commands defined in the constructor must be deleted
// The concrete implementation of this method gets the current value(s)
// of the parameter(s) of the given command from the destination class,
// converts the value(s) to a string, and returns the string.
// Conversion could be done by the ConvertToString() method of
// corresponding G4UIcmdXXX classes if the command is an object of
// these G4UIcmdXXX classes
virtual G4String GetCurrentValue(G4UIcommand* command);
// The concrete implementation of this method gets the current value(s)
// of the parameter(s) of the given command from the destination class,
// converts the value(s) to a string, and returns the string.
// Conversion could be done by the ConvertToString() method of
// corresponding G4UIcmdXXX classes if the command is an object of
// these G4UIcmdXXX classes
// The concrete implementation of this method converts the string
// "newValue" to value(s) of type(s) of the parameter(s).
// Converted methods corresponding to the type of the command can be
// used if the command is an object of G4UIcmdXXX classes
virtual void SetNewValue(G4UIcommand* command, G4String newValue);
// The concrete implementation of this method converts the string
// "newValue" to value(s) of type(s) of the parameter(s).
// Converted methods corresponding to the type of the command can be
// used if the command is an object of G4UIcmdXXX classes
G4bool operator==(const G4UImessenger& messenger) const;
G4bool operator!=(const G4UImessenger& messenger) const;
inline G4bool CommandsShouldBeInMaster() const
{
return commandsShouldBeInMaster;
}
inline G4bool CommandsShouldBeInMaster() const { return commandsShouldBeInMaster; }
protected:
G4String ItoS(G4int i);
G4String DtoS(G4double a);
G4String BtoS(G4bool b);
@@ -91,30 +82,27 @@ class G4UImessenger
void AddUIcommand(G4UIcommand* newCommand);
// Shortcut way for creating directory and commands
void CreateDirectory(const G4String& path, const G4String& dsc,
G4bool commandsToBeBroadcasted = true);
template <typename T>
template<typename T>
T* CreateCommand(const G4String& cname, const G4String& dsc);
// Shortcut way for creating directory and commands
protected:
G4UIdirectory* baseDir = nullptr; // used if new object is created
G4String baseDirName = ""; // used if dir already exists
G4String baseDirName = ""; // used if dir already exists
G4bool commandsShouldBeInMaster = false;
};
// Inline template implementations
template <typename T>
template<typename T>
T* G4UImessenger::CreateCommand(const G4String& cname, const G4String& dsc)
{
G4String path;
if(cname[0] != '/')
{
if (cname[0] != '/') {
path = baseDirName + cname;
if(path[0] != '/')
{
if (path[0] != '/') {
path = "/" + path;
}
}
+38 -70
View File
@@ -39,77 +39,63 @@
#ifndef G4UIparameter_hh
#define G4UIparameter_hh 1
#include "globals.hh"
#include "G4UItokenNum.hh"
#include "globals.hh"
class G4UIparameter
{
public:
// Default constructor
G4UIparameter() = default;
// Constructors, where "theName" is the name of the parameter which will
// be used by the range checking, "theType" is the type of the parameter
// (currently "b" (Boolean), "i" (integer), "l" (long int), "d" (double)
// and "s" (string) are supported).
// "theOmittable" is a Boolean flag to set whether
// the user of the command can omit the parameter or not.
// If "theOmittable" is true, the default value must be given
G4UIparameter(char theType);
G4UIparameter(const char* theName, char theType, G4bool theOmittable);
// Constructors, where "theName" is the name of the parameter which will
// be used by the range checking, "theType" is the type of the parameter
// (currently "b" (Boolean), "i" (integer), "l" (long int), "d" (double)
// and "s" (string) are supported).
// "theOmittable" is a Boolean flag to set whether
// the user of the command can omit the parameter or not.
// If "theOmittable" is true, the default value must be given
// Destructor. When a command is destructed, the delete operator(s) of the
// associated parameter(s) are AUTOMATICALLY invoked
~G4UIparameter();
// Destructor. When a command is destructed, the delete operator(s) of the
// associated parameter(s) are AUTOMATICALLY invoked
G4bool operator==(const G4UIparameter& right) const;
G4bool operator!=(const G4UIparameter& right) const;
G4int CheckNewValue(const char* newValue);
void List();
inline void SetDefaultValue(const char* theDefaultValue)
{
defaultValue = theDefaultValue;
}
// These methods set the default value of the parameter
inline void SetDefaultValue(const char* theDefaultValue) { defaultValue = theDefaultValue; }
void SetDefaultValue(G4int theDefaultValue);
void SetDefaultValue(G4long theDefaultValue);
void SetDefaultValue(G4double theDefaultValue);
// These methods set the default value of the parameter
// This method can be used for a string-type parameter that is
// used to specify a unit. This method is valid only for a
// string-type parameter
void SetDefaultUnit(const char* theDefaultUnit);
// This method can be used for a string-type parameter that is
// used to specify a unit. This method is valid only for a
// string-type parameter
inline const G4String& GetDefaultValue() const { return defaultValue; }
inline char GetParameterType() const { return parameterType; }
inline void SetParameterRange(const char* theRange)
// Defines the range the parameter can take.
// The variable name appearing in the range expression must be the
// same as the name of the parameter.
// All the C++ syntax of relational operators are allowed for the
// range expression
{
parameterRange = theRange;
}
// Defines the range the parameter can take.
// The variable name appearing in the range expression must be the
// same as the name of the parameter.
// All the C++ syntax of relational operators are allowed for the
// range expression
inline void SetParameterRange(const char* theRange) { rangeExpression = theRange; }
inline const G4String& GetParameterRange() const { return parameterRange; }
inline const G4String& GetParameterRange() const { return rangeExpression; }
inline void SetParameterName(const char* pName) { parameterName = pName; }
inline const G4String& GetParameterName() const { return parameterName; }
inline void SetParameterCandidates(const char* theString)
// This method is meaningful if the type of the parameter is string.
// The candidates listed in the argument must be separated by space(s)
{
parameterCandidate = theString;
}
// This method is meaningful if the type of the parameter is string.
// The candidates listed in the argument must be separated by space(s)
inline void SetParameterCandidates(const char* theString) { parameterCandidate = theString; }
inline const G4String& GetParameterCandidates() const
{
return parameterCandidate;
}
inline const G4String& GetParameterCandidates() const { return parameterCandidate; }
inline void SetOmittable(G4bool om) { omittable = om; }
inline G4bool IsOmittable() const { return omittable; }
@@ -119,30 +105,18 @@ class G4UIparameter
// Obsolete methods
//
inline void SetWidget(G4int theWidget) { widget = theWidget; }
inline const G4String& GetParameterGuidance() const
{
return parameterGuidance;
}
inline void SetGuidance(const char* theGuidance)
{
parameterGuidance = theGuidance;
}
inline const G4String& GetParameterGuidance() const { return parameterGuidance; }
inline void SetGuidance(const char* theGuidance) { parameterGuidance = theGuidance; }
protected:
using yystype = G4UItokenNum::yystype;
using yystype = G4UItokenNum::yystype;
using tokenNum = G4UItokenNum::tokenNum;
private:
// --- the following is used by CheckNewValue() -------
G4int TypeCheck(const char* newValue);
G4int RangeCheck(const char* newValue);
G4int CandidateCheck(const char* newValue);
G4int IsInt(const char* str, short maxDigit); // used for both int and long int
G4int IsDouble(const char* str);
G4int ExpectExponent(const char* str);
G4bool TypeCheck(const char* newValue);
G4bool RangeCheck(const char* newValue);
G4bool CandidateCheck(const char* newValue);
// syntax nodes
yystype Expression();
yystype LogicalORExpression();
@@ -155,32 +129,26 @@ class G4UIparameter
yystype PrimaryExpression();
// semantics routines
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(); // returns next token
G4int G4UIpGetc(); // 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);
//G4String TokenToStr(G4int token);
// data -----------------------------------------------------------
G4String parameterName;
G4String parameterGuidance;
G4String defaultValue;
G4String parameterRange;
G4String rangeExpression;
G4String parameterCandidate;
char parameterType = '\0';
G4bool omittable = false;
G4bool currentAsDefaultFlag = false;
G4int widget = 0;
//------------ CheckNewValue() related data members ---------------
G4String rangeBuf;
G4int bp = 0; // buffer pointer for rangeBuf
G4int bp = 0; // current index in rangeExpression
tokenNum token = G4UItokenNum::NONE;
yystype yylval;
yystype newVal;
+7 -7
View File
@@ -37,33 +37,33 @@
#include "G4coutDestination.hh"
#include "globals.hh"
#include "icomsdefs.hh"
class G4UIsession : public G4coutDestination
{
public:
G4UIsession();
G4UIsession(G4int iBatch);
~G4UIsession() override;
// This method will be invoked by main().
// Optionally, it can be invoked by another session
virtual G4UIsession* SessionStart();
// This method will be invoked by main().
// Optionally, it can be invoked by another session
// This method will be invoked by G4UImanager
// when the kernel comes to Pause state
virtual void PauseSessionStart(const G4String& Prompt);
// This method will be invoked by G4UImanager
// when the kernel comes to Pause state
// These methods will be invoked by G4strstreambuf
G4int ReceiveG4debug(const G4String& debugString) override;
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; }
protected:
G4ICOMS_DLL static G4int inSession;
G4int ifBatch = 0;
G4int lastRC = 0;
+31 -51
View File
@@ -38,59 +38,39 @@
namespace G4UItokenNum
{
enum tokenNum
{
NONE = 0,
IDENTIFIER = 257,
CONSTINT = 258,
CONSTDOUBLE = 259,
CONSTCHAR = 260,
CONSTSTRING = 261,
GT = 262,
GE = 263,
LT = 264,
LE = 265,
EQ = 266,
NE = 267,
// LOGICALNOT = 268,
CONSTLONG = 268,
LOGICALOR = 269,
LOGICALAND = 270,
SCAREAMER = 33,
LPAREN = 40,
PLUS = 43,
MINUS = 45
};
enum tokenNum
{
NONE = 0,
IDENTIFIER = 257,
CONSTINT = 258,
CONSTDOUBLE = 259,
CONSTCHAR = 260,
CONSTSTRING = 261,
GT = 262,
GE = 263,
LT = 264,
LE = 265,
EQ = 266,
NE = 267,
// LOGICALNOT = 268,
CONSTLONG = 268,
LOGICALOR = 269,
LOGICALAND = 270,
SCAREAMER = 33,
LPAREN = 40,
PLUS = 43,
MINUS = 45
};
using yystype = struct yystype
{
tokenNum type{ tokenNum::NONE };
G4double D{ 0.0 };
G4int I{ 0 };
G4long L{ 0 };
char C{ ' ' };
struct yystype
{
tokenNum type{tokenNum::NONE};
G4double D{0.0};
G4int I{0};
G4long L{0};
char C{' '};
G4String S;
yystype()
: S("")
{}
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;
L = right.L;
C = right.C;
S = right.S;
return *this;
}
yystype(const yystype& right) { *this = right; }
};
};
} // namespace G4UItokenNum
#endif
@@ -39,11 +39,10 @@ class G4VPhysicalVolume;
class G4VFlavoredParallelWorld
{
public:
virtual ~G4VFlavoredParallelWorld() = default;
virtual ~G4VFlavoredParallelWorld() {}
// Interface for visualisation
virtual G4VPhysicalVolume* GetThePhysicalVolumeWorld() const = 0;
// Interface for visualisation
};
#endif
@@ -50,6 +50,7 @@
#define G4VGLOBALFASTSIMULATIONMANAGER_HH 1
#include "G4Types.hh"
#include "icomsdefs.hh"
class G4VFlavoredParallelWorld;
@@ -58,25 +59,22 @@ class G4ParticleDefinition;
class G4VGlobalFastSimulationManager
{
public:
// Returns pointer to the actual Global Fast Simulation manager if
// at least a parameterisation envelope exists
static G4VGlobalFastSimulationManager* GetConcreteInstance();
// Returns pointer to the actual Global Fast Simulation manager if
// at least a parameterisation envelope exists
virtual ~G4VGlobalFastSimulationManager() = default;
virtual G4VFlavoredParallelWorld* GetFlavoredWorldForThis(
G4ParticleDefinition*) = 0;
// VGlobalFastSimulationManager interface for visualisation
// VGlobalFastSimulationManager interface for visualisation
virtual G4VFlavoredParallelWorld* GetFlavoredWorldForThis(G4ParticleDefinition*) = 0;
protected:
// Sets the pointer to the actual Global Fast Simulation manager
static void SetConcreteInstance(G4VGlobalFastSimulationManager*);
// Sets the pointer to the actual Global Fast Simulation manager
// Pointer to real G4GlobalFastSimulationManager
G4ICOMS_DLL
static G4ThreadLocal G4VGlobalFastSimulationManager* fpConcreteInstance;
// Pointer to real G4GlobalFastSimulationManager
};
#endif
@@ -34,8 +34,8 @@
#ifndef G4LocalThreadCoutMessenger_hh
#define G4LocalThreadCoutMessenger_hh 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class G4UIdirectory;
class G4UIcommand;
@@ -46,14 +46,12 @@ class G4UIcmdWithAnInteger;
class G4LocalThreadCoutMessenger : public G4UImessenger
{
public:
G4LocalThreadCoutMessenger();
~G4LocalThreadCoutMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
private:
G4UIdirectory* coutDir = nullptr;
G4UIcommand* coutFileNameCmd = nullptr;
G4UIcommand* cerrFileNameCmd = nullptr;
@@ -36,48 +36,41 @@
#ifndef G4ProfilerMessenger_hh
#define G4ProfilerMessenger_hh 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "G4Profiler.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
// --------------------------------------------------------------------
class G4ProfilerMessenger : public G4UImessenger
{
public:
G4ProfilerMessenger();
~G4ProfilerMessenger() override;
public:
G4ProfilerMessenger();
~G4ProfilerMessenger() override;
G4ProfilerMessenger(const G4ProfilerMessenger&) = delete;
G4ProfilerMessenger& operator=(const G4ProfilerMessenger&) = delete;
G4ProfilerMessenger(G4ProfilerMessenger&&) = default;
G4ProfilerMessenger& operator=(G4ProfilerMessenger&&) = default;
// no copy but move is fine
G4ProfilerMessenger(const G4ProfilerMessenger&) = delete;
G4ProfilerMessenger(G4ProfilerMessenger&&) = default;
void SetNewValue(G4UIcommand*, G4String) override;
// no copy but move is fine
G4ProfilerMessenger& operator=(const G4ProfilerMessenger&) = delete;
G4ProfilerMessenger& operator=(G4ProfilerMessenger&&) = default;
private:
using stringcmd_pair = std::pair<G4UIcmdWithAString*, std::string>;
using boolcmd_pair = std::pair<G4UIcmdWithABool*, std::string>;
using directory_array = std::array<G4UIdirectory*, G4ProfileType::TypeEnd>;
using stringcmd_array = std::array<stringcmd_pair, G4ProfileType::TypeEnd>;
using boolcmd_array = std::array<boolcmd_pair, G4ProfileType::TypeEnd>;
using boolcmd_vector = std::vector<boolcmd_pair>;
void SetNewValue(G4UIcommand*, G4String) override;
// G4String GetCurrentValue(G4UIcommand* command);
G4UIdirectory* profileDirectory;
G4UIdirectory* profileOutputDirectory;
directory_array profileTypeDirs;
private:
using stringcmd_pair = std::pair<G4UIcmdWithAString*, std::string>;
using boolcmd_pair = std::pair<G4UIcmdWithABool*, std::string>;
using directory_array = std::array<G4UIdirectory*, G4ProfileType::TypeEnd>;
using stringcmd_array = std::array<stringcmd_pair, G4ProfileType::TypeEnd>;
using boolcmd_array = std::array<boolcmd_pair, G4ProfileType::TypeEnd>;
using boolcmd_vector = std::vector<boolcmd_pair>;
G4UIdirectory* profileDirectory;
G4UIdirectory* profileOutputDirectory;
directory_array profileTypeDirs;
boolcmd_array profileEnableCmds;
boolcmd_vector profileGeneralCmds;
stringcmd_array profileCompCmds;
boolcmd_array profileEnableCmds;
boolcmd_vector profileGeneralCmds;
stringcmd_array profileCompCmds;
};
#endif
@@ -35,32 +35,31 @@
#ifndef G4UIaliasList_hh
#define G4UIaliasList_hh 1
#include <vector>
#include "globals.hh"
#include <map>
class G4UIaliasList
{
public:
G4UIaliasList() = default;
~G4UIaliasList();
void RemoveAlias(const char* aliasName);
// Add or update alias from aliasName to command path aliasValue
void ChangeAlias(const char* aliasName, const char* aliasValue);
G4String* FindAlias(const char* aliasName);
void List();
// Remove aliasName from list of aliases.
void RemoveAlias(const char* aliasName);
// Return command corresponding to alias, or nullptr if alias does not exist.
// Ownership of the pointer is retained by G4UIaliasList.
const G4String* FindAlias(const char* aliasName) const;
// Print alias : command pairs to G4cout
void List() const;
private:
G4bool operator==(const G4UIaliasList& right) const;
G4bool operator!=(const G4UIaliasList& right) const;
// Adds a new alias/value pair to the map
void AddNewAlias(const char* aliasName, const char* aliasValue);
G4int FindAliasID(const char* aliasName);
std::vector<G4String*> alias;
std::vector<G4String*> value;
std::map<G4String, G4String> aliases;
};
#endif
@@ -80,14 +80,12 @@ class G4UIcommand;
class G4UIcontrolMessenger : public G4UImessenger
{
public:
G4UIcontrolMessenger();
~G4UIcontrolMessenger() override;
void SetNewValue(G4UIcommand* command, G4String newValue) override;
G4String GetCurrentValue(G4UIcommand* command) override;
private:
private:
G4UIdirectory* controlDirectory = nullptr;
G4UIcmdWithAString* macroPathCommand = nullptr;
G4UIcmdWithAString* ExecuteCommand = nullptr;
@@ -0,0 +1,292 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4UIparsing
//
// Utilities for parsing/checking inputs in G4UIparameter/G4UIcommand
#ifndef G4UIparsing_hh
#define G4UIparsing_hh 1
#include "G4UItokenNum.hh"
#include "globals.hh"
#include <cctype>
namespace G4UIparsing
{
// Convert G4String to value of type T
template<typename T>
inline T StoT(const G4String& s)
{
T vl;
std::istringstream is(s);
is >> vl;
return vl;
}
// Convert value of type T to G4String
template<typename T>
inline G4String TtoS(T value)
{
std::ostringstream os;
os << value;
return os.str();
}
// Return true if `str` parses to an integral number no more than `maxDigit` digits
inline G4bool IsInt(const char* str, short maxDigits)
{
const char* p = str;
G4int length = 0;
if (*p == '+' || *p == '-') {
++p;
}
if (isdigit((G4int)(*p)) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
++length;
}
if (*p == '\0') {
if (length > maxDigits) {
G4cerr << "digit length exceeds" << G4endl;
return false;
}
return true;
}
}
return false;
}
// Return true if `str` parses to an exponent
//
// A valid exponent is an integer of no more than 7 digits
inline G4bool ExpectExponent(const char* str)
{
return IsInt(str, 7);
}
inline G4bool IsDouble(const char* str)
{
const char* p = str;
switch (*p) {
case '+':
case '-':
++p;
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
switch (*p) {
case '\0':
return true; // break;
case 'E':
case 'e':
return ExpectExponent(++p); // break;
case '.':
++p;
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
}
else {
return false;
}
break;
default:
return false;
}
}
if (*p == '.') {
++p;
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
}
}
break;
case '.':
++p;
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
}
break;
default: // digit is expected
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
if (*p == '.') {
++p;
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
if (isdigit(*p) != 0) {
while (isdigit((G4int)(*p)) != 0) {
++p;
}
if (*p == '\0') {
return true;
}
if (*p == 'e' || *p == 'E') {
return ExpectExponent(++p);
}
}
}
}
}
return false;
}
// --------------------------------------------------------------------
inline G4int CompareInt(G4int arg1, G4int op, G4int arg2, G4int& errCode)
{
G4int result = -1;
switch (op) {
case G4UItokenNum::GT:
result = static_cast<G4int>(arg1 > arg2);
break;
case G4UItokenNum::GE:
result = static_cast<G4int>(arg1 >= arg2);
break;
case G4UItokenNum::LT:
result = static_cast<G4int>(arg1 < arg2);
break;
case G4UItokenNum::LE:
result = static_cast<G4int>(arg1 <= arg2);
break;
case G4UItokenNum::EQ:
result = static_cast<G4int>(arg1 == arg2);
break;
case G4UItokenNum::NE:
result = static_cast<G4int>(arg1 != arg2);
break;
default:
G4cerr << "Parameter range: error at CompareInt" << G4endl;
errCode = 1;
}
return result;
}
// --------------------------------------------------------------------
inline G4int CompareLong(G4long arg1, G4int op, G4long arg2, G4int& errCode)
{
G4int result = -1;
switch (op) {
case G4UItokenNum::GT:
result = static_cast<G4int>(arg1 > arg2);
break;
case G4UItokenNum::GE:
result = static_cast<G4int>(arg1 >= arg2);
break;
case G4UItokenNum::LT:
result = static_cast<G4int>(arg1 < arg2);
break;
case G4UItokenNum::LE:
result = static_cast<G4int>(arg1 <= arg2);
break;
case G4UItokenNum::EQ:
result = static_cast<G4int>(arg1 == arg2);
break;
case G4UItokenNum::NE:
result = static_cast<G4int>(arg1 != arg2);
break;
default:
G4cerr << "Parameter range: error at CompareInt" << G4endl;
errCode = 1;
}
return result;
}
// --------------------------------------------------------------------
inline G4int CompareDouble(G4double arg1, G4int op, G4double arg2, G4int& errCode)
{
G4int result = -1;
switch (op) {
case G4UItokenNum::GT:
result = static_cast<G4int>(arg1 > arg2);
break;
case G4UItokenNum::GE:
result = static_cast<G4int>(arg1 >= arg2);
break;
case G4UItokenNum::LT:
result = static_cast<G4int>(arg1 < arg2);
break;
case G4UItokenNum::LE:
result = static_cast<G4int>(arg1 <= arg2);
break;
case G4UItokenNum::EQ:
result = static_cast<G4int>(arg1 == arg2);
break;
case G4UItokenNum::NE:
result = static_cast<G4int>(arg1 != arg2);
break;
default:
G4cerr << "Parameter range: error at CompareDouble" << G4endl;
errCode = 1;
}
return result;
}
} // namespace G4UIparsing
#endif
@@ -35,8 +35,8 @@
#ifndef G4UnitsMessenger_hh
#define G4UnitsMessenger_hh 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class G4UIdirectory;
class G4UIcmdWithoutParameter;
@@ -44,14 +44,12 @@ class G4UIcmdWithoutParameter;
class G4UnitsMessenger : public G4UImessenger
{
public:
G4UnitsMessenger();
~G4UnitsMessenger() override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
private:
G4UIdirectory* UnitsTableDir = nullptr;
G4UIcmdWithoutParameter* ListCmd = nullptr;
};