forked from sPHENIX-Collaboration/coresoftware
/
PHParameterInterface.h
54 lines (43 loc) · 1.9 KB
/
PHParameterInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Tell emacs that this is a C++ source
// -*- C++ -*-.
#ifndef PHPARAMETER_PHPARAMETERINTERFACE_H
#define PHPARAMETER_PHPARAMETERINTERFACE_H
#include <map>
#include <string>
class PHCompositeNode;
class PHParameters;
class PHParameterInterface
{
public:
PHParameterInterface(const std::string &name);
// PHParameterInterface contains pointer to memory
// copy ctor needs explicit implementation, do just delete it here
PHParameterInterface(const PHParameterInterface &) = delete;
virtual ~PHParameterInterface() {}
void set_paramname(const std::string &name);
virtual void SetDefaultParameters() = 0;
// Get/Set parameters from macro
void set_double_param(const std::string &name, const double dval);
double get_double_param(const std::string &name) const;
void set_int_param(const std::string &name, const int ival);
int get_int_param(const std::string &name) const;
void set_string_param(const std::string &name, const std::string &sval);
std::string get_string_param(const std::string &name) const;
void UpdateParametersWithMacro();
void SaveToNodeTree(PHCompositeNode *runNode, const std::string &nodename);
void PutOnParNode(PHCompositeNode *parNode, const std::string &nodename);
protected:
void set_default_double_param(const std::string &name, const double dval);
void set_default_int_param(const std::string &name, const int ival);
void set_default_string_param(const std::string &name, const std::string &sval);
void InitializeParameters();
private:
PHParameters *m_Params = nullptr;
std::map<const std::string, double> m_DoubleParMap;
std::map<const std::string, int> m_IntParMap;
std::map<const std::string, std::string> m_StringParMap;
std::map<const std::string, double> m_DefaultDoubleParMap;
std::map<const std::string, int> m_DefaultIntParMap;
std::map<const std::string, std::string> m_DefaultStringParMap;
};
#endif // PHPARAMETER_PHPARAMETERINTERFACE_H