bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
|
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 |
static const std::vector< std::string > | _sValidAttributes |
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.
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!
|
inherited |
Add uniquely. If it is added agan, the second time is ignored.
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. |
|
staticinherited |
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!
void ncml_module::NetcdfElement::clearDimensions | ( | ) |
Clear the dimension table, releasing all strong references
|
virtual |
Make and return a copy of this. Used by the factory from a prototype.
Implements ncml_module::NCMLElement.
|
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.
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 |
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.
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.
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 |
|
virtual |
Non-const version to allow changes to the DDS. Do NOT delete the return value!
|
virtual |
Return the DDS for this dataset, loading it in if needed. (semantically const although the loaded DDS is cached).
Implements agg_util::DDSAccessInterface.
const std::vector< DimensionElement * > & ncml_module::NetcdfElement::getDimensionElements | ( | ) | const |
Get the list of dimension elements local to only this dataset, not its enclosing scope.
const DimensionElement * ncml_module::NetcdfElement::getDimensionInFullScope | ( | const std::string & | name | ) | const |
const DimensionElement * ncml_module::NetcdfElement::getDimensionInLocalScope | ( | const std::string & | name | ) | const |
unsigned int ncml_module::NetcdfElement::getNcoordsAsUnsignedInt | ( | ) | const |
Get the ncoords() field as a valid size. Throws: if !hasNCoords().
AggregationElement * ncml_module::NetcdfElement::getParentAggregation | ( | ) | const |
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.
|
inline |
Definition at line 136 of file NetcdfElement.h.
|
virtualinherited |
Get the current reference count
Implements agg_util::RCObjectInterface.
|
virtual |
Return the type of the element, which should be: the same as ConcreteClassName::getTypeName()
Implements ncml_module::NCMLElement.
|
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.
|
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.
|
virtual |
Handle the closing of this element.
Implements ncml_module::NCMLElement.
|
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! |
|
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! |
bool ncml_module::NetcdfElement::isValid | ( | ) | const |
|
staticinherited |
|
inherited |
Return the current parse line number. Shorthand
|
inline |
Definition at line 85 of file NetcdfElement.h.
|
inline |
Definition at line 101 of file NetcdfElement.h.
|
staticinherited |
Helper for subclasses implementing toString().
std::string ncml_module::NetcdfElement::printDimensions | ( | ) | const |
"Print" out the dimensions to a string
|
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.
|
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.
|
inherited |
Remove it exists. If not, this unchanged.
|
virtual |
Set the attributes of this from the map.
attrs | the attribute map to set this class to. |
Implements ncml_module::NCMLElement.
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.
void ncml_module::NetcdfElement::setParentAggregation | ( | AggregationElement * | parent | ) |
Set my parent AggregationElement to parent. This is a weak reference.
|
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. |
|
inline |
Definition at line 93 of file NetcdfElement.h.
|
virtual |
Return a string describing the element
Implements ncml_module::NCMLElement.
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.
|
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.
|
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.
|
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.