OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
ncml_module::NCMLElement Class Referenceabstract

Base class for NcML element concrete classes. More...

#include <NCMLElement.h>

Inheritance diagram for ncml_module::NCMLElement:
Inheritance graph
Collaboration diagram for ncml_module::NCMLElement:
Collaboration graph

Classes

class  Factory
 Factory class for the NcML elements. More...
 

Public Member Functions

void addPreDeleteCB (UseCountHitZeroCB *pCB)
 Add uniquely. More...
 
virtual NCMLElementclone () const =0
 Make and return a copy of this. More...
 
virtual int getRefCount () const
 Get the current reference count. More...
 
virtual const std::string & getTypeName () const =0
 Return the type of the element, which should be: the same as ConcreteClassName::getTypeName() More...
 
virtual void handleBegin ()=0
 Handle a begin on this element. More...
 
virtual void handleContent (const std::string &content)
 Handle the characters content for the element. More...
 
virtual void handleEnd ()=0
 Handle the closing of this element. More...
 
int line () const
 Return the current parse line number. More...
 
virtual int ref () const
 Increase the reference count by one. More...
 
virtual void removeFromPool () const
 If the object is in an auto-delete pool, remove it from the pool and force it to only delete when it's ref count goes to 0. More...
 
void removePreDeleteCB (UseCountHitZeroCB *pCB)
 Remove it exists. More...
 
virtual void setAttributes (const XMLAttributeMap &attrs)=0
 Set the attributes of this from the map. More...
 
void setParser (NCMLParser *p)
 
virtual std::string toString () const =0
 Return a string describing the element. More...
 
virtual int unref () const throw ()
 Decrease the reference count by one. More...
 
virtual bool validateAttributes (const XMLAttributeMap &attrs, const vector< string > &validAttrs, vector< string > *pInvalidAttrs=0, bool printInvalid=true, bool throwOnError=true)
 Check that the given attributes are all in the valid set, otherwise fill in *pInvalidAttrs with the problematic ones if it's not null. More...
 
virtual ~NCMLElement ()
 

Static Public Member Functions

static bool areAllAttributesValid (const XMLAttributeMap &attrMap, const std::vector< string > &validAttrs, std::vector< string > *pInvalidAttributes=0)
 
static bool isValidAttribute (const std::vector< string > &validAttrs, const string &attr)
 
static std::string printAttributeIfNotEmpty (const std::string &attrName, const std::string &attrValue)
 Helper for subclasses implementing toString(). More...
 

Protected Member Functions

 NCMLElement (NCMLParser *p)
 
 NCMLElement (const NCMLElement &proto)
 

Protected Attributes

NCMLParser_parser
 

Detailed Description

Base class for NcML element concrete classes.

Base class to define an NcML element for polymorphic dispatch in the NCMLParser. These concrete elements classes will be made friends of the NCMLParser in order to split the monolithic parser into chunks with specific functionality.

New concrete subclasses MUST be entered in the factory or they cannot be created.

We subclass RCObject since we sometimes need to keep elements around longer than just the SAX parser stack and need to keep track of whether other objects need to hang onto strong references to them.

Definition at line 64 of file NCMLElement.h.

Constructor & Destructor Documentation

ncml_module::NCMLElement::NCMLElement ( NCMLParser p)
explicitprotected

Definition at line 147 of file NCMLElement.cc.

ncml_module::NCMLElement::NCMLElement ( const NCMLElement proto)
protected

Definition at line 153 of file NCMLElement.cc.

ncml_module::NCMLElement::~NCMLElement ( )
virtual

Definition at line 160 of file NCMLElement.cc.

References _parser.

Member Function Documentation

void agg_util::RCObject::addPreDeleteCB ( UseCountHitZeroCB pCB)
inherited

Add uniquely.

If it is added agan, the second time is ignored.

Definition at line 145 of file RCObject.cc.

References BESDEBUG.

