Blame view

src/Info/ParamTable.hh 7.41 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * ParamTable.hh
 *
 *  Created on: 10 oct. 2014
 *  Author: AKKA
 */

#ifndef PARAMTABLE_HH_
#define PARAMTABLE_HH_

#include "ParameterManager.hh"

#include "log4cxx/logger.h"

a133a1e6   Hacene SI HADJ MOHAND   adding other info
15
#define PARAMETER_TABLE        "PARAMETER_TABLE_"
0051287c   Hacene SI HADJ MOHAND   starting us
16
17
18
#define PARAMETER_TABLE_UNITS  "PARAMETER_TABLE_UNITS"
#define PARAMETER_TABLE_MINVAL "PARAMETER_TABLE_MIN_VALUES"
#define PARAMETER_TABLE_MAXVAL "PARAMETER_TABLE_MAX_VALUES"
72d1e9e7   Hacene SI HADJ MOHAND   moitie de l'us
19
#define  VARIABLE_PARAMETER_TABLE  "PARAMETER_TABLE_"
0051287c   Hacene SI HADJ MOHAND   starting us
20

65414a1c   Hacene SI HADJ MOHAND   working for mav
21
22
using namespace log4cxx;

fbe3c2bb   Benjamin Renard   First commit
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
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;

e7ea756d   Benjamin Renard   Implements tables...
51
		virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
3fe8b83d   Benjamin Renard   Get parameter inf...
52

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

		void setParameterLink(ParameterSPtr parameter);

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

fbe3c2bb   Benjamin Renard   First commit
59
60
		void setName(std::string name);

e7ea756d   Benjamin Renard   Implements tables...
61
		virtual std::string getName(ParameterManager *parameterManager);
fbe3c2bb   Benjamin Renard   First commit
62
63
64

		void setUnits(std::string name);

e7ea756d   Benjamin Renard   Implements tables...
65
		virtual std::string getUnits(ParameterManager *parameterManager);
fbe3c2bb   Benjamin Renard   First commit
66

f2db3c16   Benjamin Renard   Support variable ...
67
68
		void setIsVariable(bool isVariable);

e7ea756d   Benjamin Renard   Implements tables...
69
		virtual bool isVariable(ParameterManager *parameterManager);
f2db3c16   Benjamin Renard   Support variable ...
70
71
72

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

e7ea756d   Benjamin Renard   Implements tables...
73
		virtual std::string getTableParamByKey(ParameterManager *parameterManager, std::string key);
f2db3c16   Benjamin Renard   Support variable ...
74

e7ea756d   Benjamin Renard   Implements tables...
75
		virtual std::map<std::string, std::string>& getTableParams(ParameterManager *parameterManager);
0051287c   Hacene SI HADJ MOHAND   starting us
76
                
0051287c   Hacene SI HADJ MOHAND   starting us
77
                                        void addTableInfo(ParameterManager *parameterManager, int dim, std::vector<std::pair<std::string,std::string>>& infoMap);
65414a1c   Hacene SI HADJ MOHAND   working for mav
78
79
                                        
                                        void addSemiVariableTableInfo(ParameterManager *parameterManager, int dim, std::string paramId, std::string key, std::vector<std::pair<std::string,std::string>>& infoMap);
f2db3c16   Benjamin Renard   Support variable ...
80

fbe3c2bb   Benjamin Renard   First commit
81
82
83
84
85
86
87
88
89
	protected:
		/** logger of paramTable */
		static log4cxx::LoggerPtr _logger;

		std::string _paramId;

		std::string _tableName;

		std::string _tableUnits;
b31e7a52   Hacene SI HADJ MOHAND   working with mav_st
90
91
                
                                        std::list<std::string> _printedTables;
f2db3c16   Benjamin Renard   Support variable ...
92
93
94
95
96
97
98
99
100

		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);

e7ea756d   Benjamin Renard   Implements tables...
101
		std::vector<double> getVariableTableParamValuesByKey(ParameterManager *parameterManager, std::map<std::string, std::vector<double>>* paramsTableData, std::string key);
0051287c   Hacene SI HADJ MOHAND   starting us
102
103

                                        virtual void addVariableTableInfo(ParameterManager *parameterManager, int dim, std::vector<std::pair<std::string,std::string>>& infoMap);
