30 #include "ScopeStack.h" 32 #include "BESInternalError.h" 38 const string ScopeStack::Entry::sTypeStrings[NUM_SCOPE_TYPES] = {
"<GLOBAL>",
"<Variable_Atomic>",
39 "<Variable_Constructor>",
"<Attribute_Atomic>",
"<Attribute_Container>", };
41 ScopeStack::Entry::Entry(ScopeType theType,
const string& theName) :
42 type(theType), name(theName)
44 if (theType < 0 || theType >= NUM_SCOPE_TYPES) {
46 "ScopeStack::Entry(): Invalid scope type = " << theType <<
" for scope name=" << theName << endl);
53 ScopeStack::ScopeStack() :
58 ScopeStack::~ScopeStack()
64 void ScopeStack::clear()
69 void ScopeStack::pop()
74 const ScopeStack::Entry&
75 ScopeStack::top()
const 80 bool ScopeStack::empty()
const 82 return _scope.empty();
85 int ScopeStack::size()
const 90 string ScopeStack::getScopeString()
const 93 vector<Entry>::const_iterator iter;
94 for (iter = _scope.begin(); iter != _scope.end(); iter++) {
95 if (iter != _scope.begin()) {
98 scope.append((*iter).name);
103 string ScopeStack::getTypedScopeString()
const 106 vector<Entry>::const_iterator iter;
107 for (iter = _scope.begin(); iter != _scope.end(); iter++) {
108 if (iter != _scope.begin()) {
111 scope.append((*iter).getTypedName());
118 if (_scope.empty() && type == GLOBAL) {
121 else if (_scope.empty()) {
125 return (_scope.back().type == type);
131 void ScopeStack::push(
const Entry& entry)
133 if (entry.type == GLOBAL) {
134 BESDEBUG(
"ncml",
"Logic error: can't push a GLOBAL scope type, ignoring." << endl);
137 _scope.push_back(entry);
exception thrown if inernal error encountered
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...