|
OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
|
A parameterized subclass of libdap::Array that allows us to apply constraints on NcML-specified data prior to serialization. More...
#include <NCMLArray.h>


Public Member Functions | |
| virtual void | cacheCurrentConstraints () |
| Store the current super Array shape as the current constraints so we remember. More... | |
| virtual void | cacheSuperclassStateIfNeeded () |
| Required by subclasses to copy the original data values locally. More... | |
| virtual void | cacheUnconstrainedDimensions () |
| virtual void | copyDataFrom (libdap::Array &from) |
| Copy the rep from the given Array. More... | |
| virtual Shape | getSuperShape () const |
| Get the current dimensions of our superclass Array as a Shape object. More... | |
| virtual bool | haveConstraintsChangedSinceLastRead () const |
| Return whether the constraints used to create Vector._buf for the last read() have changed, meaning we need to recompute Vector._buf using the new values. More... | |
| virtual bool | isConstrained () const |
| Return whether the superclass Array has been constrained along any dimensions. More... | |
| virtual bool | isDataCached () const |
| NCMLArray () | |
| NCMLArray (const string &name) | |
| NCMLArray (const NCMLArray< T > &proto) | |
| NCMLArray< T > & | operator= (const NCMLArray< T > &rhs) |
| virtual NCMLArray< T > * | ptr_duplicate () |
| Override virtual constructor, deep clone. More... | |
| virtual bool | read () |
| If there are no constraints and this is the first call to read(), we will do nothing, assuming the sueprclasses have everything under control. More... | |
| virtual bool | read_p () |
| Override to return false if we have uncomputed constraints and only true if the current constraints match the Vector value buffer. More... | |
| virtual void | set_read_p (bool state) |
| Override to disable setting of this flag. More... | |
| virtual bool | set_value (dods_byte *val, int sz) |
| virtual bool | set_value (vector< dods_byte > &val, int sz) |
| virtual bool | set_value (dods_int16 *val, int sz) |
| virtual bool | set_value (vector< dods_int16 > &val, int sz) |
| virtual bool | set_value (dods_uint16 *val, int sz) |
| virtual bool | set_value (vector< dods_uint16 > &val, int sz) |
| virtual bool | set_value (dods_int32 *val, int sz) |
| virtual bool | set_value (vector< dods_int32 > &val, int sz) |
| virtual bool | set_value (dods_uint32 *val, int sz) |
| virtual bool | set_value (vector< dods_uint32 > &val, int sz) |
| virtual bool | set_value (dods_float32 *val, int sz) |
| virtual bool | set_value (vector< dods_float32 > &val, int sz) |
| virtual bool | set_value (dods_float64 *val, int sz) |
| virtual bool | set_value (vector< dods_float64 > &val, int sz) |
| virtual bool | set_value (string *val, int sz) |
| virtual bool | set_value (vector< string > &val, int sz) |
| virtual | ~NCMLArray () |
| Destroy any locally cached data. More... | |
Static Public Member Functions | |
| static auto_ptr< NCMLBaseArray > | createFromArray (const libdap::Array &proto) |
| Make a new NCMLArray<T> from the given proto, using the Array interface. More... | |
Protected Member Functions | |
| virtual void | cacheValuesIfNeeded () |
| The first time we get a read(), we want to grab the current state of the superclass Array and Vector and cache them locally before we apply any needed constraints. More... | |
| virtual void | createAndSetConstrainedValueBuffer () |
| If we have constraints that are not the same as the constraints on the last read() call (or if this is first read() call), use the super Array's current constrained dimension values to set Vector->val2buf() with the proper constrained data. More... | |
Protected Attributes | |
| Shape * | _currentConstraints |
| Shape * | _noConstraints |
A parameterized subclass of libdap::Array that allows us to apply constraints on NcML-specified data prior to serialization.
All the code is in the .h, so no .cc is defined.
This class caches the full set of data values of basic type T for the unconstrained super Array shape. It forces read_p() to ALWAYS be false to force a call of this->read() prior to any serialization of super Vector's data buffer.
In a read() call, if constraints have been applied to the Array superclass, this class will effect the Vector superclass data buffer (Vector._buf) in order to calculate and store the constrained data into Vector._buf so serialize() passes the constrained data properly. It maintains a copy of the full set of data, however, in case constraints are later removed or changed. It maintains a copy of the constrained shape used to generate the current Vector._buf so that on subsequent read() calls it can check to see if the constraints have changed and if so recompute Vector._buf.
We use a template on the underlying data type stored, such as dods_byte, dods_int32, etc. Note that this can ALSO be std::string, in which case Vector does special processing. We need to be aware of this in processing data.
Definition at line 83 of file NCMLArray.h.
|
inline |
Definition at line 88 of file NCMLArray.h.
Referenced by ncml_module::NCMLArray< T >::ptr_duplicate().
|
inlineexplicit |
Definition at line 94 of file NCMLArray.h.
|
inlineexplicit |
Definition at line 100 of file NCMLArray.h.
|
inlinevirtual |
Destroy any locally cached data.
Definition at line 108 of file NCMLArray.h.
|
virtualinherited |
Store the current super Array shape as the current constraints so we remember.
Definition at line 188 of file NCMLBaseArray.cc.
References ncml_module::NCMLBaseArray::_currentConstraints.
Referenced by ncml_module::NCMLBaseArray::read().
|
virtualinherited |
Required by subclasses to copy the original data values locally.
Definition at line 217 of file NCMLBaseArray.cc.
References ncml_module::NCMLBaseArray::_noConstraints, ncml_module::NCMLBaseArray::cacheUnconstrainedDimensions(), ncml_module::NCMLBaseArray::cacheValuesIfNeeded(), and NCML_ASSERT.
Referenced by ncml_module::NCMLBaseArray::read().

