bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
ncml_module::NCMLParser Class Reference
Inheritance diagram for ncml_module::NCMLParser:
Inheritance graph
Collaboration diagram for ncml_module::NCMLParser:
Collaboration graph

Public Member Functions

void checkDataIsValidForCanonicalTypeOrThrow (const string &type, const vector< string > &tokens) const
 Make sure the given tokens are valid for the listed type. For example, makes sure floats are well formed, UInt16 are unsigned, etc. A successful call will return normally, else we throw an exception.
 
int getParseLineNumber () const
 
const XMLNamespaceStackgetXMLNamespaceStack () const
 
 NCMLParser (agg_util::DDSLoader &loader)
 Create a structure that can parse an NCML filename and returned a transformed response of requested type.
 
virtual void onCharacters (const std::string &content)
 
virtual void onEndDocument ()
 
virtual void onEndElement (const std::string &name)
 
virtual void onEndElementWithNamespace (const std::string &localname, const std::string &prefix, const std::string &uri)
 
virtual void onParseError (std::string msg)
 
virtual void onParseWarning (std::string msg)
 
virtual void onStartDocument ()
 
virtual void onStartElement (const std::string &name, const XMLAttributeMap &attrs)
 
virtual void onStartElementWithNamespace (const std::string &localname, const std::string &prefix, const std::string &uri, const XMLAttributeMap &attributes, const XMLNamespaceMap &namespaces)
 
std::unique_ptr< BESDapResponseparse (const std::string &ncmlFilename, agg_util::DDSLoader::ResponseType type)
 Parse the NcML filename, returning a newly allocated DDS response containing the underlying dataset transformed by the NcML. The caller owns the returned memory.
 
void parseInto (const string &ncmlFilename, agg_util::DDSLoader::ResponseType responseType, BESDapResponse *response)
 Same as parse, but the response object to parse into is passed down by the caller rather than created.
 
bool parsing () const
 
virtual void setParseLineNumber (int line)
 

Static Public Member Functions

static string convertNcmlTypeToCanonicalType (const string &ncmlType)
 

Static Public Attributes

static const string STRUCTURE_TYPE
 

Friends

class AggregationElement
 
class AttributeElement
 
class AttrTableLazyPtr
 
class DimensionElement
 
class ExplicitElement
 
class NetcdfElement
 
class ReadMetadataElement
 
class RemoveElement
 
class ScanElement
 
class ValuesElement
 
class VariableAggElement
 
class VariableElement
 

Detailed Description

Definition at line 158 of file NCMLParser.h.

Constructor & Destructor Documentation

◆ NCMLParser()

ncml_module::NCMLParser::NCMLParser ( agg_util::DDSLoader & loader)

Create a structure that can parse an NCML filename and returned a transformed response of requested type.

Parameters
loaderhelper for loading a location referred to in the ncml.

Definition at line 136 of file NCMLParser.cc.

◆ ~NCMLParser()

ncml_module::NCMLParser::~NCMLParser ( )
virtual

Definition at line 144 of file NCMLParser.cc.

Member Function Documentation

◆ checkDataIsValidForCanonicalTypeOrThrow()

void ncml_module::NCMLParser::checkDataIsValidForCanonicalTypeOrThrow ( const string & type,
const vector< string > & tokens ) const

Make sure the given tokens are valid for the listed type. For example, makes sure floats are well formed, UInt16 are unsigned, etc. A successful call will return normally, else we throw an exception.

Exceptions
BESUserSyntaxErroron invalid values.

Definition at line 969 of file NCMLParser.cc.

◆ convertNcmlTypeToCanonicalType()

string ncml_module::NCMLParser::convertNcmlTypeToCanonicalType ( const string & ncmlType)
static

Convert the NCML type in ncmlType into a canonical type we will use in the parser. Specifically, we map NcML types to their closest DAP equivalent type, but we leave Structure as Structure since it is assumed to mean Constructor for DAP which is a superclass type. Note this passes DAP types through unchanged as well. It is illegal for ncmlType to be empty(). We return "" to indicate an error in conversion.

Parameters
ncmlTypea non empty() string that could be an NcML type (or built-in DAP type)
Returns
the converted type or "" if unknown type.

Definition at line 945 of file NCMLParser.cc.

◆ getParseLineNumber()

int ncml_module::NCMLParser::getParseLineNumber ( ) const

Get the line of the NCML file the parser is currently parsing

Definition at line 201 of file NCMLParser.cc.

◆ getXMLNamespaceStack()

const XMLNamespaceStack & ncml_module::NCMLParser::getXMLNamespaceStack ( ) const

If using namespaces, get the current stack of namespaces. Might be empty.

Definition at line 207 of file NCMLParser.cc.

◆ onCharacters()

void ncml_module::NCMLParser::onCharacters ( const std::string & content)
virtual

Called when characters are encountered within an element. content is only valid for the call duration. Note: this will return all whitespace in the document as well, which makes it messy to use.

Implements ncml_module::SaxParser.

Definition at line 330 of file NCMLParser.cc.

◆ onEndDocument()

void ncml_module::NCMLParser::onEndDocument ( )
virtual

Implements ncml_module::SaxParser.

Definition at line 217 of file NCMLParser.cc.

◆ onEndElement()

void ncml_module::NCMLParser::onEndElement ( const std::string & name)
virtual
Deprecated
We are preferring onEndElementWithNamespace() now. Called at the end of the element with the given name. The args are only valid for the duration of the call, so copy if necessary to keep.

Implements ncml_module::SaxParser.

Definition at line 254 of file NCMLParser.cc.

◆ onEndElementWithNamespace()