bool ncml_module::NCMLElement::areAllAttributesValid ( const XMLAttributeMap attrMap,
const std::vector< string > &  validAttrs,
std::vector< string > *  pInvalidAttributes = 0 
)
static
Returns
whether all the attributes in attrMap are in validAttrs. If pInvalidAttributes, fill it in with all the illegal attributes.

Definition at line 261 of file NCMLElement.cc.

References ncml_module::XMLAttributeMap::begin(), ncml_module::XMLAttributeMap::end(), and isValidAttribute().

Referenced by validateAttributes().

Here is the call graph for this function:

int agg_util::RCObject::getRefCount ( ) const
virtualinherited

Get the current reference count.

Implements agg_util::RCObjectInterface.

Definition at line 110 of file RCObject.cc.

virtual const std::string& ncml_module::NCMLElement::getTypeName ( ) const
pure virtual
virtual void ncml_module::NCMLElement::handleBegin ( )
pure virtual
void ncml_module::NCMLElement::handleContent ( const std::string &  content)
virtual

Handle the characters content for the element.

Default impl throws if the content is not all whitespace. Subclasses that handle non-whitespace content should override.

Parameters
contentthe string of characters in the element content.

Reimplemented in ncml_module::AggregationElement, ncml_module::NetcdfElement, ncml_module::VariableElement, ncml_module::DimensionElement, ncml_module::ScanElement, ncml_module::AttributeElement, ncml_module::ValuesElement, ncml_module::ExplicitElement, ncml_module::ReadMetadataElement, and ncml_module::RemoveElement.

Definition at line 180 of file NCMLElement.cc.

References _parser, ncml_module::NCMLParser::getParseLineNumber(), ncml_module::NCMLUtil::isAllWhitespace(), THROW_NCML_PARSE_ERROR, and toString().

Referenced by ncml_module::ScanElement::handleContent(), and ncml_module::NCMLParser::onCharacters().

Here is the call graph for this function:

bool ncml_module::NCMLElement::isValidAttribute ( const std::vector< string > &  validAttrs,
const string &  attr 
)
static
Returns
whether the given attr is in the array validAttrs or not... Helper for subclasses

Definition at line 246 of file NCMLElement.cc.

Referenced by areAllAttributesValid().

int ncml_module::NCMLElement::line ( ) const
std::string ncml_module::NCMLElement::printAttributeIfNotEmpty ( const std::string &  attrName,
const std::string &  attrValue 
)
static

Helper for subclasses implementing toString().

Returns
a string with attrName="attrValue" if !attrValue.empty(), otherwise return the empty string.

Definition at line 240 of file NCMLElement.cc.

Referenced by ncml_module::VariableAggElement::toString(), ncml_module::ScanElement::toString(), ncml_module::DimensionElement::toString(), ncml_module::NetcdfElement::toString(), and ncml_module::AggregationElement::toString().

int agg_util::RCObject::ref ( ) const
virtualinherited
void agg_util::RCObject::removeFromPool ( ) const
virtualinherited

If the object is in an auto-delete pool, remove it from the pool and force it to only delete when it's ref count goes to 0.

Useful when we desire a particular object stay around outside of the pool's lifetime.

Implements agg_util::RCObjectInterface.

Definition at line 116 of file RCObject.cc.

References NCML_ASSERT, and agg_util::RCObjectPool::remove().

Here is the call graph for this function:

void agg_util::RCObject::removePreDeleteCB ( UseCountHitZeroCB pCB)
inherited

Remove it exists.

If not, this unchanged.

Definition at line 164 of file RCObject.cc.

References BESDEBUG.

virtual void ncml_module::NCMLElement::setAttributes ( const XMLAttributeMap attrs)
pure virtual
void ncml_module::NCMLElement::setParser ( NCMLParser p)

Definition at line 166 of file NCMLElement.cc.

References _parser, and NCML_ASSERT_MSG.

int agg_util::RCObject::unref ( ) const
throw (
)
virtualinherited

Decrease the reference count by one.

If it goes from 1 to 0, delete this and this is no longer valid.

Returns
the new ref count. If it is 0, the caller knows the object was deleted.

