Commit 9f0d52de3854971945eb00a99af601b89555d42e
1 parent
7014a201
Exists in
9084
First test
Showing
4 changed files
with
77 additions
and
9 deletions
Show diff stats
src/InternLib/ProcessStandard.cc
@@ -35,6 +35,7 @@ | @@ -35,6 +35,7 @@ | ||
35 | #include "ServicesServer.hh" | 35 | #include "ServicesServer.hh" |
36 | #include "DataWriter.hh" | 36 | #include "DataWriter.hh" |
37 | #include "ParameterManager.hh" | 37 | #include "ParameterManager.hh" |
38 | +#include "ParamMgr.hh" | ||
38 | 39 | ||
39 | #include "ProcessStandard.hh" | 40 | #include "ProcessStandard.hh" |
40 | 41 | ||
@@ -57,7 +58,7 @@ ProcessStandard::ProcessStandard(Parameter & parameter) : | @@ -57,7 +58,7 @@ ProcessStandard::ProcessStandard(Parameter & parameter) : | ||
57 | _accesDirect(false), | 58 | _accesDirect(false), |
58 | _alreadyParsed(false), | 59 | _alreadyParsed(false), |
59 | _propertiesList("app.properties"), | 60 | _propertiesList("app.properties"), |
60 | - _timeOfSoFile(0) { | 61 | + _timeOfSoFile(0), _fillValue(NAN) { |
61 | _servicesServer = ServicesServer::getInstance(); | 62 | _servicesServer = ServicesServer::getInstance(); |
62 | } | 63 | } |
63 | 64 | ||
@@ -73,7 +74,7 @@ ProcessStandard::ProcessStandard(const ProcessStandard & pProcess, Parameter &pa | @@ -73,7 +74,7 @@ ProcessStandard::ProcessStandard(const ProcessStandard & pProcess, Parameter &pa | ||
73 | _accesDirect(pProcess._accesDirect), | 74 | _accesDirect(pProcess._accesDirect), |
74 | _alreadyParsed(pProcess._alreadyParsed), | 75 | _alreadyParsed(pProcess._alreadyParsed), |
75 | _propertiesList(pProcess._propertiesList), | 76 | _propertiesList(pProcess._propertiesList), |
76 | - _timeOfSoFile(pProcess._timeOfSoFile) { | 77 | + _timeOfSoFile(pProcess._timeOfSoFile), _fillValue(pProcess._fillValue) { |
77 | _servicesServer = ServicesServer::getInstance(); | 78 | _servicesServer = ServicesServer::getInstance(); |
78 | establishConnection(); | 79 | establishConnection(); |
79 | } | 80 | } |
@@ -327,6 +328,7 @@ bool ProcessStandard::mustGenerated(TimeStamp timeDepend) { | @@ -327,6 +328,7 @@ bool ProcessStandard::mustGenerated(TimeStamp timeDepend) { | ||
327 | 328 | ||
328 | //Wirte methode | 329 | //Wirte methode |
329 | fileC << "void write(AMDA::Parameters::ParamDataIndexInfo &pParamDataIndexInfo) {" << endl; | 330 | fileC << "void write(AMDA::Parameters::ParamDataIndexInfo &pParamDataIndexInfo) {" << endl; |
331 | + fileC << " _paramOutput->setFillValue(_processStandard.getFillValue());" << endl; | ||
330 | fileC << " for (unsigned int index = pParamDataIndexInfo._startIndex; index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; ++index) {" << endl; | 332 | fileC << " for (unsigned int index = pParamDataIndexInfo._startIndex; index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; ++index) {" << endl; |
331 | fileC << " _paramOutput->pushTime(_processStandard.getParameterList().begin()->second.first->getParamData(&_process)->getTime(index));" << endl; | 333 | fileC << " _paramOutput->pushTime(_processStandard.getParameterList().begin()->second.first->getParamData(&_process)->getTime(index));" << endl; |
332 | fileC << " _paramOutput->push("<< _parser.getFormulaCc() <<");"; fileC << endl; | 334 | fileC << " _paramOutput->push("<< _parser.getFormulaCc() <<");"; fileC << endl; |
@@ -461,5 +463,24 @@ void ProcessStandard::closeDynamicLib() { | @@ -461,5 +463,24 @@ void ProcessStandard::closeDynamicLib() { | ||
461 | 463 | ||
462 | } | 464 | } |
463 | 465 | ||
466 | +/** | ||
467 | + * @brief update parameter info in relation to the process | ||
468 | + */ | ||
469 | +void ProcessStandard::updateInfo(Parameter & parameter) | ||
470 | +{ | ||
471 | + LOG4CXX_DEBUG(_logger, "ProcessStandard::updateInfo - " << parameter.getId()); | ||
472 | + | ||
473 | + if (parameter.getInfoId().empty()) | ||
474 | + parameter.setInfoId(parameter.getId()); | ||
475 | + | ||
476 | + //Param info | ||
477 | + AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(parameter.getInfoId(),true); | ||
478 | + | ||
479 | + if (paramInfo == nullptr) | ||
480 | + return; | ||
481 | + | ||
482 | + this->_fillValue = paramInfo->getOriginalFillValue(); | ||
483 | +} | ||
484 | + | ||
464 | } /* namespace Parameters */ | 485 | } /* namespace Parameters */ |
465 | } /* namespace AMDA */ | 486 | } /* namespace AMDA */ |
src/InternLib/ProcessStandard.hh
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | #include "MultiParamProcess.hh" | 25 | #include "MultiParamProcess.hh" |
26 | #include "Parser.hh" | 26 | #include "Parser.hh" |
27 | 27 | ||
28 | -#define PROCESS_STANDARD_COMPIL_VERSION 5 | 28 | +#define PROCESS_STANDARD_COMPIL_VERSION 6 |
29 | 29 | ||
30 | namespace AMDA { | 30 | namespace AMDA { |
31 | namespace Parameters { | 31 | namespace Parameters { |
@@ -73,6 +73,15 @@ public: | @@ -73,6 +73,15 @@ public: | ||
73 | 73 | ||
74 | virtual void establishConnection(); | 74 | virtual void establishConnection(); |
75 | 75 | ||
76 | + /** | ||
77 | + * @overload DataWriter::updateInfo - update parameter info in relation to the process | ||
78 | + */ | ||
79 | + virtual void updateInfo(Parameter & parameter); | ||
80 | + | ||
81 | + double getFillValue() { | ||
82 | + return _fillValue; | ||
83 | + } | ||
84 | + | ||
76 | protected: | 85 | protected: |
77 | /** | 86 | /** |
78 | * get paramName and fctName of expression | 87 | * get paramName and fctName of expression |
@@ -132,6 +141,8 @@ protected: | @@ -132,6 +141,8 @@ protected: | ||
132 | * @details give by mkdtemp(_propertiesList["app.process.src"]/XXXXXX); | 141 | * @details give by mkdtemp(_propertiesList["app.process.src"]/XXXXXX); |
133 | */ | 142 | */ |
134 | std::string _workingDiretory ; | 143 | std::string _workingDiretory ; |
144 | + | ||
145 | + double _fillValue; | ||
135 | }; | 146 | }; |
136 | 147 | ||
137 | } /* namespace Parameters */ | 148 | } /* namespace Parameters */ |
src/Parameters/ParamData.cc
@@ -18,7 +18,7 @@ namespace Parameters { | @@ -18,7 +18,7 @@ namespace Parameters { | ||
18 | 18 | ||
19 | LoggerPtr ParamData::_logger(Logger::getLogger("AMDA-Kernel.ParamData")); | 19 | LoggerPtr ParamData::_logger(Logger::getLogger("AMDA-Kernel.ParamData")); |
20 | 20 | ||
21 | -ParamData::ParamData() : _minSampling(0.0) { | 21 | +ParamData::ParamData() : _minSampling(0.0), _fillValue(NAN) { |
22 | } | 22 | } |
23 | 23 | ||
24 | ParamData::~ParamData() { | 24 | ParamData::~ParamData() { |
@@ -29,6 +29,8 @@ ParamData::~ParamData() { | @@ -29,6 +29,8 @@ ParamData::~ParamData() { | ||
29 | } /* namespace AMDA */ | 29 | } /* namespace AMDA */ |
30 | 30 | ||
31 | 31 | ||
32 | + | ||
33 | + | ||
32 | const NotANumber notANumber; | 34 | const NotANumber notANumber; |
33 | const ElemNull elemNull; | 35 | const ElemNull elemNull; |
34 | 36 | ||
@@ -37,6 +39,9 @@ a = (type)val;\ | @@ -37,6 +39,9 @@ a = (type)val;\ | ||
37 | }\ | 39 | }\ |
38 | void operator <<(type &a, ElemNull /*b*/) {\ | 40 | void operator <<(type &a, ElemNull /*b*/) {\ |
39 | a = (type)0;\ | 41 | a = (type)0;\ |
42 | +}\ | ||
43 | +void applyFillValue(type &a, double fillVal) {\ | ||
44 | +if (a==fillVal) a << NotANumber();\ | ||
40 | } | 45 | } |
41 | 46 | ||
42 | GENARATED_SCALAIRE_IMPL(short, SHRT_MIN) | 47 | GENARATED_SCALAIRE_IMPL(short, SHRT_MIN) |
@@ -55,6 +60,11 @@ void operator <<(std::vector<type> &a, ElemNull /*b*/) {\ | @@ -55,6 +60,11 @@ void operator <<(std::vector<type> &a, ElemNull /*b*/) {\ | ||
55 | for(std::vector<type>::iterator it = a.begin(); it != a.end(); ++it) {\ | 60 | for(std::vector<type>::iterator it = a.begin(); it != a.end(); ++it) {\ |
56 | *it = (type)0;\ | 61 | *it = (type)0;\ |
57 | }\ | 62 | }\ |
63 | +}\ | ||
64 | +void applyFillValue(std::vector<type> &a, double fillVal) {\ | ||
65 | +for(std::vector<type>::iterator it = a.begin(); it != a.end(); ++it) {\ | ||
66 | +if (*it==fillVal) (*it) << NotANumber();\ | ||
67 | +}\ | ||
58 | } | 68 | } |
59 | 69 | ||
60 | GENARATED_VECTOR_IMPL(short,SHRT_MIN) | 70 | GENARATED_VECTOR_IMPL(short,SHRT_MIN) |
@@ -77,6 +87,13 @@ for(int i = 0; i < a.getDim1Size(); ++i) {\ | @@ -77,6 +87,13 @@ for(int i = 0; i < a.getDim1Size(); ++i) {\ | ||
77 | a[i][j] = (type)0;\ | 87 | a[i][j] = (type)0;\ |
78 | }\ | 88 | }\ |
79 | }\ | 89 | }\ |
90 | +}\ | ||
91 | +void applyFillValue(AMDA::Parameters::Tab2DData<type> &a, double fillVal) {\ | ||
92 | +for(int i = 0; i < a.getDim1Size(); ++i) {\ | ||
93 | + for(int j = 0; j < a.getDim2Size(); ++j) {\ | ||
94 | + if (a[i][j] == fillVal) a[i][j] << NotANumber();\ | ||
95 | + }\ | ||
96 | +}\ | ||
80 | } | 97 | } |
81 | 98 | ||
82 | GENARATED_TAB2D_IMPL(short,SHRT_MIN) | 99 | GENARATED_TAB2D_IMPL(short,SHRT_MIN) |
src/Parameters/ParamData.hh
@@ -102,6 +102,8 @@ public: | @@ -102,6 +102,8 @@ public: | ||
102 | 102 | ||
103 | unsigned int getDataNumber() { return _blockTimeTab.size(); } | 103 | unsigned int getDataNumber() { return _blockTimeTab.size(); } |
104 | 104 | ||
105 | + void setFillValue(double fillValue) { _fillValue = fillValue; } | ||
106 | + | ||
105 | protected: | 107 | protected: |
106 | 108 | ||
107 | /** logger of paramData */ | 109 | /** logger of paramData */ |
@@ -111,6 +113,9 @@ protected: | @@ -111,6 +113,9 @@ protected: | ||
111 | */ | 113 | */ |
112 | double _minSampling; | 114 | double _minSampling; |
113 | 115 | ||
116 | + | ||
117 | + double _fillValue; | ||
118 | + | ||
114 | private: | 119 | private: |
115 | 120 | ||
116 | 121 | ||
@@ -133,7 +138,7 @@ public: | @@ -133,7 +138,7 @@ public: | ||
133 | typedef ElType ElementType ; | 138 | typedef ElType ElementType ; |
134 | typedef ClassName ParamType ; | 139 | typedef ClassName ParamType ; |
135 | 140 | ||
136 | - ParamDataSpec_CRTP(int dim1=1, int dim2=2) : _dim1(dim1), _dim2(dim2){} | 141 | + ParamDataSpec_CRTP(int dim1=1, int dim2=2) : _dim1(dim1), _dim2(dim2) {} |
137 | ~ParamDataSpec_CRTP() {} | 142 | ~ParamDataSpec_CRTP() {} |
138 | 143 | ||
139 | typedef Container<ElementType> DataList; | 144 | typedef Container<ElementType> DataList; |
@@ -143,7 +148,8 @@ public: | @@ -143,7 +148,8 @@ public: | ||
143 | const DataList& getDataList() const { return _dataList; } | 148 | const DataList& getDataList() const { return _dataList; } |
144 | double getMinSampling(){ return _minSampling;} | 149 | double getMinSampling(){ return _minSampling;} |
145 | 150 | ||
146 | - void push(ElementType el) { _dataList.push_back(el); } | 151 | + void push(ElementType el) ; |
152 | + | ||
147 | 153 | ||
148 | virtual unsigned int getDim1() { return _dim1; } | 154 | virtual unsigned int getDim1() { return _dim1; } |
149 | virtual unsigned int getDim2() { return _dim2; } | 155 | virtual unsigned int getDim2() { return _dim2; } |
@@ -175,6 +181,8 @@ public: | @@ -175,6 +181,8 @@ public: | ||
175 | val << NotANumber(); | 181 | val << NotANumber(); |
176 | _dataList.replace(val,index); | 182 | _dataList.replace(val,index); |
177 | } | 183 | } |
184 | + | ||
185 | + | ||
178 | 186 | ||
179 | private: | 187 | private: |
180 | template<typename Type> | 188 | template<typename Type> |
@@ -202,6 +210,7 @@ private: | @@ -202,6 +210,7 @@ private: | ||
202 | 210 | ||
203 | unsigned int _dim1; | 211 | unsigned int _dim1; |
204 | unsigned int _dim2; | 212 | unsigned int _dim2; |
213 | + | ||
205 | 214 | ||
206 | }; | 215 | }; |
207 | 216 | ||
@@ -243,7 +252,8 @@ extern const ElemNull elemNull; | @@ -243,7 +252,8 @@ extern const ElemNull elemNull; | ||
243 | 252 | ||
244 | #define GENARATED_SCALAIRE(type, val) \ | 253 | #define GENARATED_SCALAIRE(type, val) \ |
245 | void operator <<(type &a, NotANumber b) ; \ | 254 | void operator <<(type &a, NotANumber b) ; \ |
246 | - void operator <<(type &a, ElemNull b) ; | 255 | + void operator <<(type &a, ElemNull b) ; \ |
256 | + void applyFillValue(type &a, double fillVal) ; | ||
247 | 257 | ||
248 | GENARATED_SCALAIRE(short, SHRT_MIN) | 258 | GENARATED_SCALAIRE(short, SHRT_MIN) |
249 | GENARATED_SCALAIRE(float, NAN) | 259 | GENARATED_SCALAIRE(float, NAN) |
@@ -254,7 +264,8 @@ GENARATED_SCALAIRE(AMDA::Parameters::LogicalData, AMDA::Parameters::LogicalData: | @@ -254,7 +264,8 @@ GENARATED_SCALAIRE(AMDA::Parameters::LogicalData, AMDA::Parameters::LogicalData: | ||
254 | 264 | ||
255 | #define GENARATED_VECTOR(type, val) \ | 265 | #define GENARATED_VECTOR(type, val) \ |
256 | void operator <<(std::vector<type> &a, NotANumber b); \ | 266 | void operator <<(std::vector<type> &a, NotANumber b); \ |
257 | - void operator <<(std::vector<type> &a, ElemNull b); | 267 | + void operator <<(std::vector<type> &a, ElemNull b); \ |
268 | + void applyFillValue(std::vector<type> &a, double fillVal); | ||
258 | 269 | ||
259 | GENARATED_VECTOR(short,SHRT_MIN) | 270 | GENARATED_VECTOR(short,SHRT_MIN) |
260 | GENARATED_VECTOR(float, NAN) | 271 | GENARATED_VECTOR(float, NAN) |
@@ -265,7 +276,8 @@ GENARATED_VECTOR(AMDA::Parameters::LogicalData, AMDA::Parameters::LogicalData::N | @@ -265,7 +276,8 @@ GENARATED_VECTOR(AMDA::Parameters::LogicalData, AMDA::Parameters::LogicalData::N | ||
265 | 276 | ||
266 | #define GENARATED_TAB2D(type, val) \ | 277 | #define GENARATED_TAB2D(type, val) \ |
267 | void operator <<(AMDA::Parameters::Tab2DData<type> &a, NotANumber b); \ | 278 | void operator <<(AMDA::Parameters::Tab2DData<type> &a, NotANumber b); \ |
268 | - void operator <<(AMDA::Parameters::Tab2DData<type> &a, ElemNull b); | 279 | + void operator <<(AMDA::Parameters::Tab2DData<type> &a, ElemNull b); \ |
280 | + void applyFillValue(AMDA::Parameters::Tab2DData<type> &a, double fillVal); | ||
269 | 281 | ||
270 | GENARATED_TAB2D(short,SHRT_MIN) | 282 | GENARATED_TAB2D(short,SHRT_MIN) |
271 | GENARATED_TAB2D(float, NAN) | 283 | GENARATED_TAB2D(float, NAN) |
@@ -274,6 +286,13 @@ GENARATED_TAB2D(long double, NAN) | @@ -274,6 +286,13 @@ GENARATED_TAB2D(long double, NAN) | ||
274 | GENARATED_TAB2D(int, INT_MIN) | 286 | GENARATED_TAB2D(int, INT_MIN) |
275 | GENARATED_TAB2D(AMDA::Parameters::LogicalData, AMDA::Parameters::LogicalData::NaN) | 287 | GENARATED_TAB2D(AMDA::Parameters::LogicalData, AMDA::Parameters::LogicalData::NaN) |
276 | 288 | ||
289 | +template<class ElType, class ClassName> | ||
290 | +void AMDA::Parameters::ParamDataSpec_CRTP<ElType, ClassName>::push(ElementType el) { | ||
291 | + if (!std::isnan(_fillValue)) | ||
292 | + applyFillValue(el,_fillValue); | ||
293 | + _dataList.push_back(el); | ||
294 | +} | ||
295 | + | ||
277 | bool isNAN(short pval); | 296 | bool isNAN(short pval); |
278 | bool isNAN(float pval); | 297 | bool isNAN(float pval); |
279 | bool isNAN(double pval); | 298 | bool isNAN(double pval); |