Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:05

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef PHPARAMETER_PHPARAMETERINTERFACE_H
0004 #define PHPARAMETER_PHPARAMETERINTERFACE_H
0005 
0006 #include <map>
0007 #include <string>
0008 
0009 class PHCompositeNode;
0010 class PHParameters;
0011 
0012 class PHParameterInterface
0013 {
0014  public:
0015   PHParameterInterface(const std::string &name);
0016   // PHParameterInterface contains pointer to memory
0017   // copy ctor and = operator need explicit implementation, do just delete it here
0018   PHParameterInterface(const PHParameterInterface &) = delete;
0019   PHParameterInterface &operator=(PHParameterInterface const &) = delete;
0020 
0021   virtual ~PHParameterInterface();
0022 
0023   void set_paramname(const std::string &name);
0024   virtual void SetDefaultParameters() = 0;
0025 
0026   // Get/Set parameters from macro
0027   void set_double_param(const std::string &name, const double dval);
0028   double get_double_param(const std::string &name) const;
0029   void set_int_param(const std::string &name, const int ival);
0030   int get_int_param(const std::string &name) const;
0031   void set_string_param(const std::string &name, const std::string &sval);
0032   std::string get_string_param(const std::string &name) const;
0033 
0034   void UpdateParametersWithMacro();
0035   void SaveToNodeTree(PHCompositeNode *runNode, const std::string &nodename);
0036   void PutOnParNode(PHCompositeNode *parNode, const std::string &nodename);
0037   void Print() const;
0038 
0039  protected:
0040   void set_default_double_param(const std::string &name, const double dval);
0041   void set_default_int_param(const std::string &name, const int ival);
0042   void set_default_string_param(const std::string &name, const std::string &sval);
0043   void InitializeParameters();
0044 
0045  private:
0046   PHParameters *m_Params = nullptr;
0047 
0048   bool m_Locked = false;
0049   std::map<const std::string, double> m_DoubleParMap;
0050   std::map<const std::string, int> m_IntParMap;
0051   std::map<const std::string, std::string> m_StringParMap;
0052 
0053   std::map<const std::string, double> m_DefaultDoubleParMap;
0054   std::map<const std::string, int> m_DefaultIntParMap;
0055   std::map<const std::string, std::string> m_DefaultStringParMap;
0056 };
0057 
0058 #endif  // PHPARAMETER_PHPARAMETERINTERFACE_H