bes Updated for version 3.20.13
|
Concrete class for NcML <netcdf> element. More...
#include <NetcdfElement.h>
Classes | |
class | VariableValueValidator |
Public Member Functions | |
void | addDimension (DimensionElement *dim) |
void | addPreDeleteCB (UseCountHitZeroCB *pCB) |
void | addVariableToValidateOnClose (libdap::BaseType *pNewVar, VariableElement *pVE) |
void | borrowResponseObject (BESDapResponse *pResponse) |
void | clearDimensions () |
virtual NetcdfElement * | clone () const |
const std::string & | coordValue () const |
void | createResponseObject (agg_util::DDSLoader::ResponseType type) |
VariableElement * | findVariableElementForLibdapVar (libdap::BaseType *pNewVar) |
RCPtr< agg_util::AggMemberDataset > | getAggMemberDataset () const |
AggregationElement * | getChildAggregation () const |
bool | getCoordValueAsDouble (double &val) const |
virtual libdap::DDS * | getDDS () |
virtual const libdap::DDS * | getDDS () const |
const std::vector< DimensionElement * > & | getDimensionElements () const |
const DimensionElement * | getDimensionInFullScope (const std::string &name) const |
const DimensionElement * | getDimensionInLocalScope (const std::string &name) const |
unsigned int | getNcoordsAsUnsignedInt () const |
AggregationElement * | getParentAggregation () const |
NetcdfElement * | getParentDataset () const |
bool | getProcessedMetadataDirective () const |
virtual int | getRefCount () const |
virtual const std::string & | getTypeName () const |
virtual void | handleBegin () |
virtual void | handleContent (const std::string &content) |
virtual void | handleEnd () |
bool | hasNcoords () const |
const std::string & | id () const |
bool | isValid () const |
int | line () const |
const std::string & | location () const |
const std::string & | ncoords () const |
NetcdfElement (const NetcdfElement &proto) | |
std::string | printDimensions () const |
virtual int | ref () const |
virtual void | removeFromPool () const |
void | removePreDeleteCB (UseCountHitZeroCB *pCB) |
virtual void | setAttributes (const XMLAttributeMap &attrs) |
void | setChildAggregation (AggregationElement *agg, bool throwIfExists=true) |
void | setParentAggregation (AggregationElement *parent) |
void | setParser (NCMLParser *p) |
void | setProcessedMetadataDirective () |
void | setVariableGotValues (libdap::BaseType *pVarToValidate, bool removeEntry) |
const std::string & | title () const |
virtual std::string | toString () const |
void | unborrowResponseObject (BESDapResponse *pResponse) |
virtual int | unref () const |
virtual bool | validateAttributes (const XMLAttributeMap &attrs, const std::vector< std::string > &validAttrs, std::vector< std::string > *pInvalidAttrs=0, bool printInvalid=true, bool throwOnError=true) |
Static Public Member Functions | |
static bool | areAllAttributesValid (const XMLAttributeMap &attrMap, const std::vector< std::string > &validAttrs, std::vector< std::string > *pInvalidAttributes=0) |
static bool | isCoordValueLexicographicallyLessThan (const NetcdfElement *pLHS, const NetcdfElement *pRHS) |
static bool | isLocationLexicographicallyLessThan (const NetcdfElement *pLHS, const NetcdfElement *pRHS) |
static bool | isValidAttribute (const std::vector< std::string > &validAttrs, const std::string &attr) |
static std::string | printAttributeIfNotEmpty (const std::string &attrName, const std::string &attrValue) |
Static Public Attributes | |
static const std::string | _sTypeName = "netcdf" |
static const std::vector< std::string > | _sValidAttributes = getValidAttributes() |
Protected Attributes | |
NCMLParser * | _parser |
Concrete class for NcML <netcdf> element.
This element specifies the location attribute for the local data file that we wrap and load into a DDX (DDS w/ AttrTable tree).
We keep a ptr to our containing NCMLParser to help with the differences needed if we are the root dataset element or not, in particular that the response object is either passed in to us (root) or loaded brandy new if we're the child of an aggregation.
Definition at line 62 of file NetcdfElement.h.
ncml_module::NetcdfElement::NetcdfElement | ( | ) |
Definition at line 59 of file NetcdfElement.cc.
ncml_module::NetcdfElement::NetcdfElement | ( | const NetcdfElement & | proto | ) |
Definition at line 66 of file NetcdfElement.cc.
|
virtual |
Definition at line 94 of file NetcdfElement.cc.
void ncml_module::NetcdfElement::addDimension | ( | DimensionElement * | dim | ) |
Add the given element to this scope. We maintain a strong reference, so the caller should respect the RCObject count and not delete it on us!
Definition at line 340 of file NetcdfElement.cc.
|
inherited |
Add uniquely. If it is added agan, the second time is ignored.
Definition at line 129 of file RCObject.cc.
void ncml_module::NetcdfElement::addVariableToValidateOnClose | ( | libdap::BaseType * | pNewVar, |
VariableElement * | pVE | ||
) |
Add the pNewvar created by pVE to this dataset's list of variables to validate for having values set upon closing (handleEnd() of this element). All new variables are required to have values at the time the dataset is closed or a parse error is thrown at that time.
pNewVar | the new variable to watch, used as a key to find pVE later |
pVE | the variable element that created the pNewVar, which contains whether the value of pNewVar has been set yet (since there's no direct way in BaseType to do that now). pVE->ref() will be called to keep pVE around sicne it will go out of scope after this call. On the ~NetcdfElement, pVE->unref() will be called to undo this. |
Definition at line 476 of file NetcdfElement.cc.
|
staticinherited |
Definition at line 229 of file NCMLElement.cc.
void ncml_module::NetcdfElement::borrowResponseObject | ( | BESDapResponse * | pResponse | ) |
Used by the NCMLParser to let us know to borrow the response object and not own it. Used for the root element only! Nested datasets will create and own their own!
Definition at line 249 of file NetcdfElement.cc.
void ncml_module::NetcdfElement::clearDimensions | ( | ) |
Clear the dimension table, releasing all strong references
Definition at line 366 of file NetcdfElement.cc.
|
virtual |
Make and return a copy of this. Used by the factory from a prototype.
Implements ncml_module::NCMLElement.
Definition at line 115 of file NetcdfElement.cc.
|
inline |
Definition at line 97 of file NetcdfElement.h.
void ncml_module::NetcdfElement::createResponseObject | ( | agg_util::DDSLoader::ResponseType | type | ) |
Called if this is a member of an aggregation (i.e. not root) to create a dynamic response object of the given type. This call or borrowResponseObject() must be called before this is used.
Definition at line 263 of file NetcdfElement.cc.
VariableElement * ncml_module::NetcdfElement::findVariableElementForLibdapVar | ( | libdap::BaseType * | pNewVar | ) |
If a VariableElement has been associated with a new var to validate, return it. If not, return null.
pNewVar | the libdap variable (key) to look up |
Definition at line 640 of file NetcdfElement.cc.
RCPtr< agg_util::AggMemberDataset > ncml_module::NetcdfElement::getAggMemberDataset | ( | ) | const |
Return a shared reference to the AggMemberDataset that encapsulates this dataset. If it doesn't exist in this instance yet, it is created and stored in this (semantically const accessor) If it does exist, a shared reference to the contained object is returned.
Definition at line 279 of file NetcdfElement.cc.
AggregationElement * ncml_module::NetcdfElement::getChildAggregation | ( | ) | const |
Return the raw pointer (or NULL) to our contained aggregation. Only guaranteed valid for the life of this object.
Definition at line 419 of file NetcdfElement.cc.
bool ncml_module::NetcdfElement::getCoordValueAsDouble | ( | double & | val | ) | const |
Parse the netcdf@coordValue attribute as a double. If successful, put the value in val and return true. If unsuccessful, val is unchanged and false is returned. ASSUMES: there is only ONE token in the coordValue field. TODO: look into loading multiple values later as needed.
val | output the parsed value here if possible |
Definition at line 457 of file NetcdfElement.cc.
|
virtual |
Non-const version to allow changes to the DDS. Do NOT delete the return value!
Definition at line 213 of file NetcdfElement.cc.
|
virtual |
Return the DDS for this dataset, loading it in if needed. (semantically const although the loaded DDS is cached).
Implements agg_util::DDSAccessInterface.
Definition at line 207 of file NetcdfElement.cc.
const std::vector< DimensionElement * > & ncml_module::NetcdfElement::getDimensionElements | ( | ) | const |
Get the list of dimension elements local to only this dataset, not its enclosing scope.
Definition at line 377 of file NetcdfElement.cc.
const DimensionElement * ncml_module::NetcdfElement::getDimensionInFullScope | ( | const std::string & | name | ) | const |
Definition at line 326 of file NetcdfElement.cc.
const DimensionElement * ncml_module::NetcdfElement::getDimensionInLocalScope | ( | const std::string & | name | ) | const |
Definition at line 310 of file NetcdfElement.cc.
unsigned int ncml_module::NetcdfElement::getNcoordsAsUnsignedInt | ( | ) | const |
Get the ncoords() field as a valid size. Throws: if !hasNCoords().
Definition at line 237 of file NetcdfElement.cc.
AggregationElement * ncml_module::NetcdfElement::getParentAggregation | ( | ) | const |
Definition at line 408 of file NetcdfElement.cc.
NetcdfElement * ncml_module::NetcdfElement::getParentDataset | ( | ) | const |
Return the next enclosing dataset for this, or NULL if we're the root. Basically traverse upwards through any aggregation parent to get containing datset.
Definition at line 398 of file NetcdfElement.cc.
|
inline |
Definition at line 136 of file NetcdfElement.h.
|
virtualinherited |
Get the current reference count
Implements agg_util::RCObjectInterface.
Definition at line 101 of file RCObject.cc.
|
virtual |
Return the type of the element, which should be: the same as ConcreteClassName::getTypeName()
Implements ncml_module::NCMLElement.
Definition at line 109 of file NetcdfElement.cc.
|
virtual |
Handle a begin on this element. Called after creation and it is assumed the attributes and _parser are already set.
Implements ncml_module::NCMLElement.
Definition at line 139 of file NetcdfElement.cc.
|
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.
content | the string of characters in the element content. |
Reimplemented from ncml_module::NCMLElement.
Definition at line 159 of file NetcdfElement.cc.
|
virtual |
Handle the closing of this element.
Implements ncml_module::NCMLElement.
Definition at line 168 of file NetcdfElement.cc.
|
inline |
Definition at line 106 of file NetcdfElement.h.
|
inline |
Definition at line 89 of file NetcdfElement.h.
|
static |
Compare the coordvalue fields of the two arguments and return true if lhs.coordValue() < rhs.coordValue() in a lexicographic string sense. Used for std::sort on vector<NetcdfElement*>
pLHS | the lefthandside of the less than Must not be null! |
pRHS | the righthandside of the less than Must not be null! |
Definition at line 501 of file NetcdfElement.cc.
|
static |
Compare the location fields of the two arguments and return true if lhs.location() < rhs.location() in a lexicographic string sense. Used for std::sort on vector<NetcdfElement*>
pLHS | the lefthandside of the less than must not be null! |
pRHS | the righthandside of the less than must not be null! |
Definition at line 491 of file NetcdfElement.cc.
bool ncml_module::NetcdfElement::isValid | ( | ) | const |
Definition at line 229 of file NetcdfElement.cc.
|
staticinherited |
Definition at line 217 of file NCMLElement.cc.
|
inherited |
Return the current parse line number. Shorthand
Definition at line 160 of file NCMLElement.cc.
|
inline |
Definition at line 85 of file NetcdfElement.h.
|
inline |
Definition at line 101 of file NetcdfElement.h.
|
staticinherited |
Helper for subclasses implementing toString().
Definition at line 212 of file NCMLElement.cc.
string ncml_module::NetcdfElement::printDimensions | ( | ) | const |
"Print" out the dimensions to a string
Definition at line 354 of file NetcdfElement.cc.
|
virtualinherited |
Increase the reference count by one. const since we do not consider the ref count part of the semantic constness of the rep
Implements agg_util::RCObjectInterface.
Definition at line 71 of file RCObject.cc.
|
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 106 of file RCObject.cc.
|
inherited |
Remove it exists. If not, this unchanged.
Definition at line 142 of file RCObject.cc.
|
virtual |
Set the attributes of this from the map.
attrs | the attribute map to set this class to. |
Implements ncml_module::NCMLElement.
Definition at line 120 of file NetcdfElement.cc.
void ncml_module::NetcdfElement::setChildAggregation | ( | AggregationElement * | agg, |
bool | throwIfExists = true |
||
) |
Set our aggregation to the given agg.
If there exists an aggregation already and !throwIfExists, agg will replace it, which might cause the previous one to be deleted.
If there exists one already and agg != NULL and throwIfExists, an exception will be thrown.
If agg == NULL, it always removes the strong reference to the previous, regardless of throwIfExists.
Definition at line 382 of file NetcdfElement.cc.
void ncml_module::NetcdfElement::setParentAggregation | ( | AggregationElement * | parent | ) |
Set my parent AggregationElement to parent. This is a weak reference.
Definition at line 413 of file NetcdfElement.cc.
|
inherited |
Definition at line 153 of file NCMLElement.cc.
|
inline |
Definition at line 141 of file NetcdfElement.h.
void ncml_module::NetcdfElement::setVariableGotValues | ( | libdap::BaseType * | pVarToValidate, |
bool | removeEntry | ||
) |
Lookup the VariableElement* associated with pVarToValidate via a previous addVariableToValidateOnClose() and call pVE->setGotValues() on the associated element so that it will be considered valid at handleEnd() of this element. Should be called when the values are set on pVarToValidate.
pVarToValidate | the variable which has had its deferred values set to be used as a key to lookup the associated VariableElement that created it. |
removeEntry | if the entry is found, remove it from the list as well as setting gotvalues. |
Definition at line 481 of file NetcdfElement.cc.
|
inline |
Definition at line 93 of file NetcdfElement.h.
|
virtual |
Return a string describing the element
Implements ncml_module::NCMLElement.
Definition at line 196 of file NetcdfElement.cc.
void ncml_module::NetcdfElement::unborrowResponseObject | ( | BESDapResponse * | pResponse | ) |
Kind of superfluous, but tells this object to clear its reference to pReponse, which had better match _response or we throw internal exception.
Definition at line 256 of file NetcdfElement.cc.
|
virtualinherited |
Decrease the reference count by one. If it goes from 1 to 0, delete this and this is no longer valid.
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 78 of file RCObject.cc.
|
virtualinherited |
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.
Definition at line 174 of file NCMLElement.cc.
|
protectedinherited |
Definition at line 187 of file NCMLElement.h.
|
static |
Definition at line 69 of file NetcdfElement.h.
|
static |
Definition at line 70 of file NetcdfElement.h.