bes
Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
ScopeStack.h
1
2
// This file is part of the "NcML Module" project, a BES module designed
3
// to allow NcML files to be used to be used as a wrapper to add
4
// AIS to existing datasets of any format.
5
//
6
// Copyright (c) 2009 OPeNDAP, Inc.
7
// Author: Michael Johnson <m.johnson@opendap.org>
8
//
9
// For more information, please also see the main website: http://opendap.org/
10
//
11
// This library is free software; you can redistribute it and/or
12
// modify it under the terms of the GNU Lesser General Public
13
// License as published by the Free Software Foundation; either
14
// version 2.1 of the License, or (at your option) any later version.
15
//
16
// This library is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
// Lesser General Public License for more details.
20
//
21
// You should have received a copy of the GNU Lesser General Public
22
// License along with this library; if not, write to the Free Software
23
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
//
25
// Please see the files COPYING and COPYRIGHT for more information on the GLPL.
26
//
27
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
29
30
#ifndef __NCML_MODULE__SCOPE_STACK_H__
31
#define __NCML_MODULE__SCOPE_STACK_H__
32
33
#include <string>
34
#include <vector>
35
51
namespace
ncml_module
52
{
53
class
ScopeStack
54
{
55
public
:
// Inner classes
60
enum
ScopeType
{ GLOBAL=0, VARIABLE_ATOMIC, VARIABLE_CONSTRUCTOR, ATTRIBUTE_ATOMIC, ATTRIBUTE_CONTAINER, NUM_SCOPE_TYPES};
61
68
struct
Entry
69
{
70
Entry(
ScopeType
theType,
const
std::string& theName);
71
Entry() : type(GLOBAL) , name(
""
) {}
72
73
std::string getTypedName()
const
74
{
75
return
name + toString(type);
76
}
77
78
static
const
std::string& toString(
ScopeType
theType)
79
{
80
return
sTypeStrings[theType];
81
}
82
83
ScopeType
type;
84
std::string name;
85
static
const
std::string sTypeStrings[NUM_SCOPE_TYPES];
86
};
87
89
public
:
90
91
ScopeStack();
92
virtual
~ScopeStack();
93
94
void
clear();
95
void
push(
const
std::string& name,
ScopeType
type) { push(
Entry
(type, name)); }
96
void
pop();
97
const
Entry& top()
const
;
98
99
ScopeType topType()
const
{
return
top().type; }
100
const
std::string& topName()
const
{
return
top().name; }
101
105
bool
empty
()
const
;
106
112
int
size
()
const
;
113
114
std::string getFullyQualifiedName()
const
{
return
getScopeString
(); }
115
120
std::string
getScopeString
()
const
;
121
129
std::string
getTypedScopeString
()
const
;
130
135
bool
isCurrentScope
(
ScopeType
type)
const
;
136
137
private
:
// Method
138
139
void
push(
const
Entry
& entry);
140
142
private
:
143
std::vector<Entry> _scope;
144
};
145
}
146
147
#endif
/* __NCML_MODULE__SCOPE_STACK_H__ */
ncml_module::ScopeStack::size
int size() const
Definition
ScopeStack.cc:91
ncml_module::ScopeStack::empty
bool empty() const
Definition
ScopeStack.cc:86
ncml_module::ScopeStack::getTypedScopeString
std::string getTypedScopeString() const
Definition
ScopeStack.cc:109
ncml_module::ScopeStack::getScopeString
std::string getScopeString() const
Definition
ScopeStack.cc:96
ncml_module::ScopeStack::isCurrentScope
bool isCurrentScope(ScopeType type) const
Definition
ScopeStack.cc:122
ncml_module::ScopeStack::ScopeType
ScopeType
Definition
ScopeStack.h:60
ncml_module
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...
Definition
AggregationElement.h:58
ncml_module::ScopeStack::Entry
Definition
ScopeStack.h:69
modules
ncml_module
ScopeStack.h
Generated by
1.13.2