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

#include <G4PlotMessenger.hh>

Inheritance diagram for G4PlotMessenger:
Collaboration diagram for G4PlotMessenger:

Public Member Functions

 G4PlotMessenger (G4PlotParameters *plotParameters)
 
virtual ~G4PlotMessenger ()
 
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 G4PlotMessenger.hh.

Constructor & Destructor Documentation

G4PlotMessenger::G4PlotMessenger ( G4PlotParameters plotParameters)
explicit

Definition at line 48 of file G4PlotMessenger.cc.

49  : G4UImessenger(),
50  fPlotParameters(plotParameters),
51  fHelper(nullptr),
52  fDirectory(nullptr),
53  fSetLayoutCmd(nullptr),
54  fSetDimensionsCmd(nullptr),
55  fSetStyleCmd(nullptr)
56 {
57  fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>("plot");
58 
59  fDirectory = fHelper->CreateHnDirectory();
60 
61  SetStyleCmd();
62  SetLayoutCmd();
63  SetDimensionsCmd();
64 }
G4PlotMessenger::~G4PlotMessenger ( )
virtual

Definition at line 67 of file G4PlotMessenger.cc.

68 {}

Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 154 of file G4PlotMessenger.cc.

155 {
156  // tokenize parameters in a vector
157  std::vector<G4String> parameters;
158  G4Analysis::Tokenize(newValues, parameters);
159  // check consistency
160  if ( G4int(parameters.size()) != command->GetParameterEntries() ) {
161  // Should never happen but let's check anyway for consistency
162  fHelper->WarnAboutParameters(command, parameters.size());
163  return;
164  }
165 
166  if ( command == fSetLayoutCmd.get() ) {
167  auto counter = 0;
168  auto columns = G4UIcommand::ConvertToInt(parameters[counter++]);
169  auto rows = G4UIcommand::ConvertToInt(parameters[counter++]);
170  fPlotParameters->SetLayout(columns, rows);
171  }
172  else if ( command == fSetDimensionsCmd.get() ) {
173  auto counter = 0;
174  auto width = G4UIcommand::ConvertToInt(parameters[counter++]);
175  auto height = G4UIcommand::ConvertToInt(parameters[counter++]);
176  fPlotParameters->SetDimensions(width, height);
177  }
178 #if defined(TOOLS_USE_FREETYPE)
179  else if ( command == fSetStyleCmd.get() ) {
180  fPlotParameters->SetStyle(newValues);
181  }
182 #endif
183 }
#define width
int G4int
Definition: G4Types.hh:78
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:447
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
void SetLayout(G4int columns, G4int rows)
void SetDimensions(G4int width, G4int height)
void SetStyle(const G4String &style)
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143

Here is the call graph for this function:


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