Back to home page

sPhenix code displayed by LXR

 
 

    


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

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