32#include <libdap/Marshaller.h>
33#include <libdap/ConstraintEvaluator.h>
35#include "ArrayAggregationBase.h"
38#include "BESStopWatch.h"
41#define DEBUG_CHANNEL "agg_util"
45static const bool PRINT_CONSTRAINTS =
false;
53 Array(proto), _pSubArrayProto(dynamic_cast<Array*>(const_cast<Array&>(proto).ptr_duplicate())),
54 _pArrayGetter(std::move(arrayGetter)), _datasetDescs(std::move(aggMembers))
63 BESDEBUG(DEBUG_CHANNEL,
"ArrayAggregationBase() copy ctor called!" << endl);
68ArrayAggregationBase::~ArrayAggregationBase()
74ArrayAggregationBase::operator=(
const ArrayAggregationBase& rhs)
78 Array::operator=(rhs);
102 BESDEBUG_FUNC(DEBUG_CHANNEL,
" function entered..." << endl);
106 BESDEBUG_FUNC(DEBUG_CHANNEL,
"read_p() set, early exit!");
111 if (!(send_p() || is_in_selection())) {
112 BESDEBUG_FUNC(DEBUG_CHANNEL,
"Object not in output, skipping... name=" << name() << endl);
117 if (PRINT_CONSTRAINTS) {
118 BESDEBUG_FUNC(DEBUG_CHANNEL,
"Constraints on this Array are:" << endl);
127 if (PRINT_CONSTRAINTS) {
128 BESDEBUG_FUNC(DEBUG_CHANNEL,
"After transfer, constraints on the member template Array are: " << endl);
145 return _datasetDescs;
154 BESDEBUG(DEBUG_CHANNEL,
"Constraints for Array: " << name() <<
": " << oss.str() << endl);
160 VALID_PTR(_pSubArrayProto.get());
161 return *(_pSubArrayProto.get());
167 VALID_PTR(_pArrayGetter.get());
168 return *(_pArrayGetter.get());
174 _pSubArrayProto.reset(((rhs._pSubArrayProto.get()) ? (
static_cast<Array*
>(rhs._pSubArrayProto->ptr_duplicate())) : (
nullptr)));
177 _pArrayGetter.reset(((rhs._pArrayGetter.get()) ? (rhs._pArrayGetter->clone()) : (
nullptr)));
180 _datasetDescs = rhs._datasetDescs;
183void ArrayAggregationBase::cleanup() noexcept
185 _datasetDescs.clear();
186 _datasetDescs.resize(0);
192 NCML_ASSERT_MSG(
false,
"** Unimplemented function: "
193 "ArrayAggregationBase::transferOutputConstraintsIntoGranuleTemplateHook(): "
194 "needs to be overridden and implemented in a base class.");
200 NCML_ASSERT_MSG(
false,
"** Unimplemented function: "
201 "ArrayAggregationBase::readConstrainedGranuleArraysAndAggregateData(): "
202 "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()
void printConstraints(const Array &fromArray)
ArrayAggregationBase * ptr_duplicate() override
const ArrayGetterInterface & getArrayGetterInterface() const
ArrayAggregationBase(const libdap::Array &granuleProto, AMDList memberDatasets, std::unique_ptr< ArrayGetterInterface > arrayGetter)
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...