Geant4 11.1.1
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 ()
 
G4bool operator== (const G4UIparameter &right) const
 
G4bool operator!= (const G4UIparameter &right) const
 
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
 
void SetWidget (G4int theWidget)
 
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 135 of file G4UIparameter.hh.

◆ yystype

Definition at line 134 of file G4UIparameter.hh.

Constructor & Destructor Documentation

◆ G4UIparameter() [1/3]

G4UIparameter::G4UIparameter ( )
default

◆ G4UIparameter() [2/3]

G4UIparameter::G4UIparameter ( char  theType)

Definition at line 43 of file G4UIparameter.cc.

44{
45 parameterType = theType;
46}

◆ G4UIparameter() [3/3]

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

Definition at line 49 of file G4UIparameter.cc.

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

◆ ~G4UIparameter()

G4UIparameter::~G4UIparameter ( )
default

Member Function Documentation

◆ CheckNewValue()

G4int G4UIparameter::CheckNewValue ( const char *  newValue)

Definition at line 172 of file G4UIparameter.cc.

173{
174 if(TypeCheck(newValue) == 0)
175 {
177 }
178 if(!parameterRange.empty())
179 {
180 if(RangeCheck(newValue) == 0)
181 {
183 }
184 }
185 if(!parameterCandidate.empty())
186 {
187 if(CandidateCheck(newValue) == 0)
188 {
190 }
191 }
192 return 0; // succeeded
193}
@ fParameterOutOfCandidates
@ fParameterUnreadable
@ fParameterOutOfRange

◆ GetCurrentAsDefault()

G4bool G4UIparameter::GetCurrentAsDefault ( ) const
inline

Definition at line 118 of file G4UIparameter.hh.

118{ return currentAsDefaultFlag; }

Referenced by G4UIcommandTree::CreateHTML().

◆ GetDefaultValue()

◆ GetParameterCandidates()

const G4String & G4UIparameter::GetParameterCandidates ( ) const
inline

◆ GetParameterGuidance()

const G4String & G4UIparameter::GetParameterGuidance ( ) const
inline

Definition at line 123 of file G4UIparameter.hh.

124 {
125 return parameterGuidance;
126 }

◆ GetParameterName()

const G4String & G4UIparameter::GetParameterName ( ) const
inline

Definition at line 100 of file G4UIparameter.hh.

100{ return parameterName; }

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

◆ GetParameterRange()

const G4String & G4UIparameter::GetParameterRange ( ) const
inline

Definition at line 97 of file G4UIparameter.hh.

97{ return parameterRange; }

Referenced by G4UIcommandTree::CreateHTML().

◆ GetParameterType()

char G4UIparameter::GetParameterType ( ) const
inline

Definition at line 85 of file G4UIparameter.hh.

85{ return parameterType; }

Referenced by G4UIcommandTree::CreateHTML().

◆ IsOmittable()

◆ List()

void G4UIparameter::List ( )

Definition at line 73 of file G4UIparameter.cc.

74{
75 G4cout << G4endl << "Parameter : " << parameterName << G4endl;
76 if(!parameterGuidance.empty())
77 {
78 G4cout << parameterGuidance << G4endl;
79 }
80 G4cout << " Parameter type : " << parameterType << G4endl;
81 if(omittable)
82 {
83 G4cout << " Omittable : True" << G4endl;
84 }
85 else
86 {
87 G4cout << " Omittable : False" << G4endl;
88 }
89 if(currentAsDefaultFlag)
90 {
91 G4cout << " Default value : taken from the current value" << G4endl;
92 }
93 else if(!defaultValue.empty())
94 {
95 G4cout << " Default value : " << defaultValue << G4endl;
96 }
97 if(!parameterRange.empty())
98 {
99 G4cout << " Parameter range : " << parameterRange << G4endl;
100 }
101 if(!parameterCandidate.empty())
102 {
103 G4cout << " Candidates : " << parameterCandidate << G4endl;
104 }
105}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

◆ operator!=()

G4bool G4UIparameter::operator!= ( const G4UIparameter right) const

Definition at line 67 of file G4UIparameter.cc.

68{
69 return (this != &right);
70}

◆ operator==()

G4bool G4UIparameter::operator== ( const G4UIparameter right) const

Definition at line 61 of file G4UIparameter.cc.

62{
63 return (this == &right);
64}

◆ SetCurrentAsDefault()

◆ SetDefaultUnit()

void G4UIparameter::SetDefaultUnit ( const char *  theDefaultUnit)

Definition at line 132 of file G4UIparameter.cc.

