OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
ncml_module::NCMLBaseArray Class Referenceabstract

#include <NCMLBaseArray.h>

Inheritance diagram for ncml_module::NCMLBaseArray:
Inheritance graph
Collaboration diagram for ncml_module::NCMLBaseArray:
Collaboration graph

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 cacheValuesIfNeeded ()=0
 Must copy the unconstrained current values of the proper type within Vector into the local instance. More...
 
virtual void copyDataFrom (libdap::Array &from)=0
 Copy the data values from the given array, assuming the type matches the template type T of the subclass. More...
 
virtual void createAndSetConstrainedValueBuffer ()=0
 Given the current Shape of the Array, generate the constrained value buffer and set it into the Vector superclass rep for proper serialize(). 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 =0
 
 NCMLBaseArray ()
 
 NCMLBaseArray (const std::string &name)
 
 NCMLBaseArray (const NCMLBaseArray &proto)
 
NCMLBaseArrayoperator= (const NCMLBaseArray &rhs)
 
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 ~NCMLBaseArray ()
 

Static Public Member Functions

static auto_ptr< NCMLBaseArraycreateFromArray (const libdap::Array &proto)
 Make a new NCMLArray<T> from the given proto, using the Array interface. More...
 

Protected Attributes

Shape_currentConstraints
 
Shape_noConstraints
 

Detailed Description

Definition at line 44 of file NCMLBaseArray.h.

Constructor & Destructor Documentation

ncml_module::NCMLBaseArray::NCMLBaseArray ( )

Definition at line 77 of file NCMLBaseArray.cc.

ncml_module::NCMLBaseArray::NCMLBaseArray ( const std::string &  name)
explicit

Definition at line 85 of file NCMLBaseArray.cc.

ncml_module::NCMLBaseArray::NCMLBaseArray ( const NCMLBaseArray proto)
explicit

Definition at line 92 of file NCMLBaseArray.cc.

ncml_module::NCMLBaseArray::~NCMLBaseArray ( )
virtual

Definition at line 100 of file NCMLBaseArray.cc.

Member Function Documentation

void ncml_module::NCMLBaseArray::cacheCurrentConstraints ( )
virtual

Store the current super Array shape as the current constraints so we remember.

Definition at line 188 of file NCMLBaseArray.cc.

References _currentConstraints.

Referenced by read().

void ncml_module::NCMLBaseArray::cacheSuperclassStateIfNeeded ( )
virtual

Required by subclasses to copy the original data values locally.

Definition at line 217 of file NCMLBaseArray.cc.

References _noConstraints, cacheUnconstrainedDimensions(), cacheValuesIfNeeded(), and NCML_ASSERT.

Referenced by read().

Here is the call graph for this function:

void ncml_module::NCMLBaseArray::cacheUnconstrainedDimensions ( )
virtual

Definition at line 201 of file NCMLBaseArray.cc.

References _noConstraints, and ncml_module::Shape::setToUnconstrained().

Referenced by cacheSuperclassStateIfNeeded().

Here is the call graph for this function:

virtual void ncml_module::NCMLBaseArray::cacheValuesIfNeeded ( )
pure virtual

Must copy the unconstrained current values of the proper type within Vector into the local instance.

Implemented in ncml_module::NCMLArray< T >.

Referenced by cacheSuperclassStateIfNeeded().

virtual void ncml_module::NCMLBaseArray::copyDataFrom ( libdap::Array &  from)
pure virtual

Copy the data values from the given array, assuming the type matches the template type T of the subclass.

If not, then exception.

Implemented in ncml_module::NCMLArray< T >.

virtual void ncml_module::NCMLBaseArray::createAndSetConstrainedValueBuffer ( )
pure virtual

Given the current Shape of the Array, generate the constrained value buffer and set it into the Vector superclass rep for proper serialize().

Implemented in ncml_module::NCMLArray< T >.

Referenced by read().

auto_ptr< NCMLBaseArray > ncml_module::NCMLBaseArray::createFromArray ( const libdap::Array &  protoC)
static

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.

Note
This is used for handling problems with renaming an NCArray prior to read() loading the data, forcing us to call read() on a rename, thus breaking constraints. To handle this error, we copy the data into our NCMLArray<T> in order to handle the constraints ourselves.

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.

Note
This is used for handling problems with renaming an NCArray prior to read() loading the data, forcing us to call read() on a rename, thus breaking constraints. To handle this error, we copy the data into our NCMLArray<T> in order to handle the constraints ourselves.

Definition at line 53 of file NCMLBaseArray.cc.

References BESDEBUG, ncml_module::MyBaseTypeFactory::makeVariable(), NCML_ASSERT_MSG, and VALID_PTR.

Here is the call graph for this function:

Shape ncml_module::NCMLBaseArray::getSuperShape ( ) const
virtual

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(), haveConstraintsChangedSinceLastRead(), and isConstrained().

bool ncml_module::NCMLBaseArray::haveConstraintsChangedSinceLastRead ( ) const
virtual

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 _currentConstraints, and getSuperShape().

Referenced by read(), and read_p().

Here is the call graph for this function:

bool ncml_module::NCMLBaseArray::isConstrained ( ) const
virtual

Return whether the superclass Array has been constrained along any dimensions.

Definition at line 167 of file NCMLBaseArray.cc.

References getSuperShape(), and ncml_module::Shape::isConstrained().

Here is the call graph for this function:

virtual bool ncml_module::NCMLBaseArray::isDataCached ( ) const
pure virtual
Returns
whether we have the unconstrained data cached yet.

Implemented in ncml_module::NCMLArray< T >.

NCMLBaseArray & ncml_module::NCMLBaseArray::operator= ( const NCMLBaseArray rhs)

Definition at line 106 of file NCMLBaseArray.cc.

Referenced by ncml_module::NCMLArray< T >::operator=().

bool ncml_module::NCMLBaseArray::read ( )
virtual

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, cacheCurrentConstraints(), cacheSuperclassStateIfNeeded(), createAndSetConstrainedValueBuffer(), and haveConstraintsChangedSinceLastRead().

Here is the call graph for this function:

bool ncml_module::NCMLBaseArray::read_p ( )
virtual

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 haveConstraintsChangedSinceLastRead().

Here is the call graph for this function:

void ncml_module::NCMLBaseArray::set_read_p ( bool  state)
virtual

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.

Member Data Documentation

Shape* ncml_module::NCMLBaseArray::_currentConstraints
protected

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