Blame view

src/Info/ParamTable.hh 4.89 KB
fbe3c2bb   Benjamin Renard   First commit
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
/**
 * ParamTable.hh
 *
 *  Created on: 10 oct. 2014
 *  Author: AKKA
 */

#ifndef PARAMTABLE_HH_
#define PARAMTABLE_HH_

#include "ParameterManager.hh"

#include "log4cxx/logger.h"

namespace AMDA {
namespace Info {

	using namespace AMDA::Parameters;

	/**
	 * @brief Structure that's define a table bound
	 */
	typedef struct {
		int index;
		double min;
		double max;
	} t_TableBound;

	/**
	 * @class ParamTable
	 * @brief Abstract class used to define a Parameter table .
	 * @details
	 */
	class ParamTable
	{
	public:
		ParamTable(const char *paramId);

		virtual ~ParamTable();

		virtual int getSize(ParameterManager *parameterManager) = 0;

3fe8b83d   Benjamin Renard   Get parameter inf...
43
44
		virtual std::string getTableParamKeyForInfo();

f2db3c16   Benjamin Renard   Support variable ...
45
		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL) = 0;
fbe3c2bb   Benjamin Renard   First commit
46
47
48

		void setParameterLink(ParameterSPtr parameter);

7f7e3b39   Benjamin Renard   Fix a bug with st...
49
50
		std::string getParamId(void);

fbe3c2bb   Benjamin Renard   First commit
51
52
53
54
55
56
57
58
		void setName(std::string name);

		std::string getName(void);

		void setUnits(std::string name);

		std::string getUnits(void);

f2db3c16   Benjamin Renard   Support variable ...
59
60
61
62
63
64
65
66
67
68
		void setIsVariable(bool isVariable);

		bool isVariable(void);

		void addTableParam(std::string key, std::string name);

		std::string getTableParamByKey(std::string key);

		std::map<std::string, std::string>& getTableParams();

fbe3c2bb   Benjamin Renard   First commit
69
70
71
72
73
74
75
76
77
	protected:
		/** logger of paramTable */
		static log4cxx::LoggerPtr _logger;

		std::string _paramId;

		std::string _tableName;

		std::string _tableUnits;
f2db3c16   Benjamin Renard   Support variable ...
78
79
80
81
82
83
84
85
86
87

		bool _variable;

		std::map<std::string, std::string> _tableParams;

		std::vector<double> getTableParamValuesByKey(ParameterManager *parameterManager, std::map<std::string, std::vector<double>>* paramsTableData, std::string key);

		std::vector<double> getConstantTableParamValuesByKey(ParameterManager *parameterManager, std::string key);

		std::vector<double> getVariableTableParamValuesByKey(std::map<std::string, std::vector<double>>* paramsTableData, std::string key);
fbe3c2bb   Benjamin Renard   First commit
88
89
90
91
92
93
94
95
96
	};

	/**
	 * @class ParamBoundsTable
	 * @brief Implementation of a ParamTable for a table defined by a list
	 * @details
	 */
	class ParamBoundsTable : public ParamTable {
	public:
f2db3c16   Benjamin Renard   Support variable ...
97
		ParamBoundsTable(const char *paramId);
fbe3c2bb   Benjamin Renard   First commit
98

3fe8b83d   Benjamin Renard   Get parameter inf...
99
100
		virtual std::string getTableParamKeyForInfo();

fbe3c2bb   Benjamin Renard   First commit
101
102
		virtual int getSize(ParameterManager *parameterManager);

f2db3c16   Benjamin Renard   Support variable ...
103
		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
fbe3c2bb   Benjamin Renard   First commit
104

f2db3c16   Benjamin Renard   Support variable ...
105
		static std::string _boundsParamKey;
fbe3c2bb   Benjamin Renard   First commit
106
107
108
109
110
111
112
113
114
	};

