Blame view

src/Info/ParamTable.hh 7.98 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);
236cd24c   Hacene SI HADJ MOHAND   working in full v...
70
71
72
73
                
                		void setIsFullVariable(bool isVariable);

		virtual bool isFullVariable(ParameterManager *parameterManager);
f2db3c16   Benjamin Renard   Support variable ...
74
75
76

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

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

e7ea756d   Benjamin Renard   Implements tables...
79
		virtual std::map<std::string, std::string>& getTableParams(ParameterManager *parameterManager);
0051287c   Hacene SI HADJ MOHAND   starting us
80
                
0051287c   Hacene SI HADJ MOHAND   starting us
81
                                        void addTableInfo(ParameterManager *parameterManager, int dim, std::vector<std::pair<std::string,std::string>>& infoMap);
65414a1c   Hacene SI HADJ MOHAND   working for mav
82
                                        
7abf24a0   Hacene SI HADJ MOHAND   correcting bug
83
                                        void  addSemiVariableTableInfo(ParameterManager *parameterManager, int dim, std::string paramId, std::string key, std::vector<std::pair<std::string,std::string>>& infoMap);
79366e37   Hacene SI HADJ MOHAND   trying to add ful...
84
85
                                        
                                        void addRelatedParams(ParameterManager *parameterManager, std::string paramId, std::list<std::string>relatedParams);
f2db3c16   Benjamin Renard   Support variable ...
86

fbe3c2bb   Benjamin Renard   First commit
87
88
89
90
91
92
93
94
95
	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
96
97
                
                                        std::list<std::string> _printedTables;
f2db3c16   Benjamin Renard   Support variable ...
98
99

		bool _variable;
236cd24c   Hacene SI HADJ MOHAND   working in full v...
100
101
                
                                        bool _fullVariable = false; 
f2db3c16   Benjamin Renard   Support variable ...
102
103
104
105
106
107
108

		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...
109
		std::vector<double> getVariableTableParamValuesByKey(ParameterManager *parameterManager, std::map<std::string, std::vector<double>>* paramsTableData, std::string key);
0051287c   Hacene SI HADJ MOHAND   starting us
110
111

                                        virtual void addVariableTableInfo(ParameterManager *parameterManager, int dim, std::vector<std::pair<std::string,std::string>>& infoMap);
fbe3c2bb   Benjamin Renard   First commit
112
113
114
115
116
117
118
119
120
	};

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

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

fbe3c2bb   Benjamin Renard   First commit
125
126
		virtual int getSize(ParameterManager *parameterManager);

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

f2db3c16   Benjamin Renard   Support variable ...
129
		static std::string _boundsParamKey;
fbe3c2bb   Benjamin Renard   First commit
130
131
132
133
134
135
136
137
138
	};

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

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

fbe3c2bb   Benjamin Renard   First commit
143
144
		virtual int getSize(ParameterManager *parameterManager);

f2db3c16   Benjamin Renard   Support variable ...
145
146
147
		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
148
149

	private:
fbe3c2bb   Benjamin Renard   First commit
150
151
152
153
		double _size;
	};

	/**
f5c53312   Benjamin Renard   Get calib info in...
154
155
156
157
158
159
	 * @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 ...
160
		ParamCenterWidthTable(const char *paramId);
f5c53312   Benjamin Renard   Get calib info in...
161

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

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

f2db3c16   Benjamin Renard   Support variable ...
166
		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...
167

f2db3c16   Benjamin Renard   Support variable ...
168
169
		static std::string _centersParamKey;
		static std::string _widthsParamKey;
f5c53312   Benjamin Renard   Get calib info in...
170
171
172
	};

	/**
65c661e8   Benjamin Renard   Table definition ...
173
174
175
176
177
178
	 * @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 ...
179
		ParamCenterAutoTable(const char *paramId, bool log);
65c661e8   Benjamin Renard   Table definition ...
180

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

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

f2db3c16   Benjamin Renard   Support variable ...
185
		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...
186
             
f2db3c16   Benjamin Renard   Support variable ...
187
		static std::string _centersParamKey;
65c661e8   Benjamin Renard   Table definition ...
188
189

	private:
65c661e8   Benjamin Renard   Table definition ...
190
191
192
193
		bool _log;
	};

	/**
fbe3c2bb   Benjamin Renard   First commit
194
195
196
197
198
199
	 * @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 ...
200
			ParamMinMaxTable(const char *paramId);
fbe3c2bb   Benjamin Renard   First commit
201
202
203

			virtual int getSize(ParameterManager *parameterManager);

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

f2db3c16   Benjamin Renard   Support variable ...
206
207
			static std::string _minParamKey;
			static std::string _maxParamKey;
fbe3c2bb   Benjamin Renard   First commit
208
	};
e7ea756d   Benjamin Renard   Implements tables...
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


	/*
         * @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);
236cd24c   Hacene SI HADJ MOHAND   working in full v...
235
236
                        
                                                            virtual bool isFullVariable(ParameterManager *parameterManager);
e7ea756d   Benjamin Renard   Implements tables...
237
238
239
240
241
242
243
244
245
246
247

			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
248
249
250
251
} /* namespace Info */
} /* namespace AMDA */

#endif /* PARAMTABLE_HH_ */