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

#include <G4UImessenger.hh>

+ Inheritance diagram for G4UImessenger:

Public Member Functions

 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Protected Member Functions

G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const G4String &s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 46 of file G4UImessenger.hh.

Constructor & Destructor Documentation

◆ G4UImessenger() [1/2]

G4UImessenger::G4UImessenger ( )
default

◆ G4UImessenger() [2/2]

G4UImessenger::G4UImessenger ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)

Definition at line 41 of file G4UImessenger.cc.

43{
44 CreateDirectory(path, dsc, commandsToBeBroadcasted);
45}
void CreateDirectory(const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)

◆ ~G4UImessenger()

G4UImessenger::~G4UImessenger ( )
virtual

Definition at line 48 of file G4UImessenger.cc.

49{
50 delete baseDir;
51}
G4UIdirectory * baseDir

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protected

Definition at line 147 of file G4UImessenger.cc.

148{
149 G4cerr << "Warning : Old style definition of G4UIcommand <"
150 << newCommand->GetCommandPath() << ">." << G4endl;
151}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:137

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protected

Definition at line 94 of file G4UImessenger.cc.

95{
96 G4String vl = "0";
97 if(b)
98 {
99 vl = "true";
100 }
101 return vl;
102}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inline

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protected

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 {
118 path = "/" + path;
119 }
120 }
121
122 T* command = new T(path.c_str(), this);
123 command->SetGuidance(dsc.c_str());
124
125 return command;
126}
G4String baseDirName

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protected

Definition at line 154 of file G4UImessenger.cc.

