Geant4 9.6.0
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 ()
 
 G4UImessenger (const G4String &path, const G4String &dsc)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Protected Member Functions

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

Protected Attributes

G4UIdirectorybaseDir
 
G4String baseDirName
 

Detailed Description

Definition at line 47 of file G4UImessenger.hh.

Constructor & Destructor Documentation

◆ G4UImessenger() [1/2]

G4UImessenger::G4UImessenger ( )

Definition at line 38 of file G4UImessenger.cc.

39 : baseDir(NULL), baseDirName("")
40{
41}
G4String baseDirName
G4UIdirectory * baseDir

◆ G4UImessenger() [2/2]

G4UImessenger::G4UImessenger ( const G4String path,
const G4String dsc 
)

Definition at line 43 of file G4UImessenger.cc.

44 : baseDir(NULL), baseDirName("")
45{
46 CreateDirectory(path, dsc);
47}
void CreateDirectory(const G4String &path, const G4String &dsc)

◆ ~G4UImessenger()

G4UImessenger::~G4UImessenger ( )
virtual

Definition at line 49 of file G4UImessenger.cc.

50{
51 if(baseDir) delete baseDir;
52}

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protected

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4cerr << "Warning : Old style definition of G4UIcommand <"
120 << newCommand->GetCommandPath() << ">." << G4endl;
121}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:134

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protected

Definition at line 81 of file G4UImessenger.cc.

82{
83 G4String vl = "0";
84 if(b) vl = "true";
85 return vl;
86}

◆ CreateCommand()

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

Definition at line 93 of file G4UImessenger.hh.

94{
95 G4String path;
96 if( cname(0) != '/' ) {
97 path = baseDirName + cname;
98 if (path(0) != '/') path = "/" + path;
99 }
100
101 T* command = new T(path.c_str(), this);
102 command-> SetGuidance(dsc.c_str());
103
104 return command;
105}

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc 
)
protected

Definition at line 123 of file G4UImessenger.cc.

124{
126
127 G4String fullpath = path;
128 if(fullpath(fullpath.length()-1) != '/') fullpath.append("/");
129
130 G4UIcommandTree* tree= ui-> GetTree()-> FindCommandTree(fullpath.c_str());
131 if (tree) {
132 baseDirName = tree-> GetPathName();
133 } else {
134 baseDir = new G4UIdirectory(fullpath.c_str());
135 baseDirName = fullpath;
136 baseDir-> SetGuidance(dsc.c_str());
137 }
138}
G4String & append(const G4String &)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:51

Referenced by G4UImessenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protected

Definition at line 74 of file G4UImessenger.cc.

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

