34 static const string DEBUG_CHANNEL(
"agg_util");
37 static const bool PRINT_CONSTRAINTS =
true;
44 const libdap::Array& proto,
46 std::auto_ptr<ArrayGetterInterface>& arrayGetter)
48 , _pSubArrayProto(static_cast<Array*>(const_cast<Array&>(proto).ptr_duplicate()))
49 , _pArrayGetter(arrayGetter)
50 , _datasetDescs(aggMembers)
61 "ArrayAggregationBase() copy ctor called!" <<
78 Array::operator=(rhs);
105 if (! (send_p() || is_in_selection()) )
108 "Object not in output, skipping... name=" <<
114 if (PRINT_CONSTRAINTS)
117 "Constraints on this Array are:" <<
125 if (PRINT_CONSTRAINTS)
128 "After transfer, constraints on the member template Array are: " <<
146 return _datasetDescs;
156 BESDEBUG(DEBUG_CHANNEL,
"Constraints for Array: " << name() <<
": " << oss.str() << endl);
163 return *(_pSubArrayProto.get());
171 return *(_pArrayGetter.get());
178 std::auto_ptr<Array> pTemplateClone( ( (rhs._pSubArrayProto.get()) ?
179 (static_cast<Array*>(rhs._pSubArrayProto->ptr_duplicate())) :
181 _pSubArrayProto = pTemplateClone;
184 std::auto_ptr<ArrayGetterInterface> pGetterClone(
185 (rhs._pArrayGetter.get()) ?
186 ( rhs._pArrayGetter->clone() ) :
188 _pArrayGetter = pGetterClone;
191 _datasetDescs = rhs._datasetDescs;
195 ArrayAggregationBase::cleanup() throw()
197 _datasetDescs.clear();
198 _datasetDescs.resize(0);
206 "** Unimplemented function: "
207 "ArrayAggregationBase::transferOutputConstraintsIntoGranuleTemplateHook(): "
208 "needs to be overridden and implemented in a base class.");
216 "** Unimplemented function: "
217 "ArrayAggregationBase::readConstrainedGranuleArraysAndAggregateData(): "
218 "needs to be overridden and implemented in a base class.");
virtual bool read()
Base implementation that works for both joinNew and joinExisting.
ArrayAggregationBase & operator=(const ArrayAggregationBase &rhs)
#define BESDEBUG_FUNC(channel, info)
libdap::Array & getGranuleTemplateArray()
Accessor for subclasses Note this is protected, so not const! Subclasses may mutate the return hence ...
virtual ArrayAggregationBase * ptr_duplicate()
virtual constructor i.e.
void printConstraints(const Array &fromArray)
Print out the constraints on fromArray to the debug channel.
ArrayAggregationBase(const libdap::Array &granuleProto, const AMDList &memberDatasets, std::auto_ptr< ArrayGetterInterface > &arrayGetter)
Construct the base class using the given parameters.
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...
#define NCML_ASSERT_MSG(cond, msg)
Helper class hierarchy for acquiring variable of a certain type from a DDS.
Base class for subclasses of libdap::Array which perform aggregation on a list of AggMemberDatasets w...
const ArrayGetterInterface & getArrayGetterInterface() const
Accessor for subclasses Note this is protected, so not const! Subclasses may mutate the return hence ...
std::vector< RCPtr< AggMemberDataset > > AMDList
const AMDList & getDatasetList() const
Get the list of AggMemberDataset's that comprise this aggregation.
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
virtual ~ArrayAggregationBase()
virtual void readConstrainedGranuleArraysAndAggregateDataHook()
The meat of the subclass impl of read().
virtual void transferOutputConstraintsIntoGranuleTemplateHook()
subclass hook from read() to setup constraints on inner dims correctly
static void printConstraints(std::ostream &os, const libdap::Array &fromArray)
Stream out the current constraints for all the dimensions in the Array.