Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UIparameter Class Reference

#include <G4UIparameter.hh>

Public Member Functions

 G4UIparameter ()=default
 
 G4UIparameter (char theType)
 
 G4UIparameter (const char *theName, char theType, G4bool theOmittable)
 
 ~G4UIparameter ()
 
G4int CheckNewValue (const char *newValue)
 
void List ()
 
void SetDefaultValue (const char *theDefaultValue)
 
void SetDefaultValue (G4int theDefaultValue)
 
void SetDefaultValue (G4long theDefaultValue)
 
void SetDefaultValue (G4double theDefaultValue)
 
void SetDefaultUnit (const char *theDefaultUnit)
 
const G4StringGetDefaultValue () const
 
char GetParameterType () const
 
void SetParameterRange (const char *theRange)
 
const G4StringGetParameterRange () const
 
void SetParameterName (const char *pName)
 
const G4StringGetParameterName () const
 
void SetParameterCandidates (const char *theString)
 
const G4StringGetParameterCandidates () const
 
void SetOmittable (G4bool om)
 
G4bool IsOmittable () const
 
void SetCurrentAsDefault (G4bool val)
 
G4bool GetCurrentAsDefault () const
 
const G4StringGetParameterGuidance () const
 
void SetGuidance (const char *theGuidance)
 

Protected Types

using yystype = G4UItokenNum::yystype
 
using tokenNum = G4UItokenNum::tokenNum
 

Detailed Description

Definition at line 45 of file G4UIparameter.hh.

Member Typedef Documentation

◆ tokenNum

Definition at line 113 of file G4UIparameter.hh.

◆ yystype

Definition at line 112 of file G4UIparameter.hh.

Constructor & Destructor Documentation

◆ G4UIparameter() [1/3]

G4UIparameter::G4UIparameter ( )
default

◆ G4UIparameter() [2/3]

G4UIparameter::G4UIparameter ( char theType)

Definition at line 45 of file G4UIparameter.cc.

46{
47 parameterType = theType;
48}

◆ G4UIparameter() [3/3]

G4UIparameter::G4UIparameter ( const char * theName,
char theType,
G4bool theOmittable )

Definition at line 51 of file G4UIparameter.cc.

52{
53 parameterName = theName;
54 parameterType = theType;
55 omittable = theOmittable;
56}

◆ ~G4UIparameter()

G4UIparameter::~G4UIparameter ( )
default

Member Function Documentation

◆ CheckNewValue()

G4int G4UIparameter::CheckNewValue ( const char * newValue)

Definition at line 140 of file G4UIparameter.cc.

141{
142 if (!TypeCheck(newValue)) {
144 }
145 if (!RangeCheck(newValue)) {
147 }
148 if (!CandidateCheck(newValue)) {
150 }
151 return 0; // succeeded
152}
@ fParameterOutOfCandidates
@ fParameterUnreadable
@ fParameterOutOfRange

◆ GetCurrentAsDefault()

G4bool G4UIparameter::GetCurrentAsDefault ( ) const
inline

Definition at line 104 of file G4UIparameter.hh.

104{ return currentAsDefaultFlag; }

Referenced by G4UIcommandTree::CreateHTML().

◆ GetDefaultValue()

◆ GetParameterCandidates()

const G4String & G4UIparameter::GetParameterCandidates ( ) const
inline

◆ GetParameterGuidance()

const G4String & G4UIparameter::GetParameterGuidance ( ) const
inline

Definition at line 108 of file G4UIparameter.hh.

108{ return parameterGuidance; }

◆ GetParameterName()

const G4String & G4UIparameter::GetParameterName ( ) const
inline

Definition at line 92 of file G4UIparameter.hh.

92{ return parameterName; }

Referenced by G4UIcommandTree::CreateHTML(), G4UImanager::GetCurrentStringValue(), and G4GenericMessenger::Command::SetUnit().

◆ GetParameterRange()

const G4String & G4UIparameter::GetParameterRange ( ) const
inline

Definition at line 89 of file G4UIparameter.hh.

89{ return rangeExpression; }

Referenced by G4UIcommandTree::CreateHTML().

◆ GetParameterType()

char G4UIparameter::GetParameterType ( ) const
inline

Definition at line 80 of file G4UIparameter.hh.

80{ return parameterType; }

Referenced by G4UIcommandTree::CreateHTML().

◆ IsOmittable()

◆ List()

void G4UIparameter::List ( )

Definition at line 62 of file G4UIparameter.cc.

63{
64 G4cout << G4endl << "Parameter : " << parameterName << G4endl;
65 if (!parameterGuidance.empty()) {
66 G4cout << parameterGuidance << G4endl;
67 }
68 G4cout << " Parameter type : " << parameterType << G4endl;
69 if (omittable) {
70 G4cout << " Omittable : True" << G4endl;
71 }
72 else {
73 G4cout << " Omittable : False" << G4endl;
74 }
75 if (currentAsDefaultFlag) {
76 G4cout << " Default value : taken from the current value" << G4endl;
77 }
78 else if (!defaultValue.empty()) {
79 G4cout << " Default value : " << defaultValue << G4endl;
80 }
81 if (!rangeExpression.empty()) {
82 G4cout << " Parameter range : " << rangeExpression << G4endl;
83 }
84 if (!parameterCandidate.empty()) {
85 G4cout << " Candidates : " << parameterCandidate << G4endl;
86 }
87}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout

◆ SetCurrentAsDefault()

◆ SetDefaultUnit()

void G4UIparameter::SetDefaultUnit ( const char * theDefaultUnit)

