void ConstructDataBinningAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("ConstructDataBinningAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("name")) != 0) SetName(node->AsString()); if((node = searchNode->GetNode("varnames")) != 0) SetVarnames(node->AsStringVector()); if((node = searchNode->GetNode("binType")) != 0) SetBinType(node->AsUnsignedCharVector()); if((node = searchNode->GetNode("binBoundaries")) != 0) SetBinBoundaries(node->AsDoubleVector()); if((node = searchNode->GetNode("reductionOperator")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 9) SetReductionOperator(ReductionOperator(ival)); } else if(node->GetNodeType() == STRING_NODE) { ReductionOperator value; if(ReductionOperator_FromString(node->AsString(), value)) SetReductionOperator(value); } } if((node = searchNode->GetNode("varForReductionOperator")) != 0) SetVarForReductionOperator(node->AsString()); if((node = searchNode->GetNode("undefinedValue")) != 0) SetUndefinedValue(node->AsDouble()); if((node = searchNode->GetNode("binningScheme")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 2) SetBinningScheme(BinningScheme(ival)); } else if(node->GetNodeType() == STRING_NODE) { BinningScheme value; if(BinningScheme_FromString(node->AsString(), value)) SetBinningScheme(value); } } if((node = searchNode->GetNode("numBins")) != 0) SetNumBins(node->AsIntVector()); if((node = searchNode->GetNode("overTime")) != 0) SetOverTime(node->AsBool()); if((node = searchNode->GetNode("timeStart")) != 0) SetTimeStart(node->AsInt()); if((node = searchNode->GetNode("timeEnd")) != 0) SetTimeEnd(node->AsInt()); if((node = searchNode->GetNode("timeStride")) != 0) SetTimeStride(node->AsInt()); if((node = searchNode->GetNode("outOfBoundsBehavior")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 2) SetOutOfBoundsBehavior(OutOfBoundsBehavior(ival)); } else if(node->GetNodeType() == STRING_NODE) { OutOfBoundsBehavior value; if(OutOfBoundsBehavior_FromString(node->AsString(), value)) SetOutOfBoundsBehavior(value); } } }
void ConstructDDFAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("ConstructDDFAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("ddfName")) != 0) SetDdfName(node->AsString()); if((node = searchNode->GetNode("varnames")) != 0) SetVarnames(node->AsStringVector()); if((node = searchNode->GetNode("ranges")) != 0) SetRanges(node->AsDoubleVector()); if((node = searchNode->GetNode("codomainName")) != 0) SetCodomainName(node->AsString()); if((node = searchNode->GetNode("statisticalOperator")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 10) SetStatisticalOperator(StatisticalOperator(ival)); } else if(node->GetNodeType() == STRING_NODE) { StatisticalOperator value; if(StatisticalOperator_FromString(node->AsString(), value)) SetStatisticalOperator(value); } } if((node = searchNode->GetNode("percentile")) != 0) SetPercentile(node->AsDouble()); if((node = searchNode->GetNode("undefinedValue")) != 0) SetUndefinedValue(node->AsDouble()); if((node = searchNode->GetNode("binningScheme")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 2) SetBinningScheme(BinningScheme(ival)); } else if(node->GetNodeType() == STRING_NODE) { BinningScheme value; if(BinningScheme_FromString(node->AsString(), value)) SetBinningScheme(value); } } if((node = searchNode->GetNode("numSamples")) != 0) SetNumSamples(node->AsIntVector()); if((node = searchNode->GetNode("overTime")) != 0) SetOverTime(node->AsBool()); if((node = searchNode->GetNode("timeStart")) != 0) SetTimeStart(node->AsInt()); if((node = searchNode->GetNode("timeEnd")) != 0) SetTimeEnd(node->AsInt()); if((node = searchNode->GetNode("timeStride")) != 0) SetTimeStride(node->AsInt()); }