OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
AggMemberDataset.h
Go to the documentation of this file.
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 #ifndef __AGG_UTIL__AGG_MEMBER_DATASET_H__
30 #define __AGG_UTIL__AGG_MEMBER_DATASET_H__
31 
32 #include "Dimension.h" // agg_util
33 #include "RCObject.h"
34 #include <string>
35 #include <vector>
36 
37 namespace libdap
38 {
39  class DataDDS;
40  class DDS;
41 };
42 
43 using libdap::DataDDS;
44 using libdap::DDS;
45 
46 namespace agg_util
47 {
67  class AggMemberDataset : public RCObject
68  {
69  public:
70  AggMemberDataset(const std::string& location);
71  virtual ~AggMemberDataset();
72 
74  AggMemberDataset(const AggMemberDataset& proto);
75 
79  const std::string& getLocation() const;
80 
88  virtual const libdap::DataDDS* getDataDDS() = 0;
89 
90  // TODO Consider adding freeDataDDS() or equivalent
91  // to clear the memory made by getDataDDS if it was
92  // loaded so we can tighten up the memory usage
93  // for large AMD Lists.
94 
111  virtual unsigned int getCachedDimensionSize(const std::string& dimName) const = 0;
112 
115  virtual bool isDimensionCached(const std::string& dimName) const = 0;
116 
131  virtual void setDimensionCacheFor(const Dimension& dim, bool throwIfFound) = 0;
132 
139  virtual void fillDimensionCacheByUsingDataDDS() = 0;
140 
145  virtual void flushDimensionCache() = 0;
146 
148  virtual void saveDimensionCache(std::ostream& ostr) = 0;
149 
151  virtual void loadDimensionCache(std::istream& istr) = 0;
152 
153  private: // data rep
154  std::string _location; // non-empty location from which to load DataDDS
155  };
156 
157  // List is ref-counted ptrs to AggMemberDataset concrete subclasses.
158  typedef std::vector< RCPtr<AggMemberDataset> > AMDList;
159 
160 }; // namespace agg_util
161 
162 #endif /* __AGG_UTIL__AGG_MEMBER_DATASET_H__ */
virtual void saveDimensionCache(std::ostream &ostr)=0
Append the values in the dimension cache to the output stream.
Abstract helper superclass for allowing lazy access to the DataDDS for an aggregation.
virtual void flushDimensionCache()=0
Flush out any cache for the Dimensions so that it will have to be loaded.
AggMemberDataset(const std::string &location)
virtual bool isDimensionCached(const std::string &dimName) const =0
Return whether the dimension is already cached, or would have to be loaded to be found.
virtual void loadDimensionCache(std::istream &istr)=0
Load the values in the dimension cache from the input stream.
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...
static class NCMLUtil overview
virtual unsigned int getCachedDimensionSize(const std::string &dimName) const =0
Get the size of the given dimension named dimName cached within the dataset.
const std::string & getLocation() const
The location to which the AggMemberDataset refers Note: this could be "" for some subclasses if they ...
virtual const libdap::DataDDS * getDataDDS()=0
Return the DataDDS for the location, loading it in if it hasn't yet been loaded.
Struct for holding information about a dimension of data, minimally a name and a cardinality (size)...
Definition: Dimension.h:50
A base class for a simple reference counted object.
Definition: RCObject.h:162
AggMemberDataset & operator=(const AggMemberDataset &rhs)
std::vector< RCPtr< AggMemberDataset > > AMDList
virtual void fillDimensionCacheByUsingDataDDS()=0
Uses the getDataDDS() call in order to find all named dimensions within it and to seed them into the ...
virtual void setDimensionCacheFor(const Dimension &dim, bool throwIfFound)=0
Seed the dimension cache using the given dimension, so that later calls to getDimensionSize for dim...