bes  Updated for version 3.20.6
ncml_module::NetcdfElement::VariableValueValidator Class Reference

#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)
 
VariableElementfindVariableElementForLibdapVar (libdap::BaseType *pNewVar)
 
void removeVariableToValidate (libdap::BaseType *pVarToRemove)
 
void setVariableGotValues (libdap::BaseType *pVarToValidate)
 
bool validate ()
 
 VariableValueValidator (NetcdfElement *pParent)
 
 ~VariableValueValidator ()
 

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 411 of file NetcdfElement.h.

Constructor & Destructor Documentation

◆ ~VariableValueValidator()

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

Will decrement the ref count of all contained VariableElement's

Returns

Definition at line 589 of file NetcdfElement.cc.

Member Function Documentation

◆ addVariableToValidate()

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 602 of file NetcdfElement.cc.

◆ findVariableElementForLibdapVar()

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 682 of file NetcdfElement.cc.

◆ removeVariableToValidate()

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 617 of file NetcdfElement.cc.

◆ 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 629 of file NetcdfElement.cc.

◆ validate()

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 645 of file NetcdfElement.cc.


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