fbe3c2bb   Benjamin Renard   First commit
104
105
106
107
108
109
110
111
112
	};

	/**
	 * @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 ...
113
		ParamBoundsTable(const char *paramId);
fbe3c2bb   Benjamin Renard   First commit
114

e7ea756d   Benjamin Renard   Implements tables...
115
		virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
3fe8b83d   Benjamin Renard   Get parameter inf...
116

fbe3c2bb   Benjamin Renard   First commit
117
118
		virtual int getSize(ParameterManager *parameterManager);

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

f2db3c16   Benjamin Renard   Support variable ...
121
		static std::string _boundsParamKey;
fbe3c2bb   Benjamin Renard   First commit
122
123
124
125
126
127
128
129
130
	};

	/**
	 * @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 ...
131
		ParamCenterTable(const char *paramId, double size);
fbe3c2bb   Benjamin Renard   First commit
132

e7ea756d   Benjamin Renard   Implements tables...
133
		virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
3fe8b83d   Benjamin Renard   Get parameter inf...
134

fbe3c2bb   Benjamin Renard   First commit
135
136
		virtual int getSize(ParameterManager *parameterManager);

f2db3c16   Benjamin Renard   Support variable ...
137
138
139
		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
140
141

	private:
fbe3c2bb   Benjamin Renard   First commit
142
143
144
145
		double _size;
	};

	/**
f5c53312   Benjamin Renard   Get calib info in...
146
147
148
149
150
151
	 * @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 ...
152
		ParamCenterWidthTable(const char *paramId);
f5c53312   Benjamin Renard   Get calib info in...
153

e7ea756d   Benjamin Renard   Implements tables...
154
		virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
3fe8b83d   Benjamin Renard   Get parameter inf...
155

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

f2db3c16   Benjamin Renard   Support variable ...
158
		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...
159

f2db3c16   Benjamin Renard   Support variable ...
160
161
		static std::string _centersParamKey;
		static std::string _widthsParamKey;
f5c53312   Benjamin Renard   Get calib info in...
162
163
164
	};

	/**
65c661e8   Benjamin Renard   Table definition ...
165
166
167
168
169
170
	 * @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 ...
171
		ParamCenterAutoTable(const char *paramId, bool log);
65c661e8   Benjamin Renard   Table definition ...
172

e7ea756d   Benjamin Renard   Implements tables...
173
		virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
3fe8b83d   Benjamin Renard   Get parameter inf...
174

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

f2db3c16   Benjamin Renard   Support variable ...
177
		virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
4ff79588   Hacene SI HADJ MOHAND   rm_6616 processin...
178
             
f2db3c16   Benjamin Renard   Support variable ...
179
		static std::string _centersParamKey;
65c661e8   Benjamin Renard   Table definition ...
180
181

	private:
65c661e8   Benjamin Renard   Table definition ...
182
183
184
185
		bool _log;
	};

	/**
fbe3c2bb   Benjamin Renard   First commit
186
187
188
189
190
191
	 * @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 ...
192
			ParamMinMaxTable(const char *paramId);
fbe3c2bb   Benjamin Renard   First commit
193
194
195

			virtual int getSize(ParameterManager *parameterManager);

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

f2db3c16   Benjamin Renard   Support variable ...
198
199
			static std::string _minParamKey;
			static std::string _maxParamKey;
fbe3c2bb   Benjamin Renard   First commit
200
	};
e7ea756d   Benjamin Renard   Implements tables...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237


	/*
         * @class LinkTable
	 * @brief Implementation of a ParamTable that is a link to an existing ParamTable
	 * @details
	 */
	class LinkTable : public ParamTable {
		public:
			LinkTable(const char *paramId, const char* originParamId);

			virtual int getSize(ParameterManager *parameterManager);

			virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);

			void setOriginTableDim(int originTableDim) {
				_originTableDim = originTableDim;
			}

			virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);

			virtual std::string getName(ParameterManager *parameterManager);

			virtual std::string getUnits(ParameterManager *parameterManager);

			virtual bool isVariable(ParameterManager *parameterManager);

			virtual std::map<std::string, std::string>& getTableParams(ParameterManager *parameterManager);

		private:
			std::string _originParamId;
			int _originTableDim;
			std::map<std::string, std::string> _emptyTableParam;

			ParamTable* getOriginParamTable(ParameterManager *parameterManager);
	};

fbe3c2bb   Benjamin Renard   First commit
238
239
240
241
} /* namespace Info */
} /* namespace AMDA */

#endif /* PARAMTABLE_HH_ */