29#include "VariableAggElement.h"
30#include "AggregationElement.h"
32#include "NCMLParser.h"
36const string VariableAggElement::_sTypeName =
"variableAgg";
37const vector<string> VariableAggElement::_sValidAttributes = getValidAttributes();
39VariableAggElement::VariableAggElement() :
40 RCObjectInterface(), NCMLElement(0), _name(
"")
44VariableAggElement::VariableAggElement(
const VariableAggElement& proto) :
45 RCObjectInterface(), NCMLElement(proto), _name(proto._name)
49VariableAggElement::~VariableAggElement()
55VariableAggElement::getTypeName()
const
61VariableAggElement::clone()
const
68 validateAttributes(attrs, _sValidAttributes);
72void 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());
94void VariableAggElement::handleEnd()
98string VariableAggElement::toString()
const
100 return (
string(
"<") + _sTypeName + printAttributeIfNotEmpty(
"name", _name) +
"/>");
104VariableAggElement::getParentAggregation()
const
107 NCML_ASSERT_MSG(pAgg,
"VariableAggElement::getParentAggregation(): "
108 "Expected current top of stack was AggregationElement*, but it wasn't! Logic error!");
114vector<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...