bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
GridAggregationBase.h
1
2// This file is part of the "NcML Module" project, a BES module designed
3// to allow NcML files to be used to be used as a wrapper to add
4// AIS to existing datasets of any format.
5//
6// Copyright (c) 2010 OPeNDAP, Inc.
7// Author: Michael Johnson <m.johnson@opendap.org>
8//
9// For more information, please also see the main website: http://opendap.org/
10//
11// This library is free software; you can redistribute it and/or
12// modify it under the terms of the GNU Lesser General Public
13// License as published by the Free Software Foundation; either
14// version 2.1 of the License, or (at your option) any later version.
15//
16// This library is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19// Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public
22// License along with this library; if not, write to the Free Software
23// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24//
25// Please see the files COPYING and COPYRIGHT for more information on the GLPL.
26//
27// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
29
30#ifndef __AGG_UTIL__GRID_AGGREGATION_BASE_H__
31#define __AGG_UTIL__GRID_AGGREGATION_BASE_H__
32
33#include "AggMemberDataset.h" // agg_util
34#include "DDSLoader.h" // agg_util
35#include <libdap/Grid.h> // libdap
36#include <memory> // std
37
38namespace libdap {
39class Array;
40class Grid;
41class D4Group;
42}
43
44namespace agg_util {
45
46class GridAggregationBase: public libdap::Grid {
47public:
48 GridAggregationBase(const libdap::Grid& proto, const AMDList& memberDatasets, const DDSLoader& loaderProto);
49
65 GridAggregationBase(const string& name, const AMDList& memberDatasets, const DDSLoader& loaderProto);
66
67 GridAggregationBase(const GridAggregationBase& proto);
68
69 ~GridAggregationBase() override;
70
71 GridAggregationBase& operator=(const GridAggregationBase& rhs);
72
73 void transform_to_dap4(libdap::D4Group *root, libdap::Constructor *container) override;
74
84 void setShapeFrom(const libdap::Grid& protoSubGrid, bool addMaps);
85
91 virtual const AMDList& getDatasetList() const;
92
103 bool read() override;
104
105 bool serialize(libdap::ConstraintEvaluator &eval, libdap::DDS &dds, libdap::Marshaller &m, bool ce_eval) override;
106
107
108protected:
109 // subclass interface
110
116
120 Grid* getSubGridTemplate();
121
123 virtual const Dimension& getAggregationDimension() const = 0;
124
125 void printConstraints(const libdap::Array& fromArray);
126
129 void readProtoSubGrid();
130
131 // Support calls for the read()....
132
139 void copyProtoMapsIntoThisGrid(const Dimension& aggDim);
140
151 virtual void transferConstraintsToSubGridHook(Grid* pSubGrid);
152
153private:
154 // helpers
155
157 void duplicate(const GridAggregationBase& rhs);
158
160 void cleanup();
161
162 static libdap::Grid* cloneSubGridProto(const libdap::Grid& proto);
163
164private:
165 // data rep
166
167 // Use this to load the member datasets as needed
168 DDSLoader _loader;
169
170 // A template for the unaggregated (sub) Grids.
171 // It will be used to validate other datasets as they are loaded.
172 std::unique_ptr<Grid> _pSubGridProto;
173
174 // Maintain a copy here... we may want to move this down...
175 AMDList _memberDatasets;
176
177};
178// class GridAggregationBase
179
180}// namespace agg_util
181
182#endif /* __AGG_UTIL__GRID_AGGREGATION_BASE_H__ */
virtual const Dimension & getAggregationDimension() const =0
bool serialize(libdap::ConstraintEvaluator &eval, libdap::DDS &dds, libdap::Marshaller &m, bool ce_eval) override
void copyProtoMapsIntoThisGrid(const Dimension &aggDim)
void setShapeFrom(const libdap::Grid &protoSubGrid, bool addMaps)
virtual const AMDList & getDatasetList() const
virtual void transferConstraintsToSubGridHook(Grid *pSubGrid)
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...