133{
134 char type = (char)std::toupper(parameterType);
135 if(type != 'S')
136 {
138 ed << "This method can be used only for a string-type parameter that is "
139 "used to specify a unit.\n"
140 << "This parameter <" << parameterName << "> is defined as ";
141 switch(type)
142 {
143 case 'D':
144 ed << "double.";
145 break;
146 case 'I':
147 ed << "integer.";
148 break;
149 case 'L':
150 ed << "long int.";
151 break;
152 case 'B':
153 ed << "bool.";
154 break;
155 default:
156 ed << "undefined.";
157 }
158 G4Exception("G4UIparameter::SetDefaultUnit", "INTERCOM2010", FatalException,
159 ed);
160 }
161 SetDefaultValue(theDefaultUnit);
164}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4String CategoryOf(const char *unitName)
Definition: G4UIcommand.cc:370
static G4String UnitsList(const char *unitCategory)
Definition: G4UIcommand.cc:376
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 70 of file G4UIparameter.hh.

71 {
72 defaultValue = theDefaultValue;
73 }

Referenced by G4AdjointSimMessenger::G4AdjointSimMessenger(), G4GMocrenMessenger::G4GMocrenMessenger(), G4InteractorMessenger::G4InteractorMessenger(), G4MatScanMessenger::G4MatScanMessenger(), G4ParticleGunMessenger::G4ParticleGunMessenger(), G4PolarizationMessenger::G4PolarizationMessenger(), G4ProcessManagerMessenger::G4ProcessManagerMessenger(), G4ProcessTableMessenger::G4ProcessTableMessenger(), G4RunMessenger::G4RunMessenger(), G4ScoringMessenger::G4ScoringMessenger(), G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(), G4VisCommandGeometrySetColour::G4VisCommandGeometrySetColour(), G4VisCommandGeometrySetDaughtersInvisible::G4VisCommandGeometrySetDaughtersInvisible(), G4VisCommandGeometrySetForceAuxEdgeVisible::G4VisCommandGeometrySetForceAuxEdgeVisible(), G4VisCommandGeometrySetForceCloud::G4VisCommandGeometrySetForceCloud(), G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceLineSegmentsPerCircle(), G4VisCommandGeometrySetForceSolid::G4VisCommandGeometrySetForceSolid(), G4VisCommandGeometrySetForceWireframe::G4VisCommandGeometrySetForceWireframe(), G4VisCommandGeometrySetLineStyle::G4VisCommandGeometrySetLineStyle(), G4VisCommandGeometrySetLineWidth::G4VisCommandGeometrySetLineWidth(), G4VisCommandGeometrySetVisibility::G4VisCommandGeometrySetVisibility(), G4VisCommandOpen::G4VisCommandOpen(), 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(), G4UIcmdWithAString::SetDefaultValue(), G4UIcmdWith3Vector::SetDefaultValue(), G4UIcmdWith3VectorAndUnit::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIcmdWithADouble::SetDefaultValue(), G4UIcmdWithADoubleAndUnit::SetDefaultValue(), G4UIcmdWithAnInteger::SetDefaultValue(), G4GenericMessenger::Command::SetDefaultValue(), G4UIcmdWithALongInt::SetDefaultValue(), and G4UIcmdWithNucleusLimits::SetDefaultValue().

◆ SetDefaultValue() [2/4]

void G4UIparameter::SetDefaultValue ( G4double  theDefaultValue)

Definition at line 124 of file G4UIparameter.cc.

125{
126 std::ostringstream os;
127 os << theDefaultValue;
128 defaultValue = os.str();
129}

◆ SetDefaultValue() [3/4]

void G4UIparameter::SetDefaultValue ( G4int  theDefaultValue)

Definition at line 108 of file G4UIparameter.cc.

109{
110 std::ostringstream os;
111 os << theDefaultValue;
112 defaultValue = os.str();
113}

◆ SetDefaultValue() [4/4]

void G4UIparameter::SetDefaultValue ( G4long  theDefaultValue)

Definition at line 116 of file G4UIparameter.cc.

117{
118 std::ostringstream os;
119 os << theDefaultValue;
120 defaultValue = os.str();
121}

◆ SetGuidance()

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

◆ SetOmittable()

◆ SetParameterCandidates()

◆ SetParameterName()

◆ SetParameterRange()

◆ SetWidget()

void G4UIparameter::SetWidget ( G4int  theWidget)
inline

Definition at line 122 of file G4UIparameter.hh.

122{ widget = theWidget; }

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