Geant4 11.2.2
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 CommandsShouldBeInMaster () const
 

Protected Member Functions

G4String ItoS (G4int i)
 
G4String LtoS (G4long l)
 
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 44 of file G4UImessenger.cc.

46{
47 CreateDirectory(path, dsc, commandsToBeBroadcasted);
48}
void CreateDirectory(const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)

◆ ~G4UImessenger()

G4UImessenger::~G4UImessenger ( )
virtual

Definition at line 51 of file G4UImessenger.cc.

52{
53 delete baseDir;
54}
G4UIdirectory * baseDir

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand * newCommand)
protected

Definition at line 121 of file G4UImessenger.cc.

122{
123 G4cerr << "Warning : Old style definition of G4UIcommand <" << newCommand->GetCommandPath()
124 << ">." << G4endl;
125}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
const G4String & GetCommandPath() const

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool b)
protected

Definition at line 90 of file G4UImessenger.cc.

91{
92 return b ? "true" : "0";
93}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inline

Definition at line 72 of file G4UImessenger.hh.

G4bool commandsShouldBeInMaster

◆ CreateCommand()

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

Definition at line 101 of file G4UImessenger.hh.

102{
103 G4String path;
104 if (cname[0] != '/') {
105 path = baseDirName + cname;
106 if (path[0] != '/') {
107 path = "/" + path;
108 }
109 }
110
111 T* command = new T(path.c_str(), this);
112 command->SetGuidance(dsc.c_str());
113
114 return command;
115}
G4String baseDirName

◆ CreateDirectory()

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

Definition at line 128 of file G4UImessenger.cc.

130{
132
133 G4String fullpath = path;
134 if (fullpath.back() != '/') {
135 fullpath.append("/");
136 }
137
138 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
139 if (tree != nullptr) {
140 baseDirName = tree->GetPathName();
141 }
142 else {
143 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
144 baseDirName = fullpath;
145 baseDir->SetGuidance(dsc.c_str());
146 }
147}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
void SetGuidance(const char *aGuidance)
G4UIcommandTree * GetTree() const
static G4UImanager * GetUIpointer()

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

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double a)
protected

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << a;
86 return G4String(os.str());
87}

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4UImessenger::GetCurrentValue ( G4UIcommand * command)
virtual

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

Definition at line 57 of file G4UImessenger.cc.

58{
59 return G4String{};
60}

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

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int i)
protected

Definition at line 66 of file G4UImessenger.cc.

67{
68 std::ostringstream os;
69 os << i;
70 return G4String(os.str());
71}

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

◆ LtoS()

G4String G4UImessenger::LtoS ( G4long l)
protected

Definition at line 74 of file G4UImessenger.cc.

75{
76 std::ostringstream os;
77 os << l;
78 return G4String(os.str());
79}

◆ SetNewValue()

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

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

Definition at line 63 of file G4UImessenger.cc.

63{}

Referenced by G4UIcommand::DoIt().

◆ StoB()

G4bool G4UImessenger::StoB ( G4String s)
protected

Definition at line 114 of file G4UImessenger.cc.

115{
116 G4String v = G4StrUtil::to_upper_copy(std::move(str));
117 return (v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE");
118}

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

◆ StoD()

◆ StoI()

◆ StoL()

G4long G4UImessenger::StoL ( const G4String & s)
protected

Definition at line 102 of file G4UImessenger.cc.

103{
104 return G4UIparsing::StoT<G4long>(str);
105}

Referenced by G4RunMessenger::SetNewValue().

Member Data Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protected

Definition at line 93 of file G4UImessenger.hh.

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

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protected

Definition at line 94 of file G4UImessenger.hh.

Referenced by CreateCommand(), and CreateDirectory().

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protected

Definition at line 95 of file G4UImessenger.hh.

Referenced by CommandsShouldBeInMaster(), and G4QSSMessenger::G4QSSMessenger().


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