Referenced by G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4UImessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented in G4ScoreQuantityMessenger, G4VisCommandModelCreate< Factory >, G4VisCommandListManagerList< Manager >, G4VisCommandListManagerSelect< Manager >, G4VisCommandManagerMode< Manager >, G4QMessenger, G4ScoringMessenger, G4EvManMessenger, G4GeneralParticleSourceMessenger, G4ParticleGunMessenger, G4GeometryMessenger, G4GenericMessenger, G4UIcontrolMessenger, GFlashShowerModelMessenger, G4DecayTableMessenger, G4ParticleMessenger, G4ParticlePropertyMessenger, G4tgrMessenger, G4PersistencyCenterMessenger, G4ProductionCutsTableMessenger, G4PolarizationMessenger, G4ProcessManagerMessenger, G4ProcessTableMessenger, G4MatScanMessenger, G4RunMessenger, G4UserPhysicsListMessenger, G4TrackingMessenger, G4GMocrenMessenger, G4HepRepMessenger, G4VisCommandAbortReviewKeptEvents, G4VisCommandEnable, G4VisCommandList, G4VisCommandReviewKeptEvents, G4VisCommandVerbose, G4VisCommandGeometryList, G4VisCommandGeometryRestore, G4VisCommandGeometrySetColour, G4VisCommandGeometrySetDaughtersInvisible, G4VisCommandGeometrySetForceAuxEdgeVisible, G4VisCommandGeometrySetForceSolid, G4VisCommandGeometrySetForceLineSegmentsPerCircle, G4VisCommandGeometrySetForceWireframe, G4VisCommandGeometrySetLineStyle, G4VisCommandGeometrySetLineWidth, G4VisCommandGeometrySetVisibility, G4VisCommandSceneActivateModel, G4VisCommandSceneCreate, G4VisCommandSceneEndOfEventAction, G4VisCommandSceneEndOfRunAction, G4VisCommandSceneList, G4VisCommandSceneNotifyHandlers, G4VisCommandSceneSelect, G4VisCommandSceneAddArrow, G4VisCommandSceneAddArrow2D, G4VisCommandSceneAddAxes, G4VisCommandSceneAddDate, G4VisCommandSceneAddDigis, G4VisCommandSceneAddEventID, G4VisCommandSceneAddFrame, G4VisCommandSceneAddGhosts, G4VisCommandSceneAddHits, G4VisCommandSceneAddLine, G4VisCommandSceneAddLine2D, G4VisCommandSceneAddLogicalVolume, G4VisCommandSceneAddLogo, G4VisCommandSceneAddLogo2D, G4VisCommandSceneAddPSHits, G4VisCommandSceneAddScale, G4VisCommandSceneAddText, G4VisCommandSceneAddText2D, G4VisCommandSceneAddTrajectories, G4VisCommandSceneAddUserAction, G4VisCommandSceneAddVolume, G4VisCommandSceneHandlerAttach, G4VisCommandSceneHandlerCreate, G4VisCommandSceneHandlerList, G4VisCommandSceneHandlerSelect, G4VisCommandSetColour, G4VisCommandSetTextColour, G4VisCommandSetLineWidth, G4VisCommandSetTextLayout, G4VisCommandSetTouchable, G4VisCommandsTouchableSet, G4VisCommandViewerAddCutawayPlane, G4VisCommandViewerChangeCutawayPlane, G4VisCommandViewerClear, G4VisCommandViewerClearCutawayPlanes, G4VisCommandViewerClearTransients, G4VisCommandViewerClone, G4VisCommandViewerCopyViewFrom, G4VisCommandViewerCreate, G4VisCommandViewerDolly, G4VisCommandViewerFlush, G4VisCommandViewerList, G4VisCommandViewerPan, G4VisCommandViewerReset, G4VisCommandViewerRefresh, G4VisCommandViewerRebuild, G4VisCommandViewerSave, G4VisCommandViewerScale, G4VisCommandViewerSelect, G4VisCommandViewerUpdate, G4VisCommandViewerZoom, G4VisCommandViewerDefaultHiddenEdge, G4VisCommandViewerDefaultStyle, G4VisCommandsViewerSet, G4VModelCommand< T >, G4VModelCommand< M >, G4RTMessenger, and G4ASCIITreeMessenger.

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 67 of file G4UImessenger.cc.

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

Referenced by G4ParticleGunMessenger::GetCurrentValue().

◆ operator==()

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

Definition at line 63 of file G4UImessenger.cc.

63 {
64 return this == &messenger;
65}

◆ SetNewValue()

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

