32 #include "ScopeStack.h"
34 #include "BESInternalError.h"
44 const string ScopeStack::Entry::sTypeStrings[NUM_SCOPE_TYPES] = {
"<GLOBAL>",
"<Variable_Atomic>",
45 "<Variable_Constructor>",
"<Attribute_Atomic>",
"<Attribute_Container>", };
47 ScopeStack::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);
59 ScopeStack::ScopeStack() :
64 ScopeStack::~ScopeStack()
70 void ScopeStack::clear()
75 void ScopeStack::pop()
80 const ScopeStack::Entry&
81 ScopeStack::top()
const
86 bool ScopeStack::empty()
const
88 return _scope.empty();
91 int ScopeStack::size()
const
96 string ScopeStack::getScopeString()
const
99 vector<Entry>::const_iterator iter;
100 for (iter = _scope.begin(); iter != _scope.end(); iter++) {
101 if (iter != _scope.begin()) {
104 scope.append((*iter).name);
109 string ScopeStack::getTypedScopeString()
const
112 vector<Entry>::const_iterator iter;
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);
137 void 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
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...