156{
158
159 G4String fullpath = path;
160 if(fullpath.back() != '/')
161 {
162 fullpath.append("/");
163 }
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:157
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protected

Definition at line 86 of file G4UImessenger.cc.

87{
88 std::ostringstream os;
89 os << a;
90 return G4String(os.str());
91}

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4UImessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented in G4VisCommandModelCreate< Factory >, G4VisCommandOpen, G4VisCommandListManagerList< Manager >, G4VisCommandListManagerSelect< Manager >, G4VisCommandManagerMode< Manager >, G4ScoreQuantityMessenger, G4GeometryMessenger, GFlashShowerModelMessenger, G4DecayTableMessenger, G4ParticleMessenger, G4ParticlePropertyMessenger, G4tgrMessenger, G4PersistencyCenterMessenger, G4ProductionCutsTableMessenger, G4SchedulerMessenger, G4VITSteppingVerbose, G4MoleculeShootMessenger, G4MoleculeGunMessenger, G4ProcessManagerMessenger, G4ProcessTableMessenger, G4MatScanMessenger, G4RunMessenger, G4UserPhysicsListMessenger, G4TrackingMessenger, G4GMocrenMessenger, G4HepRepMessenger, G4VisCommandAbortReviewKeptEvents, G4VisCommandAbortReviewPlots, G4VisCommandDrawOnlyToBeKeptEvents, G4VisCommandEnable, G4VisCommandList, G4VisCommandReviewKeptEvents, G4VisCommandReviewPlots, G4VisCommandVerbose, G4VisCommandPlot, G4VisCommandGeometryList, G4VisCommandGeometryRestore, G4VisCommandGeometrySetColour, G4VisCommandGeometrySetDaughtersInvisible, G4VisCommandGeometrySetForceAuxEdgeVisible, G4VisCommandGeometrySetForceCloud, G4VisCommandGeometrySetForceSolid, G4VisCommandGeometrySetForceLineSegmentsPerCircle, G4VisCommandGeometrySetForceWireframe, G4VisCommandGeometrySetLineStyle, G4VisCommandGeometrySetLineWidth, G4VisCommandGeometrySetVisibility, G4VisCommandSceneActivateModel, G4VisCommandSceneCreate, G4VisCommandSceneEndOfEventAction, G4VisCommandSceneEndOfRunAction, G4VisCommandSceneList, G4VisCommandSceneNotifyHandlers, G4VisCommandSceneRemoveModel, G4VisCommandSceneSelect, G4VisCommandSceneShowExtents, G4VisCommandSceneAddArrow, G4VisCommandSceneAddArrow2D, G4VisCommandSceneAddAxes, G4VisCommandSceneAddDate, G4VisCommandSceneAddDigis, G4VisCommandSceneAddEventID, G4VisCommandSceneAddExtent, G4VisCommandSceneAddElectricField, G4VisCommandSceneAddFrame, G4VisCommandSceneAddGPS, G4VisCommandSceneAddGhosts, G4VisCommandSceneAddHits, G4VisCommandSceneAddLine, G4VisCommandSceneAddLine2D, G4VisCommandSceneAddLocalAxes, G4VisCommandSceneAddLogicalVolume, G4VisCommandSceneAddLogo, G4VisCommandSceneAddLogo2D, G4VisCommandSceneAddMagneticField, G4VisCommandSceneAddPSHits, G4VisCommandSceneAddScale, G4VisCommandSceneAddText, G4VisCommandSceneAddText2D, G4VisCommandSceneAddTrajectories, G4VisCommandSceneAddUserAction, G4VisCommandSceneAddVolume, G4VisCommandSceneAddPlotter, G4VisCommandSceneHandlerAttach, G4VisCommandSceneHandlerCreate, G4VisCommandSceneHandlerList, G4VisCommandSceneHandlerSelect, G4VisCommandSetArrow3DLineSegmentsPerCircle, G4VisCommandSetColour, G4VisCommandSetExtentForField, G4VisCommandSetLineWidth, G4VisCommandSetTextColour, G4VisCommandSetTextLayout, G4VisCommandSetTextSize, G4VisCommandSetTouchable, G4VisCommandSetVolumeForField, G4VisCommandsTouchable, G4VisCommandsTouchableSet, G4VisCommandViewerAddCutawayPlane, G4VisCommandViewerCentreOn, G4VisCommandViewerChangeCutawayPlane, G4VisCommandViewerClear, G4VisCommandViewerClearCutawayPlanes, G4VisCommandViewerClearTransients, G4VisCommandViewerClearVisAttributesModifiers, G4VisCommandViewerClone, G4VisCommandViewerColourByDensity, G4VisCommandViewerCopyViewFrom, G4VisCommandViewerCreate, G4VisCommandViewerDolly, G4VisCommandViewerFlush, G4VisCommandViewerInterpolate, G4VisCommandViewerList, G4VisCommandViewerPan, G4VisCommandViewerRebuild, G4VisCommandViewerRefresh, G4VisCommandViewerReset, G4VisCommandViewerResetCameraParameters, G4VisCommandViewerSave, G4VisCommandViewerScale, G4VisCommandViewerSelect, G4VisCommandViewerUpdate, G4VisCommandViewerZoom, G4VisCommandViewerDefaultHiddenEdge, G4VisCommandViewerDefaultStyle, G4VisCommandsViewerSet, G4VModelCommand< T >, G4VModelCommand< M >, G4RTMessenger, G4ASCIITreeMessenger, G4VtkMessenger, G4THnMessenger< DIM, HT >, G4ScoringMessenger, G4EvManMessenger, G4GeneralParticleSourceMessenger, G4ParticleGunMessenger, G4GenericMessenger, G4UIcontrolMessenger, G4PolarizationMessenger, and G4DNAChemistryManager.

Definition at line 54 of file G4UImessenger.cc.

55{
56 G4String nullString;
57 return nullString;
58}

Referenced by G4UIcommand::DoIt(), and G4UIcommand::GetCurrentValue().

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protected

Definition at line 78 of file G4UImessenger.cc.

79{
80 std::ostringstream os;
81 os << i;
82 return G4String(os.str());
83}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ operator!=()

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const

Definition at line 72 of file G4UImessenger.cc.

73{
74 return this != &messenger;
75}

◆ operator==()

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const

Definition at line 66 of file G4UImessenger.cc.

67{
68 return this == &messenger;
69}

◆ SetNewValue()

void G4UImessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented in G4ErrorMessenger, G4GlobalMagFieldMessenger, G4GDMLMessenger, G4OpticalParametersMessenger, G4ParticleHPMessenger, G4UCNBoundaryProcessMessenger, G4NeutronKillerMessenger, G4AdjointSimMessenger, G4OpenGLViewerMessenger, G4OpenGLXmViewerMessenger, G4OpenInventorXtExaminerViewerMessenger, G4ToolsSGSceneHandler::Messenger, G4NistMessenger, G4LocalThreadCoutMessenger, G4ProfilerMessenger, G4UnitsMessenger, G4DNAChemistryManager, G4EmExtraParametersMessenger, G4EmLowEParametersMessenger, G4EmParametersMessenger, G4DeexParametersMessenger, G4ToolsSGOffscreenViewer::Messenger, G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Messenger, G4EmMessenger, G4PhysListFactoryMessenger, G4InteractorMessenger, G4VITSteppingVerbose, G4MoleculeShootMessenger, G4MoleculeGunMessenger, G4ReactionTableMessenger, G4CascadeParamMessenger, G4MatScanMessenger, G4GMocrenMessenger, G4HepRepMessenger, G4VisCommandModelCreate< Factory >, G4VisCommandAbortReviewKeptEvents, G4VisCommandAbortReviewPlots, G4VisCommandDrawOnlyToBeKeptEvents, G4VisCommandEnable, G4VisCommandInitialize, G4VisCommandList, G4VisCommandReviewKeptEvents, G4VisCommandReviewPlots, G4VisCommandVerbose, G4VisCommandDrawTree, G4VisCommandDrawView, G4VisCommandDrawLogicalVolume, G4VisCommandDrawVolume, G4VisCommandOpen, G4VisCommandPlot, G4VisCommandSpecify, G4VisCommandGeometryList, G4VisCommandGeometryRestore, G4VisCommandGeometrySetColour, G4VisCommandGeometrySetDaughtersInvisible, G4VisCommandGeometrySetForceAuxEdgeVisible, G4VisCommandGeometrySetForceCloud, G4VisCommandGeometrySetForceSolid, G4VisCommandGeometrySetForceLineSegmentsPerCircle, G4VisCommandGeometrySetForceWireframe, G4VisCommandGeometrySetLineStyle, G4VisCommandGeometrySetLineWidth, G4VisCommandGeometrySetVisibility, G4VisCommandListManagerList< Manager >, G4VisCommandListManagerSelect< Manager >, G4VisCommandManagerMode< Manager >, G4VisCommandSceneActivateModel, G4VisCommandSceneCreate, G4VisCommandSceneEndOfEventAction, G4VisCommandSceneEndOfRunAction, G4VisCommandSceneList, G4VisCommandSceneNotifyHandlers, G4VisCommandSceneRemoveModel, G4VisCommandSceneSelect, G4VisCommandSceneShowExtents, G4VisCommandSceneAddArrow, G4VisCommandSceneAddArrow2D, G4VisCommandSceneAddAxes, G4VisCommandSceneAddDate, G4VisCommandSceneAddDigis, G4VisCommandSceneAddEventID, G4VisCommandSceneAddExtent, G4VisCommandSceneAddElectricField, G4VisCommandSceneAddFrame, G4VisCommandSceneAddGPS, G4VisCommandSceneAddGhosts, G4VisCommandSceneAddHits, G4VisCommandSceneAddLine, G4VisCommandSceneAddLine2D, G4VisCommandSceneAddLocalAxes, G4VisCommandSceneAddLogicalVolume, G4VisCommandSceneAddLogo, G4VisCommandSceneAddLogo2D, G4VisCommandSceneAddMagneticField, G4VisCommandSceneAddPSHits, G4VisCommandSceneAddScale, G4VisCommandSceneAddText, G4VisCommandSceneAddText2D, G4VisCommandSceneAddTrajectories, G4VisCommandSceneAddUserAction, G4VisCommandSceneAddVolume, G4VisCommandSceneAddPlotter, G4VisCommandSceneHandlerAttach, G4VisCommandSceneHandlerCreate, G4VisCommandSceneHandlerList, G4VisCommandSceneHandlerSelect, G4VisCommandSetArrow3DLineSegmentsPerCircle, G4VisCommandSetColour, G4VisCommandSetExtentForField, G4VisCommandSetLineWidth, G4VisCommandSetTextColour, G4VisCommandSetTextLayout, G4VisCommandSetTextSize, G4VisCommandSetTouchable, G4VisCommandSetVolumeForField, G4VisCommandsTouchable, G4VisCommandsTouchableSet, G4VisCommandViewerAddCutawayPlane, G4VisCommandViewerCentreOn, G4VisCommandViewerChangeCutawayPlane, G4VisCommandViewerClear, G4VisCommandViewerClearCutawayPlanes, G4VisCommandViewerClearTransients, G4VisCommandViewerClearVisAttributesModifiers, G4VisCommandViewerClone, G4VisCommandViewerColourByDensity, G4VisCommandViewerCopyViewFrom, G4VisCommandViewerCreate, G4VisCommandViewerDolly, G4VisCommandViewerFlush, G4VisCommandViewerInterpolate, G4VisCommandViewerList, G4VisCommandViewerPan, G4VisCommandViewerRebuild, G4VisCommandViewerRefresh, G4VisCommandViewerReset, G4VisCommandViewerResetCameraParameters, G4VisCommandViewerSave, G4VisCommandViewerScale, G4VisCommandViewerSelect, G4VisCommandViewerUpdate, G4VisCommandViewerZoom, G4VisCommandViewerDefaultHiddenEdge, G4VisCommandViewerDefaultStyle, G4VisCommandsViewerSet, G4ModelCmdApplyStringColour< M >, G4ModelCmdApplyColour< M >, G4ModelCmdApplyBool< M >, G4ModelCmdApplyNull< M >, G4ModelCmdApplyDouble< M >, G4ModelCmdApplyDoubleAndUnit< M >, G4ModelCmdApplyInteger< M >, G4ModelCmdApplyString< M >, G4RTMessenger, G4ASCIITreeMessenger, G4VtkMessenger, G4GenericMessenger, G4UIcontrolMessenger, G4MoleculeTableMessenger, G4SDmessenger, G4TScoreNtupleWriterMessenger< T >, G4GeometryMessenger, GFlashShowerModelMessenger, G4DecayTableMessenger, G4NuclideTableMessenger, G4ParticleMessenger, G4ParticlePropertyMessenger, G4tgrMessenger, G4PersistencyCenterMessenger, G4ProductionCutsTableMessenger, G4SchedulerMessenger, G4HadronicEPTestMessenger, G4INCLXXInterfaceMessenger, G4RadioactivationMessenger, G4RadioactiveDecayMessenger, G4ProcessManagerMessenger, G4ProcessTableMessenger, G4FastSimulationMessenger, G4DMmessenger, G4RunMessenger, G4UserPhysicsListMessenger, G4TrackingMessenger, G4ScoreQuantityMessenger, G4ScoringMessenger, G4EvManMessenger, G4GeneralParticleSourceMessenger, G4ParticleGunMessenger, G4StackingMessenger, G4PolarizationMessenger, G4FTFTuningsMessenger, G4HadronicParametersMessenger, G4GenericAnalysisMessenger, G4PlotMessenger, G4AnalysisMessenger, G4HnMessenger, G4NtupleMessenger, and G4THnMessenger< DIM, HT >.

Definition at line 61 of file G4UImessenger.cc.

62{
63}

Referenced by G4UIcommand::DoIt().

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protected

Definition at line 135 of file G4UImessenger.cc.

136{
137 G4String v = G4StrUtil::to_upper_copy(std::move(str));
138 G4bool vl = false;
139 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
140 {
141 vl = true;
142 }
143 return vl;
144}
bool G4bool
Definition: G4Types.hh:86
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

◆ StoI()

G4int G4UImessenger::StoI ( const G4String s)
protected

◆ StoL()

G4long G4UImessenger::StoL ( const G4String s)
protected

Definition at line 115 of file G4UImessenger.cc.

116{
117 G4long vl;
118 const char* t = str;
119 std::istringstream is(t);
120 is >> vl;
121 return vl;
122}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

Member Data Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protected

Definition at line 102 of file G4UImessenger.hh.

Referenced by CreateDirectory(), and ~G4UImessenger().

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protected

Definition at line 103 of file G4UImessenger.hh.

Referenced by CreateCommand(), and CreateDirectory().

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protected

Definition at line 104 of file G4UImessenger.hh.

Referenced by CommandsShouldBeInMaster().


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