Commit 93bba7b72ecb6f0cc882d7e24605bd2232f312a2

Authored by Hacene SI HADJ MOHAND
1 parent 79366e37

ok for varable with xml modification

config/xsd/info/paramInfo.xsd
... ... @@ -18,6 +18,7 @@
18 18 <xs:attribute name="name" type="xs:string" />
19 19 <xs:attribute name="units" type="xs:string" />
20 20 <xs:attribute name="variable" type="xs:boolean" />
  21 + <xs:attribute name="fullVariable" type="xs:boolean" />
21 22 </xs:attributeGroup>
22 23  
23 24 <xs:element name="boundsTable" substitutionGroup="TableDef">
... ...
src/Info/ParamTable.cc
... ... @@ -113,28 +113,7 @@ namespace AMDA {
113 113 * @brief Get if it's a variable table
114 114 */
115 115 bool ParamTable::isFullVariable(ParameterManager* parameterManager) {
116   - bool isVariable = true;
117   - std::list<std::string> allLinkedParams;
118   - std::map<std::string, std::string>& tableParams = this->getTableParams(parameterManager);
119   - if (!tableParams.empty()) {
120   - for (auto tableParam : tableParams) {
121   - std::list<std::string> allParams ;
122   - allParams.push_back(tableParam.second);
123   - addRelatedParams( parameterManager, tableParam.second, allParams);
124   - for (auto pId: allParams){
125   - AMDA::Parameters::ParameterSPtr pParam = parameterManager->getParameter(pId);
126   - Process* lProcess = dynamic_cast<Process*> (pParam->getDataWriterTemplate().get());
127   - if (lProcess != NULL) {
128   - AMDA::Parameters::SemiVariableTable semiVariableTable = lProcess ->getSemiVariableTable();
129   - std::list<std::string>::iterator it;
130   - if (!semiVariableTable.tabHeader.empty()) {
131   - isVariable = false;
132   - }
133   - }
134   - }
135   - }
136   - }
137   - return isVariable;
  116 + return _fullVariable;
138 117 }
139 118  
140 119 void ParamTable::addRelatedParams(ParameterManager *parameterManager, std::string paramId, std::list<std::string>relatedParams){
... ... @@ -252,8 +231,11 @@ namespace AMDA {
252 231 // recuperer les centres
253 232 bool variableSizes = false;
254 233 unsigned int nModes = semiVariableTable.tabValues.size();
255   - unsigned int nValues = semiVariableTable.tabHeader.size();
  234 + unsigned int index =0;
  235 + unsigned nValues = 0;
256 236 for (auto tabValues : semiVariableTable.tabValues) {
  237 + if (index == 0)
  238 + nValues = tabValues.second.size();
257 239 if (tabValues.second.size() != nValues)
258 240 variableSizes = true;
259 241 }
... ...
src/Info/ParamTableNode.cc
... ... @@ -71,6 +71,14 @@ public:
71 71 variable = (strcmp((char*)value,"true") == 0);
72 72 xmlFree(value);
73 73 }
  74 + //Get fullVariable
  75 + value = xmlGetProp(pNode, (const xmlChar *) "fullVariable");
  76 + bool fullVariable = false;
  77 + if (value != NULL)
  78 + {
  79 + fullVariable = (strcmp((char*)value,"true") == 0);
  80 + xmlFree(value);
  81 + }
74 82  
75 83 xmlChar* lboundsName = NULL;
76 84 try {
... ... @@ -88,6 +96,7 @@ public:
88 96 table->setName(name);
89 97 table->setUnits(units);
90 98 table->setIsVariable(variable);
  99 + table->setIsFullVariable(fullVariable);
91 100  
92 101 pParamInfo->addTable(dim, table);
93 102 } catch (...) {
... ... @@ -149,6 +158,14 @@ public:
149 158 variable = (strcmp((char*)value,"true") == 0);
150 159 xmlFree(value);
151 160 }
  161 + //Get fullVariable
  162 + value = xmlGetProp(pNode, (const xmlChar *) "fullVariable");
  163 + bool fullVariable = false;
  164 + if (value != NULL)
  165 + {
  166 + fullVariable = (strcmp((char*)value,"true") == 0);
  167 + xmlFree(value);
  168 + }
152 169  
153 170 xmlChar* lminTableName = NULL;
154 171 xmlChar* lmaxTableName = NULL;
... ... @@ -174,6 +191,7 @@ public:
174 191 table->setName(name);
175 192 table->setUnits(units);
176 193 table->setIsVariable(variable);
  194 + table->setIsFullVariable(fullVariable);
177 195  
178 196 pParamInfo->addTable(dim,table);
179 197  
... ... @@ -238,7 +256,14 @@ public:
238 256 variable = (strcmp((char*)value,"true") == 0);
239 257 xmlFree(value);
240 258 }
241   -
  259 + //Get fullVariable
  260 + value = xmlGetProp(pNode, (const xmlChar *) "fullVariable");
  261 + bool fullVariable = false;
  262 + if (value != NULL)
  263 + {
  264 + fullVariable = (strcmp((char*)value,"true") == 0);
  265 + xmlFree(value);
  266 + }
242 267 xmlChar* lcenterName = NULL;
243 268 xmlChar* lsize = NULL;
244 269 try {
... ... @@ -261,6 +286,7 @@ public:
261 286 table->setName(name);
262 287 table->setUnits(units);
263 288 table->setIsVariable(variable);
  289 + table->setIsFullVariable(fullVariable);
264 290  
265 291 pParamInfo->addTable(dim, table);
266 292 } catch (...) {
... ... @@ -328,6 +354,14 @@ public:
328 354 variable = (strcmp((char*)value,"true") == 0);
329 355 xmlFree(value);
330 356 }
  357 + //Get fullVariable
  358 + value = xmlGetProp(pNode, (const xmlChar *) "fullVariable");
  359 + bool fullVariable = false;
  360 + if (value != NULL)
  361 + {
  362 + fullVariable = (strcmp((char*)value,"true") == 0);
  363 + xmlFree(value);
  364 + }
331 365  
332 366 xmlChar* lcenterName = NULL;
333 367 xmlChar* lwidthName = NULL;
... ... @@ -354,6 +388,7 @@ public:
354 388 table->setName(name);
355 389 table->setUnits(units);
356 390 table->setIsVariable(variable);
  391 + table->setIsFullVariable(fullVariable);
357 392  
358 393 pParamInfo->addTable(dim, table);
359 394 } catch (...) {
... ... @@ -421,6 +456,14 @@ public:
421 456 variable = (strcmp((char*)value,"true") == 0);
422 457 xmlFree(value);
423 458 }
  459 + //Get fullVariable
  460 + value = xmlGetProp(pNode, (const xmlChar *) "fullVariable");
  461 + bool fullVariable = false;
  462 + if (value != NULL)
  463 + {
  464 + fullVariable = (strcmp((char*)value,"true") == 0);
  465 + xmlFree(value);
  466 + }