|
virtualinherited |
Definition at line 201 of file NCMLBaseArray.cc.
References ncml_module::NCMLBaseArray::_noConstraints, and ncml_module::Shape::setToUnconstrained().
Referenced by ncml_module::NCMLBaseArray::cacheSuperclassStateIfNeeded().

|
inlineprotectedvirtual |
The first time we get a read(), we want to grab the current state of the superclass Array and Vector and cache them locally before we apply any needed constraints.
ASSUME: that the current value of the _buf in Vector super is the FULL set of values for the UNCONSTRAINED Array. We also grab the dimensions from the super Array, but realize that these may be already constrained. For this reason, we cache the UNCONSTRAINED shape (i.e. the d.size() for all dimensions) as well as the full set of current dimensions, constrained or not. The latter tells of if constraints have been applied and if we need to compute a new _buf in read().
Implements ncml_module::NCMLBaseArray.
Definition at line 298 of file NCMLArray.h.
References ncml_module::NCMLBaseArray::_noConstraints, BESDEBUG, ncml_module::Shape::getUnconstrainedSpaceSize(), NCML_ASSERT, and NCML_ASSERT_MSG.

|
inlinevirtual |
Copy the rep from the given Array.
This includes:
Implements ncml_module::NCMLBaseArray.
Definition at line 143 of file NCMLArray.h.
References NCML_ASSERT, and VALID_PTR.
|
inlineprotectedvirtual |
If we have constraints that are not the same as the constraints on the last read() call (or if this is first read() call), use the super Array's current constrained dimension values to set Vector->val2buf() with the proper constrained data.
ASSUMES: cacheSuperclassStateIfNeeded() has already been called once so that this instance's state contains all the unconstrained data values and shape.
Implements ncml_module::NCMLBaseArray.
Definition at line 338 of file NCMLArray.h.
References ncml_module::NCMLBaseArray::_noConstraints, ncml_module::Shape::beginSpaceEnumeration(), BESDEBUG, ncml_module::Shape::endSpaceEnumeration(), ncml_module::Shape::getConstrainedSpaceSize(), ncml_module::Shape::getRowMajorIndex(), ncml_module::NCMLBaseArray::getSuperShape(), THROW_NCML_INTERNAL_ERROR, and VALID_PTR.

|
staticinherited |
Make a new NCMLArray<T> from the given proto, using the Array interface.
It uses the underlying proto.var() BaseType to figure out the type parameter T for the returned class, hence the return of the generic superclass pointer.
All the data values in the proto value buffer are copied into the returned copy. This ASSUMES that the data currently in proto's Vector _buf is valid for the UNCONSTRAINED data case.
It also copies the template arg, attribute table, and shape of the proto.
It uses the underlying proto.var() BaseType to figure out the type parameter T for the returned class, hence the return of the generic superclass pointer.
All the data values in the proto value buffer are copied into the returned copy. This ASSUMES that the data currently in proto's Vector _buf is valid for the UNCONSTRAINED data case.
Definition at line 53 of file NCMLBaseArray.cc.
References BESDEBUG, ncml_module::MyBaseTypeFactory::makeVariable(), NCML_ASSERT_MSG, and VALID_PTR.

|
virtualinherited |
Get the current dimensions of our superclass Array as a Shape object.
Definition at line 160 of file NCMLBaseArray.cc.
Referenced by ncml_module::NCMLArray< T >::createAndSetConstrainedValueBuffer(), ncml_module::NCMLBaseArray::haveConstraintsChangedSinceLastRead(), and ncml_module::NCMLBaseArray::isConstrained().
|
virtualinherited |
Return whether the constraints used to create Vector._buf for the last read() have changed, meaning we need to recompute Vector._buf using the new values.
Definition at line 174 of file NCMLBaseArray.cc.
References ncml_module::NCMLBaseArray::_currentConstraints, and ncml_module::NCMLBaseArray::getSuperShape().
Referenced by ncml_module::NCMLBaseArray::read(), and ncml_module::NCMLBaseArray::read_p().