Definition at line 108 of file G4UIparameter.cc.

109{
110 char type = (char)std::toupper(parameterType);
111 if (type != 'S') {
113 ed << "This method can be used only for a string-type parameter that is "
114 "used to specify a unit.\n"
115 << "This parameter <" << parameterName << "> is defined as ";
116 switch (type) {
117 case 'D':
118 ed << "double.";
119 break;
120 case 'I':
121 ed << "integer.";
122 break;
123 case 'L':
124 ed << "long int.";
125 break;
126 case 'B':
127 ed << "bool.";
128 break;
129 default:
130 ed << "undefined.";
131 }
132 G4Exception("G4UIparameter::SetDefaultUnit", "INTERCOM2010", FatalException, ed);
133 }
134 SetDefaultValue(theDefaultUnit);
136}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
static G4String CategoryOf(const char *unitName)
static G4String UnitsList(const char *unitCategory)
void SetDefaultValue(const char *theDefaultValue)
void SetParameterCandidates(const char *theString)

Referenced by G4ScoringMessenger::G4ScoringMessenger(), and G4UserPhysicsListMessenger::G4UserPhysicsListMessenger().

◆ SetDefaultValue() [1/4]

void G4UIparameter::SetDefaultValue ( const char * theDefaultValue)
inline

Definition at line 69 of file G4UIparameter.hh.

69{ defaultValue = theDefaultValue; }

Referenced by G4GMocrenMessenger::G4GMocrenMessenger(), G4InteractorMessenger::G4InteractorMessenger(), G4MatScanMessenger::G4MatScanMessenger(), G4ParticleGunMessenger::G4ParticleGunMessenger(), G4PolarizationMessenger::G4PolarizationMessenger(), G4ProcessManagerMessenger::G4ProcessManagerMessenger(), G4ProcessTableMessenger::G4ProcessTableMessenger(), G4ScoringMessenger::G4ScoringMessenger(), G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(), G4VisCommandGeometrySetColour::G4VisCommandGeometrySetColour(), G4VisCommandGeometrySetDaughtersInvisible::G4VisCommandGeometrySetDaughtersInvisible(), G4VisCommandGeometrySetForceAuxEdgeVisible::G4VisCommandGeometrySetForceAuxEdgeVisible(), G4VisCommandGeometrySetForceCloud::G4VisCommandGeometrySetForceCloud(), G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle(), G4VisCommandGeometrySetForceSolid::G4VisCommandGeometrySetForceSolid(), G4VisCommandGeometrySetForceWireframe::G4VisCommandGeometrySetForceWireframe(), G4VisCommandGeometrySetLineStyle::G4VisCommandGeometrySetLineStyle(), G4VisCommandGeometrySetLineWidth::G4VisCommandGeometrySetLineWidth(), G4VisCommandGeometrySetVisibility::G4VisCommandGeometrySetVisibility(), G4VisCommandSceneAddArrow::G4VisCommandSceneAddArrow(), G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes(), G4VisCommandSceneAddLine::G4VisCommandSceneAddLine(), G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume(), G4VisCommandSceneAddLogo::G4VisCommandSceneAddLogo(), G4VisCommandSceneAddScale::G4VisCommandSceneAddScale(), G4VisCommandSceneAddText::G4VisCommandSceneAddText(), G4VisCommandSceneAddText2D::G4VisCommandSceneAddText2D(), G4VisCommandSetColour::G4VisCommandSetColour(), G4VisCommandSetTextColour::G4VisCommandSetTextColour(), G4VisCommandSpecify::G4VisCommandSpecify(), G4VisCommandsTouchableSet::G4VisCommandsTouchableSet(), G4VisCommandsViewerSet::G4VisCommandsViewerSet(), G4VisCommandViewerCentreOn::G4VisCommandViewerCentreOn(), G4UIcmdWith3VectorAndUnit::SetDefaultUnit(), G4UIcmdWithADoubleAndUnit::SetDefaultUnit(), SetDefaultUnit(), G4GenericMessenger::Command::SetDefaultValue(), G4UIcmdWith3Vector::SetDefaultValue(), G4UIcmdWith3VectorAndUnit::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIcmdWithADouble::SetDefaultValue(), G4UIcmdWithADoubleAndUnit::SetDefaultValue(), G4UIcmdWithALongInt::SetDefaultValue(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcmdWithAString::SetDefaultValue(), and G4UIcmdWithNucleusLimits::SetDefaultValue().

◆ SetDefaultValue() [2/4]

void G4UIparameter::SetDefaultValue ( G4double theDefaultValue)

Definition at line 102 of file G4UIparameter.cc.

103{
104 defaultValue = G4UIparsing::TtoS(theDefaultValue);
105}
G4String TtoS(T value)

◆ SetDefaultValue() [3/4]

void G4UIparameter::SetDefaultValue ( G4int theDefaultValue)

Definition at line 90 of file G4UIparameter.cc.

91{
92 defaultValue = G4UIparsing::TtoS(theDefaultValue);
93}

◆ SetDefaultValue() [4/4]

void G4UIparameter::SetDefaultValue ( G4long theDefaultValue)

Definition at line 96 of file G4UIparameter.cc.

97{
98 defaultValue = G4UIparsing::TtoS(theDefaultValue);
99}

◆ SetGuidance()

void G4UIparameter::SetGuidance ( const char * theGuidance)
inline

◆ SetOmittable()

◆ SetParameterCandidates()

◆ SetParameterName()

◆ SetParameterRange()


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