424 467  
425 468 xmlChar* lcenterName = NULL;
426 469 try {
... ... @@ -445,7 +488,8 @@ public:
445 488 table->setName(name);
446 489 table->setUnits(units);
447 490 table->setIsVariable(variable);
448   -
  491 + table->setIsFullVariable(fullVariable);
  492 +
449 493 pParamInfo->addTable(dim, table);
450 494 } catch (...) {
451 495 if (lcenterName) {
... ...
src/ParamOutputImpl/Download/DownloadOutput.cc
... ... @@ -174,9 +174,12 @@ namespace AMDA {
174 174 if( tableParam == NULL)
175 175 continue;
176 176 tableParam -> init(this, _timeIntervalList);
  177 + if(table.second->isFullVariable(&_parameterManager)){
  178 + addAditionalDownloadParams(tableParamId.second, true);
  179 + }else{
  180 + _tableParamsList.push_back( tableParamId.second);
  181 + }
177 182 AMDA::Info::ParamInfoSPtr tableInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(tableParamId.second);
178   - std::vector<std::pair<std::string,std::string>> tableInfoMap = tableInfo->getTableInfoMap(&_parameterManager);
179   - _tableParamsList.push_back( tableParamId.second);
180 183 for(auto linkedParamId : tableInfo->getLinkedParamList()){
181 184 addAditionalDownloadParams(linkedParamId, false);
182 185 }
... ...