37 using std::stringstream;
51 , _isVariableLength(
"")
59 , _length(proto._length)
60 , _orgName(proto._orgName)
61 , _isUnlimited(proto._isUnlimited)
62 , _isShared(proto._isShared)
63 , _isVariableLength(proto._isVariableLength)
74 , _isVariableLength(
"")
112 parseAndCacheDimension();
120 BESDEBUG(
"ncml",
"DimensionElement::handleBegin called...");
127 "Got dimension element = " +
toString() +
128 " at an invalid parse location. Expected it as a direct child of <netcdf> element only." +
129 " scope=" +
_parser->getScopeString());
141 "Tried at add dimension " +
toString() +
142 " but a dimension with name=" +
name() +
143 " already exists in this scope=" +
_parser->getScopeString());
157 "Got illegal (non-whitespace) content in element " +
toString());
184 return ( (this->
name() == rhs.
name()) &&
211 DimensionElement::parseAndCacheDimension()
219 "Element " +
toString() +
" failed to parse the length attribute into a proper unsigned int!");
225 if (_isShared ==
"true")
229 else if (_isShared ==
"false")
233 else if (!_isShared.empty())
236 "dimension@isShared did not have value in {true,false}.");
242 DimensionElement::validateOrThrow()
245 if (!_isShared.empty() ||
246 !_isUnlimited.empty() ||
247 !_isVariableLength.empty() ||
251 "Dimension element " +
toString() +
" has unexpected unimplemented attributes. "
252 "This version of the module only handles name and length.");
257 DimensionElement::getValidAttributes()
259 vector<string> validAttrs;
260 validAttrs.reserve(10);
261 validAttrs.push_back(
"name");
262 validAttrs.push_back(
"length");
263 validAttrs.push_back(
"isUnlimited");
264 validAttrs.push_back(
"isVariableLength");
265 validAttrs.push_back(
"isShared");
266 validAttrs.push_back(
"orgName");
virtual bool validateAttributes(const XMLAttributeMap &attrs, const vector< string > &validAttrs, vector< string > *pInvalidAttrs=0, bool printInvalid=true, bool throwOnError=true)
Check that the given attributes are all in the valid set, otherwise fill in *pInvalidAttrs with the p...
virtual void handleBegin()
Handle a begin on this element.
virtual void setAttributes(const XMLAttributeMap &attrs)
Set the attributes of this from the map.
static const vector< string > _sValidAttributes
void addDimension(DimensionElement *dim)
Add the given element to this scope.
An abstract superclass for NCMLArray that handles the non-parameterized functionality and allows u...
const string getValueForLocalNameOrDefault(const string &localname, const string &defVal="") const
If there is an attribute with localname, return its value, else return default.
static bool isAllWhitespace(const std::string &str)
Is all the string whitespace as defined by chars in WHITESPACE ?
Concrete class for NcML element.
const DimensionElement * getDimensionInLocalScope(const string &name) const
bool checkDimensionsMatch(const DimensionElement &rhs) const
int getParseLineNumber() const
Get the line of the NCML file the parser is currently parsing.
static std::string printAttributeIfNotEmpty(const std::string &attrName, const std::string &attrValue)
Helper for subclasses implementing toString().
static const string _sTypeName
#define THROW_NCML_PARSE_ERROR(parseLine, msg)
virtual void handleContent(const string &content)
Handle the characters content for the element.
Struct for holding information about a dimension of data, minimally a name and a cardinality (size)...
virtual ~DimensionElement()
Base class for NcML element concrete classes.
virtual DimensionElement * clone() const
Make and return a copy of this.
virtual void handleEnd()
Handle the closing of this element.
virtual const string & getTypeName() const
Return the type of the element, which should be: the same as ConcreteClassName::getTypeName() ...
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
virtual string toString() const
Return a string describing the element.
unsigned int getSize() const
unsigned int getLengthNumeric() const
Parsed version of length()
const string & name() const