File indexing completed on 2025-01-18 09:55:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef DDG4_GEANT4UIMESSENGER_H
0015 #define DDG4_GEANT4UIMESSENGER_H
0016
0017
0018 #include <DD4hep/ComponentProperties.h>
0019 #include <DD4hep/Callback.h>
0020 #include <G4UImessenger.hh>
0021 #include <G4UIdirectory.hh>
0022
0023
0024 namespace dd4hep {
0025
0026
0027 namespace sim {
0028
0029
0030
0031
0032
0033
0034
0035 class Geant4UIMessenger: public G4UImessenger {
0036 public:
0037 typedef std::map<G4UIcommand*, std::string> Commands;
0038 typedef std::map<G4UIcommand*, Callback> Actions;
0039 protected:
0040
0041 G4UIdirectory* m_directory;
0042
0043 PropertyManager* m_properties;
0044
0045 std::string m_name;
0046
0047 std::string m_path;
0048
0049 Commands m_propertyCmd;
0050
0051 Actions m_actionCmd;
0052
0053 public:
0054
0055 Geant4UIMessenger(const std::string& name, const std::string& path);
0056
0057 virtual ~Geant4UIMessenger();
0058
0059 void addCall(const std::string& name, const std::string& description, const Callback& cb, size_t npar=0);
0060
0061 template <typename Q, typename R, typename T>
0062 void addCall(const std::string& name, const std::string& description, Q* p, R (T::*f)()) {
0063 CallbackSequence::checkTypes(typeid(Q), typeid(T), dynamic_cast<T*>(p));
0064 addCall(name, description, Callback(p).make(f), 0);
0065 }
0066
0067 template <typename Q, typename R, typename T, typename A1>
0068 void addCall(const std::string& name, const std::string& description, Q* p, R (T::*f)(A1)) {
0069 CallbackSequence::checkTypes(typeid(Q), typeid(T), dynamic_cast<T*>(p));
0070 addCall(name, description, Callback(p).make(f), 1);
0071 }
0072
0073 void exportProperties(PropertyManager& mgr);
0074
0075 void SetNewValue(G4UIcommand *c, G4String val);
0076
0077 G4String GetCurrentValue(G4UIcommand *c);
0078 };
0079
0080 }
0081 }
0082
0083 #endif