void ncml_module::NCMLParser::onEndElementWithNamespace ( const std::string & localname,
const std::string & prefix,
const std::string & uri )
virtual

SAX2 End element with namespace information.

Parameters
localnamethe localname of the element
prefixthe namespace prefix or "" on the element
urithe uri (or "") associated with the namespace of the element.

Implements ncml_module::SaxParser.

Definition at line 299 of file NCMLParser.cc.

◆ onParseError()

void ncml_module::NCMLParser::onParseError ( std::string msg)
virtual

An unrecoverable parse error occurred

Implements ncml_module::SaxParser.

Definition at line 353 of file NCMLParser.cc.

◆ onParseWarning()

void ncml_module::NCMLParser::onParseWarning ( std::string msg)
virtual

A recoverable parse error occured.

Implements ncml_module::SaxParser.

Definition at line 347 of file NCMLParser.cc.

◆ onStartDocument()

void ncml_module::NCMLParser::onStartDocument ( )
virtual

Implements ncml_module::SaxParser.

Definition at line 212 of file NCMLParser.cc.

◆ onStartElement()

void ncml_module::NCMLParser::onStartElement ( const std::string & name,
const XMLAttributeMap & attrs )
virtual
Deprecated
We are preferring onStartElementWithNamespace() now Called at the start of the element with the given name and attribute dictionary The args are only valid for the duration of the call, so copy if necessary to keep.
Parameters
namename of the element
attrsa map of any attributes -> values. Volatile for this call.
See also
onStartElementWithNamespace()

Implements ncml_module::SaxParser.

Definition at line 222 of file NCMLParser.cc.

◆ onStartElementWithNamespace()

void ncml_module::NCMLParser::onStartElementWithNamespace ( const std::string & localname,
const std::string & prefix,
const std::string & uri,
const XMLAttributeMap & attributes,
const XMLNamespaceMap & namespaces )
virtual

SAX2 start element call with gets namespace information.

Parameters
localnamethe localname of the element
prefixthe namespace prefix of the element, or "" if none.
urithe uri for the namespace of the element.
attributestable of the attributes (excluding namespace attributes prefixed with xmlns)
namespacetable of all the namespaces specification on this element

Implements ncml_module::SaxParser.

Definition at line 283 of file NCMLParser.cc.

◆ parse()

unique_ptr< BESDapResponse > ncml_module::NCMLParser::parse ( const std::string & ncmlFilename,
agg_util::DDSLoader::ResponseType type )

Parse the NcML filename, returning a newly allocated DDS response containing the underlying dataset transformed by the NcML. The caller owns the returned memory.

Exceptions
BESSyntaxUserErrorfor parse errors such as bad XML or NcML referring to variables that do not exist.
BESInternalErrorfor assertion failures, null ptr exceptions, or logic errors.
Returns
a new response object with the transformed DDS in it. The caller assumes ownership of the returned object. It will be of type BESDDSResponse or BESDataDDSResponse depending on the request being processed.

Definition at line 150 of file NCMLParser.cc.

◆ parseInto()

void ncml_module::NCMLParser::parseInto ( const string & ncmlFilename,
agg_util::DDSLoader::ResponseType responseType,
BESDapResponse * response )

Same as parse, but the response object to parse into is passed down by the caller rather than created.

Parameters
ncmlFilenamethe ncml file to parse
responseTypethe type of response. Must match response.
responsethe premade response object. The caller owns this memory.

Definition at line 163 of file NCMLParser.cc.

◆ parsing()

bool ncml_module::NCMLParser::parsing ( ) const

Are we currently parsing?

Definition at line 196 of file NCMLParser.cc.

◆ setParseLineNumber()

void ncml_module::NCMLParser::setParseLineNumber ( int )
virtual

Before any of the callbacks are issued, this function is called to let the implementing parser know what line number in the parse the next callback is being issued from to allow for more informative error messages. (Default impl is to ignore it now).

Reimplemented from ncml_module::SaxParser.

Definition at line 359 of file NCMLParser.cc.

Friends And Related Symbol Documentation

◆ AggregationElement

friend class AggregationElement
friend

Definition at line 163 of file NCMLParser.h.

◆ AttributeElement

friend class AttributeElement
friend

Definition at line 165 of file NCMLParser.h.

◆ AttrTableLazyPtr

friend class AttrTableLazyPtr
friend

Definition at line 164 of file NCMLParser.h.

◆ DimensionElement

friend class DimensionElement
friend

Definition at line 166 of file NCMLParser.h.

◆ ExplicitElement

friend class ExplicitElement
friend

Definition at line 167 of file NCMLParser.h.

◆ NetcdfElement

friend class NetcdfElement
friend

Definition at line 168 of file NCMLParser.h.

◆ ReadMetadataElement

friend class ReadMetadataElement
friend

Definition at line 169 of file NCMLParser.h.

◆ RemoveElement

friend class RemoveElement
friend

Definition at line 170 of file NCMLParser.h.

◆ ScanElement

friend class ScanElement
friend

Definition at line 171 of file NCMLParser.h.

◆ ValuesElement

friend class ValuesElement
friend

Definition at line 172 of file NCMLParser.h.

◆ VariableAggElement

friend class VariableAggElement
friend

Definition at line 173 of file NCMLParser.h.

◆ VariableElement

friend class VariableElement
friend

Definition at line 174 of file NCMLParser.h.

Member Data Documentation

◆ STRUCTURE_TYPE

const string ncml_module::NCMLParser::STRUCTURE_TYPE
static

The string describing the type "Structure"

Definition at line 577 of file NCMLParser.h.


The documentation for this class was generated from the following files: