OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
ncml_module::NetcdfElement::VariableValueValidator Class Reference

Inner class for keeping track of new variables created within the context of this dataset for which we do not get <values> set up front. More...

#include <NetcdfElement.h>

Collaboration diagram for ncml_module::NetcdfElement::VariableValueValidator:
Collaboration graph

Classes

class  VVVEntry
 

Public Member Functions

void addVariableToValidate (libdap::BaseType *pNewVar, VariableElement *pVE)
 Add a validation entry for the given VariableElement and the actual variable that it has created and added to the DDS. More...
 
VariableElementfindVariableElementForLibdapVar (libdap::BaseType *pNewVar)
 If a VariableElement has been associated with a new var to validate, return it. More...
 
void removeVariableToValidate (libdap::BaseType *pVarToRemove)
 Remove an entry previously added under the key pVarToRemove with addVariableToValidate. More...
 
void setVariableGotValues (libdap::BaseType *pVarToValidate)
 Lookup the VariableElement pVE associated with the given pVarToValidate and call pVE->setGotValues() on it to validate it. More...
 
bool validate ()
 Make sure all the entries has had their values set else throw a parse error explaining which variable has not so the author can fix the error. More...
 
 VariableValueValidator (NetcdfElement *pParent)
 
 ~VariableValueValidator ()
 Will decrement the ref count of all contained VariableElement's. More...
 

Detailed Description

Inner class for keeping track of new variables created within the context of this dataset for which we do not get <values> set up front.

This should really only happen in the case of a "placeholder" array variable that acts as a coordinate variable for a joinNew aggregation where the author desires setting the metadata for the new dimension's map vector.

Callers will access this via methods in NetcdfElement.

If a new VariableElement is created and refers to a new variable but which has not had its value set by the handleEnd() of the VariableElement, it will be placed into an instance of this class (a member variable of this). The ref count of the element will be increased on addition and will be decremented when the VVV is destroyed (along with the containing NetcdfElement).

The AggregationElement processParentDatasetComplete() should inform this NetcdfElement once it sets the values on an entry in the VVV and the VVV instance will be updated to reflect that entry as having been validated.

VVV.validate() will be called in NetcdfElement::handleEnd() AFTER the aggregations have had their processParentDatasetComplete() called. If any entries in the VVV have NOT had their values set by this point, the validate will throw a parse error explaining the issue to maintain integrity of the libdap variables (and avoid cryptic internal errors much later down the line).

Definition at line 396 of file NetcdfElement.h.

Constructor & Destructor Documentation

ncml_module::NetcdfElement::VariableValueValidator::VariableValueValidator ( NetcdfElement pParent)

Definition at line 691 of file NetcdfElement.cc.

ncml_module::NetcdfElement::VariableValueValidator::~VariableValueValidator ( )

Will decrement the ref count of all contained VariableElement's.

Returns

Definition at line 697 of file NetcdfElement.cc.

References ncml_module::NetcdfElement::VariableValueValidator::VVVEntry::_pVarElt, ncml_module::NetcdfElement::VariableValueValidator::VVVEntry::clear(), and agg_util::RCObject::unref().

Here is the call graph for this function:

Member Function Documentation

void ncml_module::NetcdfElement::VariableValueValidator::addVariableToValidate ( libdap::BaseType *  pNewVar,
VariableElement pVE 
)

Add a validation entry for the given VariableElement and the actual variable that it has created and added to the DDS.

pVE->ref() will be called to make sure the element stays around after the parser has deref() it.

Parameters
pNewVarthe actual libdap variable that was created and is currently in the DDS of this dataset (in _response). Should not be null.
pVEthe VariableElement that created it. pVE->checkGotValues() will determine whether the entry has been validated. pVE->ref() will be called to up the ref count. Should not be null.

Definition at line 712 of file NetcdfElement.cc.

References NCML_ASSERT_MSG, agg_util::RCObject::ref(), and VALID_PTR.

Referenced by ncml_module::NetcdfElement::addVariableToValidateOnClose().

Here is the call graph for this function:

VariableElement * ncml_module::NetcdfElement::VariableValueValidator::findVariableElementForLibdapVar ( libdap::BaseType *  pNewVar)

If a VariableElement has been associated with a new var to validate, return it.

If not, return null.

Parameters
pNewVarthe libdap variable (key) to look up
Returns
the associated VariableElement for pNewVar, else null if not set with addVariableToValidate.

Definition at line 800 of file NetcdfElement.cc.

References ncml_module::NetcdfElement::VariableValueValidator::VVVEntry::_pVarElt, and VALID_PTR.

Referenced by ncml_module::NetcdfElement::findVariableElementForLibdapVar().

void ncml_module::NetcdfElement::VariableValueValidator::removeVariableToValidate ( libdap::BaseType *  pVarToRemove)

Remove an entry previously added under the key pVarToRemove with addVariableToValidate.

Will unref() the VariableElement portion.

Parameters
pVarToRemove

Definition at line 727 of file NetcdfElement.cc.

Referenced by ncml_module::NetcdfElement::setVariableGotValues().

void ncml_module::NetcdfElement::VariableValueValidator::setVariableGotValues ( libdap::BaseType *  pVarToValidate)

Lookup the VariableElement pVE associated with the given pVarToValidate and call pVE->setGotValues() on it to validate it.

Parameters
pVarToValidatea non-null variable that was entered with addVariableToValidate
Exceptions
Aninternal error is thrown if pVarToValidate was not already added.

Definition at line 742 of file NetcdfElement.cc.

References ncml_module::NetcdfElement::VariableValueValidator::VVVEntry::_pVarElt, NCML_ASSERT_MSG, ncml_module::VariableElement::setGotValues(), and VALID_PTR.

Referenced by ncml_module::NetcdfElement::setVariableGotValues().

Here is the call graph for this function:

bool ncml_module::NetcdfElement::VariableValueValidator::validate ( )

Make sure all the entries has had their values set else throw a parse error explaining which variable has not so the author can fix the error.

On success return true.

Returns
whether all contained variables have values.

Definition at line 758 of file NetcdfElement.cc.

References ncml_module::NetcdfElement::VariableValueValidator::VVVEntry::_pNewVar, ncml_module::NetcdfElement::VariableValueValidator::VVVEntry::_pVarElt, ncml_module::VariableElement::checkGotValues(), and THROW_NCML_PARSE_ERROR.

Referenced by ncml_module::NetcdfElement::handleEnd().

Here is the call graph for this function:


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