32 #include "ArrayAggregationBase.h"
33 #include "NCMLDebug.h"
35 #include "BESStopWatch.h"
36 #include "Marshaller.h"
37 #include "ConstraintEvaluator.h"
40 static const string DEBUG_CHANNEL(
"agg_util");
43 static const bool PRINT_CONSTRAINTS =
false;
50 ArrayAggregationBase::ArrayAggregationBase(
const libdap::Array& proto,
const AMDList& aggMembers,
51 std::auto_ptr<ArrayGetterInterface>& arrayGetter) :
52 Array(proto), _pSubArrayProto(static_cast<Array*>(const_cast<Array&>(proto).ptr_duplicate())),
53 _pArrayGetter(arrayGetter), _datasetDescs(aggMembers)
58 Array(rhs), _pSubArrayProto(0)
62 BESDEBUG(DEBUG_CHANNEL,
"ArrayAggregationBase() copy ctor called!" << endl);
67 ArrayAggregationBase::~ArrayAggregationBase()
73 ArrayAggregationBase::operator=(
const ArrayAggregationBase& rhs)
77 Array::operator=(rhs);
101 BESDEBUG_FUNC(DEBUG_CHANNEL,
" function entered..." << endl);
105 BESDEBUG_FUNC(DEBUG_CHANNEL,
"read_p() set, early exit!");
110 if (!(send_p() || is_in_selection())) {
111 BESDEBUG_FUNC(DEBUG_CHANNEL,
"Object not in output, skipping... name=" << name() << endl);
115 if (PRINT_CONSTRAINTS) {
116 BESDEBUG_FUNC(DEBUG_CHANNEL,
"Constraints on this Array are:" << endl);
123 if (PRINT_CONSTRAINTS) {
124 BESDEBUG_FUNC(DEBUG_CHANNEL,
"After transfer, constraints on the member template Array are: " << endl);
140 return _datasetDescs;
149 BESDEBUG(DEBUG_CHANNEL,
"Constraints for Array: " << name() <<
": " << oss.str() << endl);
155 VALID_PTR(_pSubArrayProto.get());
156 return *(_pSubArrayProto.get());
162 VALID_PTR(_pArrayGetter.get());
163 return *(_pArrayGetter.get());
169 std::auto_ptr<Array> pTemplateClone(
170 ((rhs._pSubArrayProto.get()) ? (
static_cast<Array*
>(rhs._pSubArrayProto->ptr_duplicate())) : (0)));
171 _pSubArrayProto = pTemplateClone;
174 std::auto_ptr<ArrayGetterInterface> pGetterClone((rhs._pArrayGetter.get()) ? (rhs._pArrayGetter->clone()) : (0));
175 _pArrayGetter = pGetterClone;
178 _datasetDescs = rhs._datasetDescs;
181 void ArrayAggregationBase::cleanup() throw ()
183 _datasetDescs.clear();
184 _datasetDescs.resize(0);
190 NCML_ASSERT_MSG(
false,
"** Unimplemented function: "
191 "ArrayAggregationBase::transferOutputConstraintsIntoGranuleTemplateHook(): "
192 "needs to be overridden and implemented in a base class.");
198 NCML_ASSERT_MSG(
false,
"** Unimplemented function: "
199 "ArrayAggregationBase::readConstrainedGranuleArraysAndAggregateData(): "
200 "needs to be overridden and implemented in a base class.");
static bool IsSet(const std::string &flagName)
see if the debug context flagName is set to true
virtual bool start(std::string name)
static void printConstraints(std::ostream &os, const libdap::Array &fromArray)
const AMDList & getDatasetList() const
virtual void transferOutputConstraintsIntoGranuleTemplateHook()
virtual void readConstrainedGranuleArraysAndAggregateDataHook()
libdap::Array & getGranuleTemplateArray()
ArrayAggregationBase(const libdap::Array &granuleProto, const AMDList &memberDatasets, std::auto_ptr< ArrayGetterInterface > &arrayGetter)
void printConstraints(const Array &fromArray)
const ArrayGetterInterface & getArrayGetterInterface() const
virtual ArrayAggregationBase * ptr_duplicate()
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...