File indexing completed on 2025-01-18 09:58:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #ifndef G4PlotMessenger_h
0033 #define G4PlotMessenger_h 1
0034
0035 #include "G4UImessenger.hh"
0036 #include "globals.hh"
0037
0038 #include <memory>
0039 #include <string_view>
0040
0041 class G4PlotParameters;
0042 class G4UIdirectory;
0043 class G4UIcommand;
0044 class G4UIcmdWithAString;
0045 class G4UIparameter;
0046
0047 class G4PlotMessenger : public G4UImessenger
0048 {
0049 public:
0050 explicit G4PlotMessenger(G4PlotParameters* plotParameters);
0051 G4PlotMessenger() = delete;
0052 ~G4PlotMessenger() override;
0053
0054
0055 void SetNewValue(G4UIcommand* command, G4String value) final;
0056
0057 private:
0058
0059 template <typename CMD>
0060 std::unique_ptr<CMD> CreateCommand(G4String name, G4String guidance);
0061 void AddIntParameter(
0062 G4UIcommand& command, G4String name, G4String guidance, G4String range = "");
0063
0064
0065 void SetStyleCmd();
0066 void SetLayoutCmd();
0067 void SetDimensionsCmd();
0068
0069
0070 static constexpr std::string_view fkClass { "G4PlotMessenger" };
0071
0072
0073 G4PlotParameters* fPlotParameters { nullptr };
0074 std::unique_ptr<G4UIdirectory> fDirectory;
0075
0076 std::unique_ptr<G4UIcommand> fSetLayoutCmd;
0077 std::unique_ptr<G4UIcommand> fSetDimensionsCmd;
0078 std::unique_ptr<G4UIcmdWithAString> fSetStyleCmd;
0079 };
0080
0081
0082 template <typename CMD>
0083 std::unique_ptr<CMD> G4PlotMessenger::CreateCommand(
0084 G4String name, G4String guidance)
0085 {
0086 G4String fullName = "/analysis/plot/" + name;
0087
0088 auto command = std::make_unique<CMD>(fullName, this);
0089 command->SetGuidance(guidance.c_str());
0090 command->AvailableForStates(G4State_PreInit, G4State_Idle);
0091
0092 return command;
0093 }
0094
0095 #endif
0096