30 #include "ArrayAggregationBase.h"
31 #include "NCMLDebug.h"
33 #include "BESStopWatch.h"
34 #include "Marshaller.h"
35 #include "ConstraintEvaluator.h"
38 static const string DEBUG_CHANNEL(
"agg_util");
41 static const bool PRINT_CONSTRAINTS =
false;
48 ArrayAggregationBase::ArrayAggregationBase(
const libdap::Array& proto,
const AMDList& aggMembers,
49 std::auto_ptr<ArrayGetterInterface>& arrayGetter) :
50 Array(proto), _pSubArrayProto(static_cast<Array*>(const_cast<Array&>(proto).ptr_duplicate())),
51 _pArrayGetter(arrayGetter), _datasetDescs(aggMembers)
56 Array(rhs), _pSubArrayProto(0)
60 BESDEBUG(DEBUG_CHANNEL,
"ArrayAggregationBase() copy ctor called!" << endl);
65 ArrayAggregationBase::~ArrayAggregationBase()
71 ArrayAggregationBase::operator=(
const ArrayAggregationBase& rhs)
75 Array::operator=(rhs);
97 if (BESISDEBUG(TIMING_LOG)) sw.
start(
"ArrayAggregationBase::read",
"");
99 BESDEBUG_FUNC(DEBUG_CHANNEL,
" function entered..." << endl);
103 BESDEBUG_FUNC(DEBUG_CHANNEL,
"read_p() set, early exit!");
108 if (!(send_p() || is_in_selection())) {
109 BESDEBUG_FUNC(DEBUG_CHANNEL,
"Object not in output, skipping... name=" << name() << endl);
113 if (PRINT_CONSTRAINTS) {
114 BESDEBUG_FUNC(DEBUG_CHANNEL,
"Constraints on this Array are:" << endl);
121 if (PRINT_CONSTRAINTS) {
122 BESDEBUG_FUNC(DEBUG_CHANNEL,
"After transfer, constraints on the member template Array are: " << endl);
138 return _datasetDescs;
147 BESDEBUG(DEBUG_CHANNEL,
"Constraints for Array: " << name() <<
": " << oss.str() << endl);
153 VALID_PTR(_pSubArrayProto.get());
154 return *(_pSubArrayProto.get());
160 VALID_PTR(_pArrayGetter.get());
161 return *(_pArrayGetter.get());
167 std::auto_ptr<Array> pTemplateClone(
168 ((rhs._pSubArrayProto.get()) ? (
static_cast<Array*
>(rhs._pSubArrayProto->ptr_duplicate())) : (0)));
169 _pSubArrayProto = pTemplateClone;
172 std::auto_ptr<ArrayGetterInterface> pGetterClone((rhs._pArrayGetter.get()) ? (rhs._pArrayGetter->clone()) : (0));
173 _pArrayGetter = pGetterClone;
176 _datasetDescs = rhs._datasetDescs;
179 void ArrayAggregationBase::cleanup() throw ()
181 _datasetDescs.clear();
182 _datasetDescs.resize(0);
188 NCML_ASSERT_MSG(
false,
"** Unimplemented function: "
189 "ArrayAggregationBase::transferOutputConstraintsIntoGranuleTemplateHook(): "
190 "needs to be overridden and implemented in a base class.");
196 NCML_ASSERT_MSG(
false,
"** Unimplemented function: "
197 "ArrayAggregationBase::readConstrainedGranuleArraysAndAggregateData(): "
198 "needs to be overridden and implemented in a base class.");