|
virtualinherited |
Return whether the superclass Array has been constrained along any dimensions.
Definition at line 167 of file NCMLBaseArray.cc.
References ncml_module::NCMLBaseArray::getSuperShape(), and ncml_module::Shape::isConstrained().

|
inlinevirtual |
Implements ncml_module::NCMLBaseArray.
Definition at line 174 of file NCMLArray.h.
|
inline |
Definition at line 114 of file NCMLArray.h.
References ncml_module::NCMLBaseArray::operator=().

|
inlinevirtual |
Override virtual constructor, deep clone.
Definition at line 131 of file NCMLArray.h.
References ncml_module::NCMLArray< T >::NCMLArray().

|
virtualinherited |
If there are no constraints and this is the first call to read(), we will do nothing, assuming the sueprclasses have everything under control.
If there are constraints, this function will create the correct buffer in Vector with the constrained data, generated from cached local values gathered to be from the unconstrained state.
The first call to read() will assume the CURRENT Vector buffer has ALL values (unconstrained) and store a local copy before generating a Vector buffer for the current constraints.
After this call, the caller can be assured that the Vector's data buffer has properly constrained data matching the current super Array's constraints. Subsequent calls to read() will see if the constraints used to create the Vector data buffer have changed and if so recompute a new Vector buffer from the locally cached values.
Definition at line 138 of file NCMLBaseArray.cc.
References BESDEBUG, ncml_module::NCMLBaseArray::cacheCurrentConstraints(), ncml_module::NCMLBaseArray::cacheSuperclassStateIfNeeded(), ncml_module::NCMLBaseArray::createAndSetConstrainedValueBuffer(), and ncml_module::NCMLBaseArray::haveConstraintsChangedSinceLastRead().

|
virtualinherited |
Override to return false if we have uncomputed constraints and only true if the current constraints match the Vector value buffer.
Definition at line 123 of file NCMLBaseArray.cc.
References ncml_module::NCMLBaseArray::haveConstraintsChangedSinceLastRead().

|
virtualinherited |
Override to disable setting of this flag.
We will leave it false unless the constraints match the Vector value buffer.
Definition at line 131 of file NCMLBaseArray.cc.
|
inlinevirtual |
Definition at line 204 of file NCMLArray.h.
References NCMLARRAY_CHECK_ARRAY_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 209 of file NCMLArray.h.
References NCMLARRAY_CHECK_VECTOR_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 214 of file NCMLArray.h.
References NCMLARRAY_CHECK_ARRAY_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 219 of file NCMLArray.h.
References NCMLARRAY_CHECK_VECTOR_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 224 of file NCMLArray.h.
References NCMLARRAY_CHECK_ARRAY_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 229 of file NCMLArray.h.
References NCMLARRAY_CHECK_VECTOR_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 234 of file NCMLArray.h.
References NCMLARRAY_CHECK_ARRAY_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 239 of file NCMLArray.h.
References NCMLARRAY_CHECK_VECTOR_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 244 of file NCMLArray.h.
References NCMLARRAY_CHECK_ARRAY_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 249 of file NCMLArray.h.
References NCMLARRAY_CHECK_VECTOR_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 254 of file NCMLArray.h.
References NCMLARRAY_CHECK_ARRAY_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 259 of file NCMLArray.h.
References NCMLARRAY_CHECK_VECTOR_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 264 of file NCMLArray.h.
References NCMLARRAY_CHECK_ARRAY_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 269 of file NCMLArray.h.
References NCMLARRAY_CHECK_VECTOR_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 274 of file NCMLArray.h.
References NCMLARRAY_CHECK_ARRAY_TYPE_THEN_CALL_SUPER.
|
inlinevirtual |
Definition at line 279 of file NCMLArray.h.
References NCMLARRAY_CHECK_VECTOR_TYPE_THEN_CALL_SUPER.
|
protectedinherited |
Definition at line 158 of file NCMLBaseArray.h.
Referenced by ncml_module::NCMLBaseArray::cacheCurrentConstraints(), and ncml_module::NCMLBaseArray::haveConstraintsChangedSinceLastRead().
|
protectedinherited |
Definition at line 154 of file NCMLBaseArray.h.
Referenced by ncml_module::NCMLBaseArray::cacheSuperclassStateIfNeeded(), ncml_module::NCMLBaseArray::cacheUnconstrainedDimensions(), ncml_module::NCMLArray< T >::cacheValuesIfNeeded(), and ncml_module::NCMLArray< T >::createAndSetConstrainedValueBuffer().