Commit 6ec574af9d9f2754748109e0e6d18a8dd68e304e

Authored by Benjamin Renard
1 parent 7c74fadb
Exists in master

Fix TableRange parsing

Showing 2 changed files with 37 additions and 2 deletions   Show diff stats
src/Info/ParamTable.cc
... ... @@ -25,7 +25,7 @@ namespace AMDA {
25 25 LoggerPtr ParamTable::_logger(Logger::getLogger("AMDA-Kernel.ParamTable"));
26 26  
27 27 ParamTable::ParamTable(const char *paramId, int dim) : _paramId(paramId), _dim(dim),
28   - _tableName(""), _tableUnits(""), _variable("false") {
  28 + _tableName(""), _tableUnits(""), _variable(false) {
29 29 }
30 30  
31 31 ParamTable::~ParamTable() {
... ...
src/Info/ParamTableNode.cc
... ... @@ -544,8 +544,39 @@ namespace AMDA {
544 544  
545 545 std::string paramId = pParamInfo->getId();
546 546  
  547 + //Get name
  548 + xmlChar* value = xmlGetProp(pNode, (const xmlChar *) "name");
  549 + std::string name;
  550 + if (value != NULL) {
  551 + name = (char *) value;
  552 + xmlFree(value);
  553 + }
  554 +
  555 + //Get units
  556 + value = xmlGetProp(pNode, (const xmlChar *) "units");
  557 + std::string units;
  558 + if (value != NULL) {
  559 + units = (char *) value;
  560 + xmlFree(value);
  561 + }
  562 +
  563 + //Get variable
  564 + value = xmlGetProp(pNode, (const xmlChar *) "variable");
  565 + bool variable = false;
  566 + if (value != NULL) {
  567 + variable = (strcmp((char*) value, "true") == 0);
  568 + xmlFree(value);
  569 + }
  570 + //Get fullVariable
  571 + value = xmlGetProp(pNode, (const xmlChar *) "fullVariable");
  572 + bool fullVariable = false;
  573 + if (value != NULL) {
  574 + fullVariable = (strcmp((char*) value, "true") == 0);
  575 + xmlFree(value);
  576 + }
  577 +
547 578 //Get min
548   - xmlChar* value = xmlGetProp(pNode, (const xmlChar *) "min");
  579 + value = xmlGetProp(pNode, (const xmlChar *) "min");
549 580 double min = 0.;
550 581 if (value != NULL) {
551 582 min = atof((char *) value);
... ... @@ -589,6 +620,10 @@ namespace AMDA {
589 620 }
590 621  
591 622 boost::shared_ptr<ParamTable> table(new RangeTable(paramId.c_str(), dim, min, max, step));
  623 + table->setName(name);
  624 + table->setUnits(units);
  625 + table->setIsVariable(variable);
  626 + table->setIsFullVariable(fullVariable);
592 627  
593 628 pParamInfo->addTable(dim, table);
594 629 }
... ...