bes  Updated for version 3.20.6
GridAggregationBase.h
1 // 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 <Grid.h> // libdap
36 #include <memory> // std
37 
38 namespace libdap {
39 class Array;
40 class Grid;
41 class D4Group;
42 }
43 
44 namespace agg_util {
45 
46 class GridAggregationBase: public libdap::Grid {
47 public:
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 
68 
69  virtual ~GridAggregationBase();
70 
71  GridAggregationBase& operator=(const GridAggregationBase& rhs);
72 
73  virtual void transform_to_dap4(libdap::D4Group *root, libdap::Constructor *container);
74 
84  void setShapeFrom(const libdap::Grid& protoSubGrid, bool addMaps);
85 
91  virtual const AMDList& getDatasetList() const;
92 
103  virtual bool read();
104 
105  virtual bool serialize(libdap::ConstraintEvaluator &eval, libdap::DDS &dds, libdap::Marshaller &m, bool ce_eval);
106 
107 
108 protected:
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 
153 private:
154  // helpers
155 
157  void duplicate(const GridAggregationBase& rhs);
158 
160  void cleanup();
161 
162  static libdap::Grid* cloneSubGridProto(const libdap::Grid& proto);
163 
164 private:
165  // data rep
166 
167  // Use this to laod 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::auto_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__ */
agg_util::GridAggregationBase
Definition: GridAggregationBase.h:46
agg_util::GridAggregationBase::setShapeFrom
void setShapeFrom(const libdap::Grid &protoSubGrid, bool addMaps)
Definition: GridAggregationBase.cc:143
agg_util::GridAggregationBase::copyProtoMapsIntoThisGrid
void copyProtoMapsIntoThisGrid(const Dimension &aggDim)
Definition: GridAggregationBase.cc:419
agg_util::DDSLoader
Definition: DDSLoader.h:62
agg_util::GridAggregationBase::getDatasetList
virtual const AMDList & getDatasetList() const
Definition: GridAggregationBase.cc:171
agg_util::GridAggregationBase::readProtoSubGrid
void readProtoSubGrid()
Definition: GridAggregationBase.cc:400
agg_util::Dimension
Definition: Dimension.h:49
agg_util
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...
Definition: AggMemberDataset.cc:38
libdap
Definition: BESDapFunctionResponseCache.h:35
agg_util::GridAggregationBase::getAggregationDimension
virtual const Dimension & getAggregationDimension() const =0
agg_util::GridAggregationBase::serialize
virtual bool serialize(libdap::ConstraintEvaluator &eval, libdap::DDS &dds, libdap::Marshaller &m, bool ce_eval)
Definition: GridAggregationBase.cc:231
agg_util::GridAggregationBase::read
virtual bool read()
Definition: GridAggregationBase.cc:177
agg_util::GridAggregationBase::transferConstraintsToSubGridHook
virtual void transferConstraintsToSubGridHook(Grid *pSubGrid)
Definition: GridAggregationBase.cc:475
agg_util::GridAggregationBase::readAndAggregateConstrainedMapsHook
virtual void readAndAggregateConstrainedMapsHook()
Definition: GridAggregationBase.cc:376
agg_util::GridAggregationBase::getSubGridTemplate
Grid * getSubGridTemplate()
Definition: GridAggregationBase.cc:351