	/**
	 * @class ParamCenterTable
	 * @brief Implementation of a ParamTable for a table defined by a list of center value and a size
	 * @details
	 */
	class ParamCenterTable : public ParamTable {
	public:
f2db3c16   Benjamin Renard   Support variable ...
115
		ParamCenterTable(const char *paramId, double size);
fbe3c2bb   Benjamin Renard   First commit
116

3fe8b83d   Benjamin Renard   Get parameter inf...
117
118
		virtual std::string getTableParamKeyForInfo();

fbe3c2bb   Benjamin Renard   First commit
119
120
		virtual int getSize(ParameterManager *parameterManager);

f2db3c16   Benjamin Renard   Support variable ...
121
122
123
		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);

		static std::string _centersParamKey;
fbe3c2bb   Benjamin Renard   First commit
124
125

	private:
fbe3c2bb   Benjamin Renard   First commit
126
127
128
129
		double _size;
	};

	/**
f5c53312   Benjamin Renard   Get calib info in...
130
131
132
133
134
135
	 * @class ParamCenterWidthTable
	 * @brief Implementation of a ParamTable for a table defined by a list of center value and a list of band width
	 * @details
	 */
	class ParamCenterWidthTable : public ParamTable {
	public:
f2db3c16   Benjamin Renard   Support variable ...
136
		ParamCenterWidthTable(const char *paramId);
f5c53312   Benjamin Renard   Get calib info in...
137

3fe8b83d   Benjamin Renard   Get parameter inf...
138
139
		virtual std::string getTableParamKeyForInfo();

f5c53312   Benjamin Renard   Get calib info in...
140
141
		virtual int getSize(ParameterManager *parameterManager);

f2db3c16   Benjamin Renard   Support variable ...
142
		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
f5c53312   Benjamin Renard   Get calib info in...
143

f2db3c16   Benjamin Renard   Support variable ...
144
145
		static std::string _centersParamKey;
		static std::string _widthsParamKey;
f5c53312   Benjamin Renard   Get calib info in...
146
147
148
	};

	/**
65c661e8   Benjamin Renard   Table definition ...
149
150
151
152
153
154
	 * @class ParamCenterAutoTable
	 * @brief Implementation of a ParamTable for a table defined by a list of center value. Bounds automatically computed to be at the center of two consecutive channels
	 * @details
	 */
	class ParamCenterAutoTable : public ParamTable {
	public:
f2db3c16   Benjamin Renard   Support variable ...
155
		ParamCenterAutoTable(const char *paramId, bool log);
65c661e8   Benjamin Renard   Table definition ...
156

3fe8b83d   Benjamin Renard   Get parameter inf...
157
158
		virtual std::string getTableParamKeyForInfo();

65c661e8   Benjamin Renard   Table definition ...
159
160
		virtual int getSize(ParameterManager *parameterManager);

f2db3c16   Benjamin Renard   Support variable ...
161
162
163
		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);

		static std::string _centersParamKey;
65c661e8   Benjamin Renard   Table definition ...
164
165

	private:
65c661e8   Benjamin Renard   Table definition ...
166
167
168
169
		bool _log;
	};

	/**
fbe3c2bb   Benjamin Renard   First commit
170
171
172
173
174
175
	 * @class ParamMinMaxTable
	 * @brief Implementation of a ParamTable for a table defined by two list: one for min and one for max
	 * @details
	 */
	class ParamMinMaxTable : public ParamTable {
		public:
f2db3c16   Benjamin Renard   Support variable ...
176
			ParamMinMaxTable(const char *paramId);
fbe3c2bb   Benjamin Renard   First commit
177
178
179

			virtual int getSize(ParameterManager *parameterManager);

f2db3c16   Benjamin Renard   Support variable ...
180
			virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
fbe3c2bb   Benjamin Renard   First commit
181

f2db3c16   Benjamin Renard   Support variable ...
182
183
			static std::string _minParamKey;
			static std::string _maxParamKey;
fbe3c2bb   Benjamin Renard   First commit
184
185
186
187
188
	};
} /* namespace Info */
} /* namespace AMDA */

#endif /* PARAMTABLE_HH_ */