It is illegal to unref() an object with a count of 0. We don't throw to allow use in dtors, so the caller is assumed not to do it!

const since the reference count is not part of the semantic constness of the rep

Implements agg_util::RCObjectInterface.

Definition at line 82 of file RCObject.cc.

References BESDEBUG, agg_util::RCObjectPool::release(), and agg_util::RCObject::toString().

Referenced by ncml_module::NetcdfElement::clearDimensions(), agg_util::RCPtr< ncml_module::AggregationElement >::operator=(), ncml_module::AggregationElement::~AggregationElement(), and ncml_module::NetcdfElement::VariableValueValidator::~VariableValueValidator().

Here is the call graph for this function:

bool ncml_module::NCMLElement::validateAttributes ( const XMLAttributeMap attrs,
const vector< string > &  validAttrs,
vector< string > *  pInvalidAttrs = 0,
bool  printInvalid = true,
bool  throwOnError = true 
)
virtual

Check that the given attributes are all in the valid set, otherwise fill in *pInvalidAttrs with the problematic ones if it's not null.

If pInvalidAttrs && printInvalid is set, we print the problematic attributes to BESDEBUG "ncml" channel If throwOnError is set, we throw a parse error instead of returning.

Returns
whether all attributes are in the valid set if not throw

Definition at line 191 of file NCMLElement.cc.

References _parser, areAllAttributesValid(), BESDEBUG, ncml_module::NCMLParser::getParseLineNumber(), getTypeName(), THROW_NCML_PARSE_ERROR, and VALID_PTR.

Referenced by ncml_module::RemoveElement::setAttributes(), ncml_module::ExplicitElement::setAttributes(), ncml_module::ReadMetadataElement::setAttributes(), ncml_module::VariableAggElement::setAttributes(), ncml_module::ValuesElement::setAttributes(), ncml_module::AttributeElement::setAttributes(), ncml_module::ScanElement::setAttributes(), ncml_module::DimensionElement::setAttributes(), ncml_module::VariableElement::setAttributes(), ncml_module::NetcdfElement::setAttributes(), and ncml_module::AggregationElement::setAttributes().

Here is the call graph for this function:

Member Data Documentation

NCMLParser* ncml_module::NCMLElement::_parser
protected

Definition at line 193 of file NCMLElement.h.

Referenced by ncml_module::AggregationElement::addAggregationVariable(), ncml_module::NetcdfElement::createResponseObject(), ncml_module::NetcdfElement::getAggMemberDataset(), ncml_module::ScanElement::getDatasetList(), ncml_module::VariableAggElement::getParentAggregation(), ncml_module::RemoveElement::handleBegin(), ncml_module::ExplicitElement::handleBegin(), ncml_module::ReadMetadataElement::handleBegin(), ncml_module::VariableAggElement::handleBegin(), ncml_module::ValuesElement::handleBegin(), ncml_module::AttributeElement::handleBegin(), ncml_module::ScanElement::handleBegin(), ncml_module::DimensionElement::handleBegin(), ncml_module::VariableElement::handleBegin(), ncml_module::NetcdfElement::handleBegin(), ncml_module::AggregationElement::handleBegin(), ncml_module::RemoveElement::handleContent(), ncml_module::ExplicitElement::handleContent(), ncml_module::ReadMetadataElement::handleContent(), ncml_module::ValuesElement::handleContent(), ncml_module::AttributeElement::handleContent(), ncml_module::DimensionElement::handleContent(), ncml_module::VariableElement::handleContent(), ncml_module::NetcdfElement::handleContent(), ncml_module::AggregationElement::handleContent(), handleContent(), ncml_module::ValuesElement::handleEnd(), ncml_module::AttributeElement::handleEnd(), ncml_module::ScanElement::handleEnd(), ncml_module::VariableElement::handleEnd(), ncml_module::NetcdfElement::handleEnd(), ncml_module::AggregationElement::handleEnd(), ncml_module::NetcdfElement::isValid(), line(), ncml_module::ValuesElement::setAttributes(), setParser(), validateAttributes(), and ~NCMLElement().


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