Commit 193183ca5b67941655f08859146b212d97b6dcc2

Authored by Benjamin Renard
1 parent c1f5c606

Give the possibility to define some parameters time restriction in a request + A…

…pply time restriction on paramaters (#5768)
config/xsd/request/request.xsd
... ... @@ -27,6 +27,19 @@
27 27 </xs:sequence>
28 28 </xs:complexType>
29 29 </xs:element>
  30 +
  31 + <xs:element name="paramsTimeRestrictions" minOccurs="0" maxOccurs="1">
  32 + <xs:complexType>
  33 + <xs:sequence>
  34 + <xs:element name="param" minOccurs="0" maxOccurs="unbounded">
  35 + <xs:complexType>
  36 + <xs:attribute name="id" type="xs:string" />
  37 + <xs:attribute name="restriction" type="xs:int" />
  38 + </xs:complexType>
  39 + </xs:element>
  40 + </xs:sequence>
  41 + </xs:complexType>
  42 + </xs:element>
30 43  
31 44 <xs:element name="outputs">
32 45 <xs:complexType>
... ...
src/ParamGetImpl/DDServerInterface/ParamGetDDBase.cc
... ... @@ -55,7 +55,7 @@ namespace AMDA {
55 55 /// Create ParamData
56 56 _vi = VirtualInstrumentManager::getInstance()->getVirtualInstrument(
57 57 _viName);
58   - _pusher = _vi->getParamPusher(_parName, _maxDim1Size, _maxDim2Size, _maxDim3Size, _dim3Num, _dim3CutIndex, _minSumIndex, _maxSumIndex);
  58 + _pusher = _vi->getParamPusher(_parName, _maxDim1Size, _maxDim2Size, _maxDim3Size, _dim3Num, _dim3CutIndex, _minSumIndex, _maxSumIndex, _parameter.getTimeRestriction());
59 59 //Param info
60 60 AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(_parameter.getInfoId(),true);
61 61 if ((paramInfo != nullptr) && (isnan(_pusher->getFillValue())) && (!isnan(paramInfo->getOriginalFillValue())))
... ... @@ -114,8 +114,8 @@ namespace AMDA {
114 114 else {
115 115 do {
116 116 result += lPacket->data->VarNumber;
117   - _pusher->put(lPacket->data.get());
118   - updateTimeInParamData(lPacket->time.get());
  117 + LOG4CXX_DEBUG(gLogger, "put data " << lPacket->data->VarNumber);
  118 + _pusher->put(lPacket->data.get(), lPacket->time.get());
119 119 delete lPacket;
120 120 } while( ( lPacket = _paramFlow->tryGet()));
121 121  
... ... @@ -144,25 +144,6 @@ namespace AMDA {
144 144 return result;
145 145 }
146 146  
147   - void ParamGetDDBase::updateTimeInParamData(DD_data_t* data) {
148   - LOG4CXX_DEBUG(gLogger, "updateTimeInParamData data->VarNumber = " << data->VarNumber);
149   - //ParamData is created, add data
150   - //The capacity must be == at Data
151   - double t = 0.;
152   - for (int index = 0; index < data->VarNumber; index++) {
153   - if (data->type == DD_CHAR) {
154   - t = DD_Time2Double((char *) data->Variables[index]);
155   - }
156   - else if (data->type == DD_DOUBLE) {
157   - t = *((double*)data->Variables[index]);
158   - }
159   - else {
160   - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::ex_msg("Unknown time type"));
161   - }
162   - _paramData->getTimeList().push_back(t);
163   - }
164   - }
165   -
166 147 void ParamGetDDBase::getDDInfo() {
167 148 for (InfoRequestList::iterator lIt = _infoRequestList.begin();
168 149 lIt != _infoRequestList.end(); ++lIt) {
... ...
src/ParamGetImpl/DDServerInterface/ParamGetDDBase.hh
... ... @@ -141,12 +141,6 @@ namespace AMDA {
141 141 private:
142 142  
143 143 /**
144   - * @brief update time in the ParamData
145   - * @details Must be call after createParamData
146   - */
147   - void updateTimeInParamData(DD_data_t *data);
148   -
149   - /**
150 144 * Create ParamData from getDataTypeInfo.
151 145 */
152 146 void createParamData();
... ...
src/ParamGetImpl/DDServerInterface/Pusher.hh
... ... @@ -24,9 +24,9 @@ namespace Base {
24 24 * of the corresponding type ( scalar or vector or Tab2D of short or int or float or double or ... type).
25 25 */
26 26 struct Pusher {
27   - Pusher (int maxDim1Size=1,int maxDim2Size=1) : _maxDim1Size(maxDim1Size), _maxDim2Size(maxDim2Size), _paramData(NULL), _fillValue(NAN) {}
  27 + Pusher (int maxDim1Size=1,int maxDim2Size=1) : _maxDim1Size(maxDim1Size), _maxDim2Size(maxDim2Size), _paramData(NULL), _fillValue(NAN), _timeRestriction(NAN) {}
28 28 virtual ~Pusher() {}
29   - virtual void put(DD_data_t *data) = 0;
  29 + virtual void put(DD_data_t *data, DD_data_t *timeData) = 0;
30 30 virtual void putNaN() = 0;
31 31 void setFillValue(double pFillValue) {
32 32 _fillValue = pFillValue;
... ... @@ -34,11 +34,35 @@ namespace Base {
34 34 double getFillValue() {
35 35 return _fillValue;
36 36 }
  37 + void setTimeRestriction(double timeRestriction) {
  38 + _timeRestriction = timeRestriction;
  39 + }
  40 + double getTimeRestriction() {
  41 + return _timeRestriction;
  42 + }
  43 +
  44 + double getTimeByIndex(DD_data_t* data, int index) {
  45 + if (index >= data->VarNumber) {
  46 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::ex_msg("Try to access to a time outside of the available range"));
  47 + }
  48 + if (data->type == DD_CHAR) {
  49 + return DD_Time2Double((char *) data->Variables[index]);
  50 + }
  51 + else if (data->type == DD_DOUBLE) {
  52 + return *((double*)data->Variables[index]);
  53 + }
  54 + else {
  55 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::ex_msg("Unknown time type"));
  56 + }
  57 + return 0.;
  58 + }
  59 +
37 60 int _maxDim1Size; /*!< Used for vector and Tab2D */
38 61 int _maxDim2Size; /*!< Used for Tab2D */
39 62 ParamData* _paramData; /*!< return ParamData to a Process*/
40 63 protected:
41 64 float _fillValue; /*!< When this value is different of NAN, into the raw data, it is replaced by NAN into ParamData. */
  65 + double _timeRestriction;
42 66 };
43 67 }
44 68  
... ... @@ -85,102 +109,117 @@ public:
85 109 _paramData = _specParamData = createParamData();
86 110 }
87 111  
88   - void put(DD_data_t *data) {
  112 + void put(DD_data_t *data, DD_data_t *timeData) {
89 113 BaseElemenType **lData = reinterpret_cast<BaseElemenType **>(data->Variables);
90 114  
91 115 //ParamData is created, add data
92 116 _specParamData->getDataList().resize(data->VarNumber);
93 117  
94 118  
  119 + if(_dim3CutIndex == -1 && _minSumIndex != -1 && _maxSumIndex != -1){
  120 + for (int index = 0; index < data->VarNumber; index++) {
  121 + double t = getTimeByIndex(timeData, index);
  122 + _paramData->getTimeList().push_back(t);
95 123  
96   - if(_dim3CutIndex == -1 && _minSumIndex != -1 && _maxSumIndex != -1){
97   - for (int index = 0; index < data->VarNumber; index++) {
98   - ElemenType elem = ElemenType(_maxDim1Size,_maxDim2Size);
99   - elem << NotANumber();
100   - for (int dim1Index= 0; dim1Index < data->Dimensions[_dim1Num]; ++dim1Index)
101   - {
102   - for (int dim2Index= 0; dim2Index < data->Dimensions[_dim2Num]; ++dim2Index)
103   - {
104   - BaseElemenType cumulatedElement;
105   - cumulatedElement << NotANumber() ;
106   - for(int sumIndex=_minSumIndex; sumIndex <= _maxSumIndex; ++sumIndex){
107   - int dataIndex = 0;
108   - if (_dim3Num >= 0 && _dim3Num < 3 && data->DimNumber == 3) {
109   - int curentIndex = (sumIndex >= 0 && sumIndex < data->Dimensions[_dim3Num]) ? sumIndex : 0;
110   - if (_dim3Num == 0) {
111   - dataIndex = curentIndex*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim1Index*data->Dimensions[_dim2Num] + dim2Index;
112   - }
113   - else if (_dim3Num == 1) {
114   - dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + curentIndex*data->Dimensions[_dim2Num] + dim2Index;
115   - }
116   - else {
117   - dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + dim2Index*data->Dimensions[_dim3Num] + curentIndex;
118   - }
  124 + if ((getTimeRestriction() > 0) && !isnan(getTimeRestriction())) {
  125 + if (t >= getTimeRestriction()) {
  126 + putNaN();
  127 + continue;
119 128 }
120   - else {
121   - dataIndex = dim1Index*data->Dimensions[_dim2Num]+dim2Index;
122   - }
123   - BaseElemenType baseElem = lData[index][dataIndex];
124   - if (!isnan(_fillValue))
125   - {
126   - double crt_val = baseElem;
127   - bool is_fill_value = isApproximatelyEqual(crt_val, _fillValue);
128   - if(is_fill_value)
129   - baseElem << NotANumber();
  129 + }
  130 +
  131 + ElemenType elem = ElemenType(_maxDim1Size,_maxDim2Size);
  132 + elem << NotANumber();
  133 + for (int dim1Index= 0; dim1Index < data->Dimensions[_dim1Num]; ++dim1Index)
  134 + {
  135 + for (int dim2Index= 0; dim2Index < data->Dimensions[_dim2Num]; ++dim2Index)
  136 + {
  137 + BaseElemenType cumulatedElement;
  138 + cumulatedElement << NotANumber() ;
  139 + for(int sumIndex=_minSumIndex; sumIndex <= _maxSumIndex; ++sumIndex){
  140 + int dataIndex = 0;
  141 + if (_dim3Num >= 0 && _dim3Num < 3 && data->DimNumber == 3) {
  142 + int curentIndex = (sumIndex >= 0 && sumIndex < data->Dimensions[_dim3Num]) ? sumIndex : 0;
  143 + if (_dim3Num == 0) {
  144 + dataIndex = curentIndex*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim1Index*data->Dimensions[_dim2Num] + dim2Index;
  145 + }
  146 + else if (_dim3Num == 1) {
  147 + dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + curentIndex*data->Dimensions[_dim2Num] + dim2Index;
  148 + }
  149 + else {
  150 + dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + dim2Index*data->Dimensions[_dim3Num] + curentIndex;
  151 + }
  152 + }
  153 + else {
  154 + dataIndex = dim1Index*data->Dimensions[_dim2Num]+dim2Index;
  155 + }
  156 + BaseElemenType baseElem = lData[index][dataIndex];
  157 + if (!isnan(_fillValue))
  158 + {
  159 + double crt_val = baseElem;
  160 + bool is_fill_value = isApproximatelyEqual(crt_val, _fillValue);
  161 + if(is_fill_value)
  162 + baseElem << NotANumber();
  163 + }
  164 + if (!isNAN(baseElem)) {
  165 + if (isNAN(cumulatedElement))
  166 + cumulatedElement << ElemNull();
  167 + cumulatedElement += baseElem;
  168 + }
  169 + }
  170 + elem[dim1Index][dim2Index] = cumulatedElement;
130 171 }
131   - if (!isNAN(baseElem)) {
132   - if (isNAN(cumulatedElement))
133   - cumulatedElement << ElemNull();
134   - cumulatedElement += baseElem;
135   - }
136   - }
137   - elem[dim1Index][dim2Index] = cumulatedElement;
138   - }
139   -
140 172 }
141   - _specParamData->getDataList().push_back(elem);
  173 + _specParamData->getDataList().push_back(elem);
142 174 }
143   -
144   -
145   -
146   - }else{
147   - for (int index = 0; index < data->VarNumber; index++) {
148   - ElemenType elem = ElemenType(_maxDim1Size,_maxDim2Size);
149   - elem << NotANumber();
150   - for (int dim1Index= 0; dim1Index < data->Dimensions[_dim1Num]; ++dim1Index)
151   - {
152   - for (int dim2Index= 0; dim2Index < data->Dimensions[_dim2Num]; ++dim2Index)
  175 + }else{
  176 + for (int index = 0; index < data->VarNumber; index++) {
  177 + double t = getTimeByIndex(timeData, index);
  178 + _paramData->getTimeList().push_back(t);
  179 +
  180 + if ((getTimeRestriction() > 0) && !isnan(getTimeRestriction())) {
  181 + if (getTimeByIndex(data, index) >= getTimeRestriction()) {
  182 + putNaN();
  183 + continue;
  184 + }
  185 + }
  186 +
  187 + ElemenType elem = ElemenType(_maxDim1Size,_maxDim2Size);
  188 + elem << NotANumber();
  189 + for (int dim1Index= 0; dim1Index < data->Dimensions[_dim1Num]; ++dim1Index)
153 190 {
154   - int dataIndex = 0;
155   - if (_dim3Num >= 0 && _dim3Num < 3 && data->DimNumber == 3) {
156   - int cutIndex = (_dim3CutIndex >= 0 && _dim3CutIndex < data->Dimensions[_dim3Num]) ? _dim3CutIndex : 0;
157   - if (_dim3Num == 0) {
158   - dataIndex = cutIndex*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim1Index*data->Dimensions[_dim2Num] + dim2Index;
159   - }
160   - else if (_dim3Num == 1) {
161   - dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + cutIndex*data->Dimensions[_dim2Num] + dim2Index;
  191 + for (int dim2Index= 0; dim2Index < data->Dimensions[_dim2Num]; ++dim2Index)
  192 + {
  193 + int dataIndex = 0;
  194 + if (_dim3Num >= 0 && _dim3Num < 3 && data->DimNumber == 3) {
  195 + int cutIndex = (_dim3CutIndex >= 0 && _dim3CutIndex < data->Dimensions[_dim3Num]) ? _dim3CutIndex : 0;
  196 + if (_dim3Num == 0) {
  197 + dataIndex = cutIndex*data->Dimensions[_dim1Num]*data->Dimensions[_dim2Num] + dim1Index*data->Dimensions[_dim2Num] + dim2Index;
  198 + }
  199 + else if (_dim3Num == 1) {
  200 + dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + cutIndex*data->Dimensions[_dim2Num] + dim2Index;
  201 + }
  202 + else {
  203 + dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + dim2Index*data->Dimensions[_dim3Num] + cutIndex;
  204 + }
162 205 }
163 206 else {
164   - dataIndex = dim1Index*data->Dimensions[_dim2Num]*data->Dimensions[_dim3Num] + dim2Index*data->Dimensions[_dim3Num] + cutIndex;
  207 + dataIndex = dim1Index*data->Dimensions[_dim2Num]+dim2Index;
165 208 }
  209 + BaseElemenType baseElem = lData[index][dataIndex];
  210 + if (!isnan(_fillValue))
  211 + {
  212 + double crt_val = baseElem;
  213 + bool is_fill_value = isApproximatelyEqual(crt_val, _fillValue);
  214 + if(is_fill_value)
  215 + baseElem << NotANumber();
  216 + }
  217 + elem[dim1Index][dim2Index] = baseElem;
166 218 }
167   - else {
168   - dataIndex = dim1Index*data->Dimensions[_dim2Num]+dim2Index;
169   - }
170   - BaseElemenType baseElem = lData[index][dataIndex];
171   - if (!isnan(_fillValue))
172   - {
173   - double crt_val = baseElem;
174   - bool is_fill_value = isApproximatelyEqual(crt_val, _fillValue);
175   - if(is_fill_value)
176   - baseElem << NotANumber();
177   - }
178   - elem[dim1Index][dim2Index] = baseElem;
179 219 }
  220 + _specParamData->getDataList().push_back(elem);
180 221 }
181   - _specParamData->getDataList().push_back(elem);
182 222 }
183   - }
184 223 }
185 224  
186 225 void putNaN() {
... ... @@ -231,13 +270,23 @@ public:
231 270 _paramData = _specParamData = createParamData();
232 271 }
233 272  
234   - void put(DD_data_t *data) {
  273 + void put(DD_data_t *data, DD_data_t *timeData) {
235 274 BaseElemenType **lData = reinterpret_cast<BaseElemenType **>(data->Variables);
236 275  
237 276 //ParamData is created, add data
238 277 _specParamData->getDataList().resize(data->VarNumber);
239 278  
240 279 for (int index = 0; index < data->VarNumber; index++) {
  280 + double t = getTimeByIndex(timeData, index);
  281 + _paramData->getTimeList().push_back(t);
  282 +
  283 + if ((getTimeRestriction() > 0) && !isnan(getTimeRestriction())) {
  284 + if (t >= getTimeRestriction()) {
  285 + putNaN();
  286 + continue;
  287 + }
  288 + }
  289 +
241 290 ElemenType elem = ElemenType();
242 291 elem.resize(_maxDim1Size);
243 292 elem << NotANumber();
... ... @@ -290,7 +339,7 @@ public:
290 339 _paramData = _specParamData = createParamData();
291 340 }
292 341  
293   - void put(DD_data_t *data) {
  342 + void put(DD_data_t *data, DD_data_t *timeData) {
294 343 BaseElemenType **lData = reinterpret_cast<BaseElemenType **>(data->Variables);
295 344  
296 345 //ParamData is created, add data
... ... @@ -303,6 +352,16 @@ public:
303 352 BaseElemenType nanElem;
304 353 nanElem << NotANumber();
305 354 for (int index = 0; index < data->VarNumber; index++) {
  355 + double t = getTimeByIndex(timeData, index);
  356 + _paramData->getTimeList().push_back(t);
  357 +
  358 + if ((getTimeRestriction() > 0) && !isnan(getTimeRestriction())) {
  359 + if (t >= getTimeRestriction()) {
  360 + putNaN();
  361 + continue;
  362 + }
  363 + }
  364 +
306 365 double crt_val = *lData[index];
307 366 bool is_fill_value = isApproximatelyEqual(crt_val, _fillValue);
308 367 if(!is_fill_value) {
... ... @@ -314,6 +373,16 @@ public:
314 373 }
315 374 else {
316 375 for (int index = 0; index < data->VarNumber; index++) {
  376 + double t = getTimeByIndex(timeData, index);
  377 + _paramData->getTimeList().push_back(t);
  378 +
  379 + if ((getTimeRestriction() > 0) && !isnan(getTimeRestriction())) {
  380 + if (t >= getTimeRestriction()) {
  381 + putNaN();
  382 + continue;
  383 + }
  384 + }
  385 +
317 386 _specParamData->getDataList().push_back(*lData[index]);
318 387 }
319 388  
... ...
src/ParamGetImpl/DDServerInterface/VirtualInstrument.cc
... ... @@ -196,7 +196,7 @@ namespace DDServerInterface {
196 196 }
197 197  
198 198 //TODO Replace by DD_Client::getParamType
199   - AMDA::Parameters::Base::Pusher* VirtualInstrument::getParamPusher( const std::string& pParName, int maxDim1Size, int maxDim2Size, int maxDim3Size, int dim3Num, int dim3CutIndex, int minSumIndex, int maxSumIndex) {
  199 + AMDA::Parameters::Base::Pusher* VirtualInstrument::getParamPusher( const std::string& pParName, int maxDim1Size, int maxDim2Size, int maxDim3Size, int dim3Num, int dim3CutIndex, int minSumIndex, int maxSumIndex, double timeRestriction) {
200 200  
201 201 AMDA::Parameters::Base::Pusher* lPusher = nullptr;
202 202 int error = 0;
... ... @@ -340,6 +340,9 @@ namespace DDServerInterface {
340 340 BOOST_THROW_EXCEPTION(exception() << errno_code(AMDA_TYPE_DATA_UNKNOWN));
341 341 }
342 342 lPusher->setFillValue(_fillValue);
  343 + if (timeRestriction > 0. && !isnan(timeRestriction)) {
  344 + lPusher->setTimeRestriction(timeRestriction);
  345 + }
343 346 } else {
344 347 LOG4CXX_INFO(gLogger, "VirtualInstrument::getParamPusher( "<< lId <<", " << pParName << ") returns = (" << error << ")");
345 348 lDDClient.DD_Close(lId);
... ...
src/ParamGetImpl/DDServerInterface/VirtualInstrument.hh
... ... @@ -83,7 +83,7 @@ public:
83 83 /**
84 84 * @brief Responsible push data into the good container.
85 85 */
86   - AMDA::Parameters::Base::Pusher* getParamPusher(const std::string& pParName, int maxDim1Size, int maxDim2Size, int maxDim3Size, int dim3Num, int dim3CutIndex, int minSumIndex, int maxSumIndex);
  86 + AMDA::Parameters::Base::Pusher* getParamPusher(const std::string& pParName, int maxDim1Size, int maxDim2Size, int maxDim3Size, int dim3Num, int dim3CutIndex, int minSumIndex, int maxSumIndex, double timeRestriction);
87 87  
88 88 /**
89 89 * @return a ParamFlowSPtr on the specified interval.
... ...
src/Parameters/ParamOutput.cc
... ... @@ -46,6 +46,16 @@ void ParamOutput::init(TimeIntervalListSPtr pTimeIntervalList) {
46 46 }
47 47  
48 48 _currentTimeInterval = _timeIntervalList->begin();
  49 +
  50 + // Update params time restrictions
  51 + std::map<std::string, double> paramsTimeRestrictions = _parameterManager.getParamsTimeRestrictions();
  52 + for (std::map<std::string, double>::iterator it = paramsTimeRestrictions.begin(); it != paramsTimeRestrictions.end(); ++it) {
  53 + ParameterSPtr p = _parameterManager.getParameter(it->first);
  54 + if (p != nullptr) {
  55 + p->setTimeRestriction(it->second);
  56 + }
  57 + }
  58 +
49 59 init();
50 60 }
51 61  
... ...
src/Parameters/Parameter.cc
... ... @@ -34,6 +34,7 @@ namespace Parameters {
34 34 _timeResolution(0) ,
35 35 _gapThreshold(pParamMng.getDefaultGapThreshold()) ,
36 36 _referenceParameter(""),
  37 + _timeRestriction(NAN),
37 38 establishConnectionToDo(true){
38 39 }
39 40  
... ...
src/Parameters/Parameter.hh
... ... @@ -196,6 +196,14 @@ namespace AMDA {
196 196 return _isTableIndexParam;
197 197 }
198 198  
  199 + void setTimeRestriction(double restriction) {
  200 + _timeRestriction = restriction;
  201 + }
  202 +
  203 + double getTimeRestriction() {
  204 + return _timeRestriction;
  205 + }
  206 +
199 207 protected:
200 208  
201 209 typedef std::map<DataClient *, ParamInterval*> DataClientList;
... ... @@ -270,6 +278,8 @@ namespace AMDA {
270 278 static bool _isTableIndexParam;
271 279  
272 280  
  281 + double _timeRestriction;
  282 +
273 283 private:
274 284 bool establishConnectionToDo;
275 285 };
... ...
src/Parameters/ParameterManager.hh
... ... @@ -155,6 +155,14 @@ namespace AMDA
155 155  
156 156 ParameterSPtr findParamInParameterList(const std::string& paramId);
157 157  
  158 + void addParamTimeRestriction(const std::string& paramId, double restriction) {
  159 + _paramsTimeRestrictions[paramId] = restriction;
  160 + }
  161 +
  162 + std::map<std::string, double> getParamsTimeRestrictions() {
  163 + return _paramsTimeRestrictions;
  164 + }
  165 +
158 166 protected:
159 167 /**
160 168 * @return The real parameter if the process is empty.
... ... @@ -197,6 +205,11 @@ private:
197 205 * @brief default value for the gap threshold of all parameters
198 206 */
199 207 double _defaultGapThreshold;
  208 +
  209 + /*
  210 + * @bried define some parameters time restrictions
  211 + */
  212 + std::map<std::string, double> _paramsTimeRestrictions;
200 213 };
201 214  
202 215 } /* namespace Parameters */
... ...
src/XMLRequest/XMLRequestParser.cc
... ... @@ -28,6 +28,7 @@
28 28 #include "Catalog.hh"
29 29  
30 30 #include <boost/filesystem.hpp>
  31 +#include <boost/lexical_cast.hpp>
31 32  
32 33 // Using namespace
33 34 using namespace log4cxx;
... ... @@ -297,6 +298,43 @@ public:
297 298 }
298 299 };
299 300  
  301 +class ParamTimeRestrictionNode : public NodeCfg
  302 +{
  303 +public:
  304 + void proceed(xmlNodePtr pNode,const AMDA::Parameters::CfgContext& pContext) {
  305 + ParameterManager* lParameterManager = pContext.get<ParameterManager*>();
  306 +
  307 + xmlChar* lParamName = xmlGetProp(pNode, (const xmlChar *) "id");
  308 + std::string paramNameStr;
  309 + if (lParamName) {
  310 + paramNameStr = std::string((char*)lParamName);
  311 + xmlFree(lParamName);
  312 + }
  313 + else {
  314 + ERROR_EXCEPTION( ERROR_MANDATORY_ATTRIBUTE_MISSING << pNode->name << "@id")
  315 + }
  316 +
  317 + xmlChar* lRestrictionTime = xmlGetProp(pNode, (const xmlChar *) "restriction");
  318 + double restrictionTime = NAN;
  319 + if (lRestrictionTime) {
  320 + std::string restrictionTimeStr = std::string((char*)lRestrictionTime);
  321 + xmlFree(lRestrictionTime);
  322 + try
  323 + {
  324 + restrictionTime = boost::lexical_cast<double>(restrictionTimeStr);
  325 + }
  326 + catch (boost::bad_lexical_cast &)
  327 + {
  328 + }
  329 + }
  330 + else {
  331 + ERROR_EXCEPTION( ERROR_MANDATORY_ATTRIBUTE_MISSING << pNode->name << "@restriction")
  332 + }
  333 +
  334 + lParameterManager->addParamTimeRestriction(paramNameStr, restrictionTime);
  335 + }
  336 +};
  337 +
300 338 XMLRequestParser::XMLRequestParser(const char* pXSDFile) : XMLConfigurator(pXSDFile,false) {
301 339 /*
302 340 <request>
... ... @@ -310,6 +348,9 @@ XMLRequestParser::XMLRequestParser(const char* pXSDFile) : XMLConfigurator(pXSDF
310 348 <timeInterval>0000000100000000</timeInterval>
311 349 <interval>
312 350 </times>
  351 + <paramsTimeRestrictions>
  352 + <param id="imf" restriction="1200441599"/>
  353 + </paramsTimeRestrictions>
313 354 <outputs>
314 355 <download>
315 356 <timeFormat>ISO</timeFormat>
... ... @@ -352,6 +393,12 @@ XMLRequestParser::XMLRequestParser(const char* pXSDFile) : XMLConfigurator(pXSDF
352 393 }
353 394 }
354 395 {
  396 + // Params time restrictions node
  397 + NodeGrpCfg* lParamsTimeRestrictionsNode = new NodeGrpCfg();
  398 + lRequestNode->getChildList()["paramsTimeRestrictions"] = NodeCfgSPtr(lParamsTimeRestrictionsNode);
  399 + lParamsTimeRestrictionsNode->getChildList()["param"] = NodeCfgSPtr(new ParamTimeRestrictionNode);
  400 + }
  401 + {
355 402 // Output group node
356 403 NodeGrpCfg* lOutputNode = new NodeGrpCfg();
357 404 lRequestNode->getChildList()["outputs"] = NodeCfgSPtr(lOutputNode);
... ...