bes  Updated for version 3.20.6
NCMLBaseArray.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) 2009 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 __NCML_MODULE__NCMLBASEARRAY_H__
30 #define __NCML_MODULE__NCMLBASEARRAY_H__
31 
32 #include <Array.h>
33 #include <memory>
34 #include "Shape.h"
35 
41 namespace ncml_module {
42 
43 class NCMLBaseArray: public libdap::Array {
44 public:
45  // class methods
46 
47 #if 0
48 
63  static auto_ptr< NCMLBaseArray > createFromArray(const libdap::Array& proto);
64 #endif
65 
66 public:
67  // Instance methods
68  NCMLBaseArray();
69  explicit NCMLBaseArray(const std::string& name);
70  explicit NCMLBaseArray(const NCMLBaseArray& proto);
71 
72  virtual ~NCMLBaseArray();
73 
74  NCMLBaseArray& operator=(const NCMLBaseArray& rhs);
75 
79  virtual bool read_p();
80 
84  virtual void set_read_p(bool state);
85 
104  virtual bool read();
105 
107  virtual Shape getSuperShape() const;
108 
113  virtual bool isConstrained() const;
114 
119  virtual bool haveConstraintsChangedSinceLastRead() const;
120 
122  virtual void cacheCurrentConstraints();
123 
124  virtual void cacheUnconstrainedDimensions();
125 
127  virtual void cacheSuperclassStateIfNeeded();
128 
130  virtual void cacheValuesIfNeeded() = 0;
131 
136  virtual void copyDataFrom(libdap::Array& from)=0;
137 
139  virtual bool isDataCached() const = 0;
140 
145  virtual void createAndSetConstrainedValueBuffer() = 0;
146 
147 private:
148 
150  void copyLocalRepFrom(const NCMLBaseArray& proto);
151 
153  void destroy() throw ();
154 
155 protected:
156  // Data rep
157  // The Shape for the case of NO constraints on the data, or null if not set yet.
158  Shape* _noConstraints;
159 
160  // The Shape for the CURRENT dimensions in super Array, used to calculate the transmission buffer
161  // for read() and also to check if haveConstraintsChangedSinceLastRead(). Null if not set yet.
162  Shape* _currentConstraints;
163 };
164 
165 }
166 
167 #endif /* __NCML_MODULE__NCMLBASEARRAY_H__ */
ncml_module::NCMLBaseArray::read_p
virtual bool read_p()
Definition: NCMLBaseArray.cc:119
ncml_module::NCMLBaseArray::createAndSetConstrainedValueBuffer
virtual void createAndSetConstrainedValueBuffer()=0
ncml_module::NCMLBaseArray::read
virtual bool read()
Definition: NCMLBaseArray.cc:132
ncml_module::NCMLBaseArray::isConstrained
virtual bool isConstrained() const
Definition: NCMLBaseArray.cc:158
ncml_module::NCMLBaseArray::isDataCached
virtual bool isDataCached() const =0
ncml_module::NCMLBaseArray::getSuperShape
virtual Shape getSuperShape() const
Definition: NCMLBaseArray.cc:152
ncml_module::Shape
A wrapper class for a vector of Array::dimension structs.
Definition: Shape.h:58
ncml_module::NCMLBaseArray::cacheSuperclassStateIfNeeded
virtual void cacheSuperclassStateIfNeeded()
Definition: NCMLBaseArray.cc:201
ncml_module::NCMLBaseArray::haveConstraintsChangedSinceLastRead
virtual bool haveConstraintsChangedSinceLastRead() const
Definition: NCMLBaseArray.cc:164
ncml_module::NCMLBaseArray::set_read_p
virtual void set_read_p(bool state)
Definition: NCMLBaseArray.cc:126
ncml_module::NCMLBaseArray::copyDataFrom
virtual void copyDataFrom(libdap::Array &from)=0
ncml_module::NCMLBaseArray::cacheValuesIfNeeded
virtual void cacheValuesIfNeeded()=0
ncml_module
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...
Definition: AggregationElement.cc:72
ncml_module::NCMLBaseArray
Definition: NCMLBaseArray.h:43
ncml_module::NCMLBaseArray::cacheCurrentConstraints
virtual void cacheCurrentConstraints()
Definition: NCMLBaseArray.cc:176