Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HnMessenger Class Reference

#include <G4HnMessenger.hh>

Inheritance diagram for G4HnMessenger:
Collaboration diagram for G4HnMessenger:

Public Member Functions

 G4HnMessenger (G4HnManager &manager)
 
virtual ~G4HnMessenger ()
 
virtual void SetNewValue (G4UIcommand *command, G4String value) final
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
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, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 47 of file G4HnMessenger.hh.

Constructor & Destructor Documentation

G4HnMessenger::G4HnMessenger ( G4HnManager manager)
explicit

Definition at line 44 of file G4HnMessenger.cc.

45  : G4UImessenger(),
46  fManager(manager),
47  fHelper(nullptr),
48  fSetHnAsciiCmd(nullptr),
49  fSetHnActivationCmd(nullptr),
50  fSetHnActivationAllCmd(nullptr),
51  fSetHnPlottingCmd(nullptr),
52  fSetHnPlottingAllCmd(nullptr)
53 {
54  G4String hnType = fManager.GetHnType();
55  hnType.toLower();
56  fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(hnType);
57 
58  SetHnAsciiCmd();
59  SetHnActivationCmd();
60  SetHnActivationToAllCmd();
61  SetHnPlottingCmd();
62  SetHnPlottingToAllCmd();
63 }
G4String GetHnType() const
Definition: G4HnManager.hh:118
void toLower()

Here is the call graph for this function:

G4HnMessenger::~G4HnMessenger ( )
virtual

Definition at line 66 of file G4HnMessenger.cc.

67 {}

Member Function Documentation

void G4HnMessenger::SetNewValue ( G4UIcommand command,
G4String  value 
)
finalvirtual

Reimplemented from G4UImessenger.

Definition at line 151 of file G4HnMessenger.cc.

152 {
153  if ( command == fSetHnAsciiCmd.get() ) {
154  auto id = fSetHnAsciiCmd->GetNewIntValue(newValues);
155  fManager.SetAscii(id, true);
156  }
157  else if ( command == fSetHnActivationCmd.get() ) {
158  // tokenize parameters in a vector
159  std::vector<G4String> parameters;
160  G4Analysis::Tokenize(newValues, parameters);
161  // check consistency
162  if ( G4int(parameters.size()) == command->GetParameterEntries() ) {
163  auto counter = 0;
164  auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
165  auto activation = G4UIcommand::ConvertToBool(parameters[counter++]);
166  fManager.SetActivation(id, activation);
167  }
168  else {
169  // Should never happen but let's check anyway for consistency
170  fHelper->WarnAboutParameters(command, parameters.size());
171  }
172  }
173  else if ( command == fSetHnActivationAllCmd.get() ) {
174  auto activation = fSetHnActivationAllCmd->GetNewBoolValue(newValues);
175  fManager.SetActivation(activation);
176  }
177  else if ( command == fSetHnPlottingCmd.get() ) {
178  // tokenize parameters in a vector
179  std::vector<G4String> parameters;
180  G4Analysis::Tokenize(newValues, parameters);
181  // check consistency
182  if ( G4int(parameters.size()) == command->GetParameterEntries() ) {
183  auto counter = 0;
184  auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
185  auto activation = G4UIcommand::ConvertToBool(parameters[counter++]);
186  fManager.SetPlotting(id, activation);
187  }
188  else {
189  // Should never happen but let's check anyway for consistency
190  fHelper->WarnAboutParameters(command, parameters.size());
191  }
192  }
193  else if ( command == fSetHnPlottingAllCmd.get() ) {
194  auto activation = fSetHnPlottingAllCmd->GetNewBoolValue(newValues);
195  fManager.SetPlotting(activation);
196  }
197 }
int G4int
Definition: G4Types.hh:78
void SetPlotting(G4bool plotting)
Definition: G4HnManager.cc:200
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:437
void SetAscii(G4int id, G4bool ascii)
Definition: G4HnManager.cc:164
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:447
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
void SetActivation(G4bool activation)
Definition: G4HnManager.cc:141

Here is the call graph for this function:


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