ParamTable.hh
10.4 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
/**
* ParamTable.hh
*
* Created on: 10 oct. 2014
* Author: AKKA
*/
#ifndef PARAMTABLE_HH_
#define PARAMTABLE_HH_
#include "ParameterManager.hh"
#include "log4cxx/logger.h"
#define PARAMETER_TABLE "PARAMETER_TABLE_"
#define PARAMETER_TABLE_UNITS "PARAMETER_TABLE_UNITS"
#define PARAMETER_TABLE_MINVAL "PARAMETER_TABLE_MIN_VALUES"
#define PARAMETER_TABLE_MAXVAL "PARAMETER_TABLE_MAX_VALUES"
#define VARIABLE_PARAMETER_TABLE "PARAMETER_TABLE_"
using namespace log4cxx;
namespace AMDA {
namespace Info {
using namespace AMDA::Parameters;
/**
* @brief Structure that's define a table bound
*/
typedef struct {
int index;
double min;
double max;
double center;
} t_TableBound;
/**
* @class ParamTable
* @brief Abstract class used to define a Parameter table .
* @details
*/
class ParamTable {
public:
ParamTable(const char *paramId, int dim);
virtual ~ParamTable();
virtual int getSize(ParameterManager *parameterManager) = 0;
virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>*paramsTableData = NULL) = 0;
void setParameterLink(ParameterSPtr parameter);
std::string getParamId(void);
int getDim(void);
void setName(std::string name);
virtual std::string getName(ParameterManager *parameterManager);
void setUnits(std::string name);
virtual std::string getUnits(ParameterManager *parameterManager);
void setIsVariable(bool isVariable);
virtual bool isVariable(ParameterManager *parameterManager);
void setIsFullVariable(bool isVariable);
virtual bool isFullVariable(ParameterManager *parameterManager);
void addTableParam(std::string key, std::string name);
virtual std::string getTableParamByKey(ParameterManager *parameterManager, std::string key);
virtual std::map<std::string, std::string>& getTableParams(ParameterManager *parameterManager);
void addTableInfo(ParameterManager *parameterManager, int dim, std::vector<std::pair<std::string, std::string>>&infoMap);
void addSemiVariableTableInfo(ParameterManager *parameterManager, int dim, std::string paramId, std::string key, std::vector<std::pair<std::string, std::string>>&infoMap);
void addRelatedParams(ParameterManager *parameterManager, std::string paramId, std::list<std::string>relatedParams);
bool isInvertedOrder(ParameterManager *parameterManager);
ParameterSPtr createRelatedParameter(ParameterManager *parameterManager);
protected:
/** logger of paramTable */
static log4cxx::LoggerPtr _logger;
std::string _paramId;
int _dim;
std::string _tableName;
std::string _tableUnits;
std::list<std::string> _printedTables;
bool _variable;
bool _fullVariable = false;
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(ParameterManager *parameterManager, std::map<std::string, std::vector<double>>*paramsTableData, std::string key);
virtual void addVariableTableInfo(ParameterManager *parameterManager, int dim, std::vector<std::pair<std::string, std::string>>&infoMap);
};
/**
* @class ParamBoundsTable
* @brief Implementation of a ParamTable for a table defined by a list
* @details
*/
class ParamBoundsTable : public ParamTable {
public:
ParamBoundsTable(const char *paramId, int dim);
virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
virtual int getSize(ParameterManager *parameterManager);
virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>*paramsTableData = NULL);
static std::string _boundsParamKey;
};
/**
* @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:
ParamCenterTable(const char *paramId, int dim, double size);
virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
virtual int getSize(ParameterManager *parameterManager);
virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>*paramsTableData = NULL);
static std::string _centersParamKey;
private:
double _size;
};
/**
* @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:
ParamCenterWidthTable(const char *paramId, int dim);
virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
virtual int getSize(ParameterManager *parameterManager);
virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>*paramsTableData = NULL);
static std::string _centersParamKey;
static std::string _widthsParamKey;
};
/**
* @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:
ParamCenterAutoTable(const char *paramId, int dim, bool log);
virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
virtual int getSize(ParameterManager *parameterManager);
virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>*paramsTableData = NULL);
static std::string _centersParamKey;
private:
bool _log;
};
class EmbeddedCenterTable : public ParamTable {
public:
EmbeddedCenterTable(const char *paramId, int dim, std::vector<double> & centersValues, bool logMode = false);
virtual std::string getTableParamKeyForInfo(ParameterManager *parameterManager);
virtual int getSize(ParameterManager *parameterManager);
virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>*paramsTableData = NULL);
static std::string _paramKey;
std::vector<double> _centersValues;
private:
bool _log;
};
/**
* @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:
ParamMinMaxTable(const char *paramId, int dim);
virtual int getSize(ParameterManager *parameterManager);
virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>*paramsTableData = NULL);
static std::string _minParamKey;
static std::string _maxParamKey;
};
/*
* @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, int dim, 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 bool isFullVariable(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);
};
/**
* @class RangeTable
* @brief Implementation of a ParamTable for a table defined by min, max and step
* @details
*/
class RangeTable : public ParamTable {
public:
RangeTable(const char *paramId, int dim, double min, double max, double step);
virtual int getSize(ParameterManager *parameterManager);
virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>*paramsTableData = NULL);
private:
double _min;
double _max;
double _step;
};
} /* namespace Info */
} /* namespace AMDA */
#endif /* PARAMTABLE_HH_ */