ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHParameterInterface.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHParameterInterface.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef PHPARAMETER_PHPARAMETERINTERFACE_H
4 #define PHPARAMETER_PHPARAMETERINTERFACE_H
5 
6 #include <map>
7 #include <string>
8 
9 class PHCompositeNode;
10 class PHParameters;
11 
13 {
14  public:
15  PHParameterInterface(const std::string &name);
16  // PHParameterInterface contains pointer to memory
17  // copy ctor needs explicit implementation, do just delete it here
19 
20  virtual ~PHParameterInterface() {}
21 
22  void set_paramname(const std::string &name);
23  virtual void SetDefaultParameters() = 0;
24 
25  // Get/Set parameters from macro
26  void set_double_param(const std::string &name, const double dval);
27  double get_double_param(const std::string &name) const;
28  void set_int_param(const std::string &name, const int ival);
29  int get_int_param(const std::string &name) const;
30  void set_string_param(const std::string &name, const std::string &sval);
31  std::string get_string_param(const std::string &name) const;
32 
34  void SaveToNodeTree(PHCompositeNode *runNode, const std::string &nodename);
35  void PutOnParNode(PHCompositeNode *parNode, const std::string &nodename);
36 
37  protected:
38  void set_default_double_param(const std::string &name, const double dval);
39  void set_default_int_param(const std::string &name, const int ival);
40  void set_default_string_param(const std::string &name, const std::string &sval);
41  void InitializeParameters();
42 
43  private:
44  PHParameters *m_Params = nullptr;
45  std::map<const std::string, double> m_DoubleParMap;
46  std::map<const std::string, int> m_IntParMap;
47  std::map<const std::string, std::string> m_StringParMap;
48 
49  std::map<const std::string, double> m_DefaultDoubleParMap;
50  std::map<const std::string, int> m_DefaultIntParMap;
51  std::map<const std::string, std::string> m_DefaultStringParMap;
52 };
53 
54 #endif // PHPARAMETER_PHPARAMETERINTERFACE_H