bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
AttributeElement.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#ifndef __NCML_MODULE__ATTRIBUTE_ELEMENT_H__
30#define __NCML_MODULE__ATTRIBUTE_ELEMENT_H__
31
32#include "NCMLElement.h"
33
34namespace libdap {
35class AttrTable;
36}
37
38namespace ncml_module {
39class OtherXMLParser;
40}
41
42namespace ncml_module {
43
52class AttributeElement: public NCMLElement {
53private:
54 AttributeElement& operator=(const AttributeElement& rhs); // disallow
55
56public:
57 // methods
58 AttributeElement();
59 AttributeElement(const AttributeElement& proto);
60 virtual ~AttributeElement();
61 virtual const string& getTypeName() const;
62 virtual AttributeElement* clone() const; // override clone with more specific subclass
63 virtual void setAttributes(const XMLAttributeMap& attrs);
64 virtual void handleBegin();
65 virtual void handleContent(const string& content);
66 virtual void handleEnd();
67 virtual string toString() const;
68
69public:
70 // data rep
71 static const string _sTypeName;
72 static const vector<string> _sValidAttributes;
73 static const string _default_global_container;
74
75private:
76 // method
77
119 void processAttribute(NCMLParser& p);
120
126 void processAttributeContainerAtCurrentScope(NCMLParser& p);
127
132 void processAtomicAttributeAtCurrentScope(NCMLParser& p);
133
135 string getInternalType() const;
136
140 void addNewAttribute(NCMLParser& p);
141
152 void mutateAttributeAtCurrentScope(NCMLParser& p, const string& name, const string& type, const string& value);
153
166 void renameAtomicAttribute(NCMLParser& p);
167
175 libdap::AttrTable* renameAttributeContainer(NCMLParser& p);
176
180 void processEndAttribute(NCMLParser& p);
181
186 void startOtherXMLParse(NCMLParser& p);
187
190 static vector<string> getValidAttributes();
191
192private:
193 string _name;
194 string _type;
195 string _value;
196 string _separator;
197 string _orgName;
198
199 // Temp for tokenizing
200 vector<string> _tokens;
201
202 // If we're parsing an attr of type OtherXML,
203 // We will create and pass this into the NCMLParser to collect
204 // the OtherXML string. We own the memory.
205 OtherXMLParser* _pOtherXMLParser;
206};
207
208}
209
210#endif /* __NCML_MODULE__ATTRIBUTE_ELEMENT_H__ */
virtual const string & getTypeName() const
virtual void setAttributes(const XMLAttributeMap &attrs)
virtual string toString() const
virtual AttributeElement * clone() const
STL class.
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...