32#include "ScopeStack.h"
34#include "BESInternalError.h"
44const string ScopeStack::Entry::sTypeStrings[NUM_SCOPE_TYPES] = {
"<GLOBAL>",
"<Variable_Atomic>",
45 "<Variable_Constructor>",
"<Attribute_Atomic>",
"<Attribute_Container>", };
47ScopeStack::Entry::Entry(ScopeType theType,
const string& theName) :
48 type(theType), name(theName)
50 if (theType < 0 || theType >= NUM_SCOPE_TYPES) {
52 "ScopeStack::Entry(): Invalid scope type = " << theType <<
" for scope name=" << theName << endl);
59ScopeStack::ScopeStack() :
64ScopeStack::~ScopeStack()
70void ScopeStack::clear()
80const ScopeStack::Entry&
81ScopeStack::top()
const
88 return _scope.empty();
100 for (iter = _scope.begin(); iter != _scope.end(); iter++) {
101 if (iter != _scope.begin()) {
104 scope.append((*iter).name);
113 for (iter = _scope.begin(); iter != _scope.end(); iter++) {
114 if (iter != _scope.begin()) {
117 scope.append((*iter).getTypedName());
124 if (_scope.empty() && type == GLOBAL) {
127 else if (_scope.empty()) {
131 return (_scope.back().type == type);
137void ScopeStack::push(
const Entry& entry)
139 if (entry.type == GLOBAL) {
140 BESDEBUG(
"ncml",
"Logic error: can't push a GLOBAL scope type, ignoring." << endl);
143 _scope.push_back(entry);
exception thrown if internal error encountered
std::string getTypedScopeString() const
std::string getScopeString() const
bool isCurrentScope(ScopeType type) const
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...