29 #include "VariableAggElement.h"
30 #include "AggregationElement.h"
31 #include "NCMLDebug.h"
32 #include "NCMLParser.h"
36 const string VariableAggElement::_sTypeName =
"variableAgg";
37 const vector<string> VariableAggElement::_sValidAttributes = getValidAttributes();
39 VariableAggElement::VariableAggElement() :
40 RCObjectInterface(), NCMLElement(0), _name(
"")
44 VariableAggElement::VariableAggElement(
const VariableAggElement& proto) :
45 RCObjectInterface(), NCMLElement(proto), _name(proto._name)
49 VariableAggElement::~VariableAggElement()
55 VariableAggElement::getTypeName()
const
61 VariableAggElement::clone()
const
68 validateAttributes(attrs, _sValidAttributes);
72 void VariableAggElement::handleBegin()
78 THROW_NCML_PARSE_ERROR(_parser->getParseLineNumber(),
79 "Cannot have variableAgg@name empty! Scope=" + _parser->getScopeString());
83 if (!_parser->isScopeAggregation()) {
84 THROW_NCML_PARSE_ERROR(_parser->getParseLineNumber(),
85 "Got a variableAgg element not as a direct child of an aggregation! elt=" + toString() +
" at scope="
86 + _parser->getScopeString());
94 void VariableAggElement::handleEnd()
98 string VariableAggElement::toString()
const
100 return (
string(
"<") + _sTypeName + printAttributeIfNotEmpty(
"name", _name) +
"/>");
104 VariableAggElement::getParentAggregation()
const
107 NCML_ASSERT_MSG(pAgg,
"VariableAggElement::getParentAggregation(): "
108 "Expected current top of stack was AggregationElement*, but it wasn't! Logic error!");
114 vector<string> VariableAggElement::getValidAttributes()
116 vector<string> validAttrs;
117 validAttrs.reserve(1);
118 validAttrs.push_back(
"name");
void setVariableAggElement()
void addAggregationVariable(const string &name)
Element for the <variableAgg> element child of an <aggregation>.
const std::string getValueForLocalNameOrDefault(const std::string &localname, const std::string &defVal="") const
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...