Reimplemented in G4ErrorMessenger, G4UnitsMessenger, G4NistMessenger, G4GDMLMessenger, G4OpticalPhysicsMessenger, G4EnergyLossMessenger, G4NeutronKillerMessenger, G4AdjointSimMessenger, G4OpenGLViewerMessenger, G4EmMessenger, G4EmQMessenger, G4QMessenger, G4GenericMessenger, G4UIcontrolMessenger, G4InteractorMessenger, G4CascadeParamMessenger, G4MatScanMessenger, G4GMocrenMessenger, G4HepRepMessenger, G4VisCommandModelCreate< Factory >, G4VisCommandAbortReviewKeptEvents, G4VisCommandEnable, G4VisCommandInitialize, G4VisCommandList, G4VisCommandReviewKeptEvents, G4VisCommandVerbose, G4VisCommandDrawTree, G4VisCommandDrawView, G4VisCommandDrawVolume, G4VisCommandOpen, G4VisCommandSpecify, G4VisCommandGeometryList, G4VisCommandGeometryRestore, G4VisCommandGeometrySetColour, G4VisCommandGeometrySetDaughtersInvisible, G4VisCommandGeometrySetForceAuxEdgeVisible, G4VisCommandGeometrySetForceSolid, G4VisCommandGeometrySetForceLineSegmentsPerCircle, G4VisCommandGeometrySetForceWireframe, G4VisCommandGeometrySetLineStyle, G4VisCommandGeometrySetLineWidth, G4VisCommandGeometrySetVisibility, G4VisCommandListManagerList< Manager >, G4VisCommandListManagerSelect< Manager >, G4VisCommandManagerMode< Manager >, G4VisCommandSceneActivateModel, G4VisCommandSceneCreate, G4VisCommandSceneEndOfEventAction, G4VisCommandSceneEndOfRunAction, G4VisCommandSceneList, G4VisCommandSceneNotifyHandlers, G4VisCommandSceneSelect, G4VisCommandSceneAddArrow, G4VisCommandSceneAddArrow2D, G4VisCommandSceneAddAxes, G4VisCommandSceneAddDate, G4VisCommandSceneAddDigis, G4VisCommandSceneAddEventID, G4VisCommandSceneAddFrame, G4VisCommandSceneAddGhosts, G4VisCommandSceneAddHits, G4VisCommandSceneAddLine, G4VisCommandSceneAddLine2D, G4VisCommandSceneAddLogicalVolume, G4VisCommandSceneAddLogo, G4VisCommandSceneAddLogo2D, G4VisCommandSceneAddPSHits, G4VisCommandSceneAddScale, G4VisCommandSceneAddText, G4VisCommandSceneAddText2D, G4VisCommandSceneAddTrajectories, G4VisCommandSceneAddUserAction, G4VisCommandSceneAddVolume, G4VisCommandSceneHandlerAttach, G4VisCommandSceneHandlerCreate, G4VisCommandSceneHandlerList, G4VisCommandSceneHandlerSelect, G4VisCommandSetColour, G4VisCommandSetTextColour, G4VisCommandSetLineWidth, G4VisCommandSetTextLayout, G4VisCommandSetTouchable, G4VisCommandsTouchableSet, G4VisCommandViewerAddCutawayPlane, G4VisCommandViewerChangeCutawayPlane, G4VisCommandViewerClear, G4VisCommandViewerClearCutawayPlanes, G4VisCommandViewerClearTransients, G4VisCommandViewerClone, G4VisCommandViewerCopyViewFrom, G4VisCommandViewerCreate, G4VisCommandViewerDolly, G4VisCommandViewerFlush, G4VisCommandViewerList, G4VisCommandViewerPan, G4VisCommandViewerReset, G4VisCommandViewerRefresh, G4VisCommandViewerRebuild, 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, G4SDmessenger, G4ScoreQuantityMessenger, G4ScoringMessenger, G4EvManMessenger, G4GeneralParticleSourceMessenger, G4ParticleGunMessenger, G4StackingMessenger, G4GeometryMessenger, GFlashShowerModelMessenger, G4DecayTableMessenger, G4ParticleMessenger, G4ParticlePropertyMessenger, G4tgrMessenger, G4PersistencyCenterMessenger, G4ProductionCutsTableMessenger, G4PolarizationMessenger, G4HadronicEPTestMessenger, G4INCLXXInterfaceMessenger, G4RadioactiveDecaymessenger, G4ProcessManagerMessenger, G4ProcessTableMessenger, G4FastSimulationMessenger, G4DMmessenger, G4RunMessenger, G4UserPhysicsListMessenger, G4TrackingMessenger, and G4AnalysisMessenger.

Definition at line 60 of file G4UImessenger.cc.

61{ ; }

Referenced by G4UIcommand::DoIt().

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protected

Definition at line 106 of file G4UImessenger.cc.

107{
108 G4String v = str;
109 v.toUpper();
110 G4bool vl = false;
111 if( v=="Y" || v=="YES" || v=="1" || v=="T" || v=="TRUE" )
112 { vl = true; }
113 return vl;
114}
bool G4bool
Definition: G4Types.hh:67
void toUpper()

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

◆ StoD()

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protected

Member Data Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir
protected

Definition at line 84 of file G4UImessenger.hh.

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

◆ baseDirName

G4String G4UImessenger::baseDirName
protected

Definition at line 85 of file G4UImessenger.hh.

Referenced by CreateCommand(), and CreateDirectory().


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