libdap Updated for version 3.21.0
libdap4 is an implementation of OPeNDAP's DAP protocol.
Grid.h
1
2// -*- mode: c++; c-basic-offset:4 -*-
3
4// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5// Access Protocol.
6
7// Copyright (c) 2002,2003 OPeNDAP, Inc.
8// Author: James Gallagher <jgallagher@opendap.org>
9//
10// This library is free software; you can redistribute it and/or
11// modify it under the terms of the GNU Lesser General Public
12// License as published by the Free Software Foundation; either
13// version 2.1 of the License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25
26// (c) COPYRIGHT URI/MIT 1994-1999
27// Please read the full copyright statement in the file COPYRIGHT_URI.
28//
29// Authors:
30// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31
32// Interface to the Grid ctor class. Grids contain a single array (the `main'
33// array) of dimension N and N single dimension arrays (map arrays). For any
34// dimension n of the main array, the size of the nth map array must match
35// the size of the main array's nth dimension. Grids are used to map
36// non-integer scales to multidimensional point data.
37//
38// jhrg 9/15/94
39
40#ifndef _grid_h
41#define _grid_h 1
42
43#include <vector>
44
45#ifndef _basetype_h
46#include "BaseType.h"
47#endif
48
49#ifndef _array_h
50#include "Array.h"
51#endif
52
53#ifndef _constructor_h
54#include "Constructor.h"
55#endif
56
57#ifndef constraint_evaluator_h
58#include "ConstraintEvaluator.h"
59#endif
60
61namespace libdap {
62
63class D4Grup;
64class XMLWriter;
65
120
121class Grid : public Constructor {
122private:
123 // BaseType *d_array_var; // weak pointer to the
124 bool d_is_array_set;
125
126protected: // subclasses need access [mjohnson 11 nov 2009]
127 void m_duplicate(const Grid &s);
128
129public:
130 Grid(const string &n);
131 Grid(const string &n, const string &d);
132 Grid(const Grid &rhs);
133 virtual ~Grid();
134
135 typedef std::vector<BaseType *>::const_iterator Map_citer;
136 typedef std::vector<BaseType *>::iterator Map_iter;
137 typedef std::vector<BaseType *>::reverse_iterator Map_riter;
138
139 Grid &operator=(const Grid &rhs);
140 virtual BaseType *ptr_duplicate();
141
142 virtual void transform_to_dap4(D4Group *root, Constructor *container);
143
144 virtual bool is_dap2_only_type();
145
146 virtual void add_var(BaseType *bt, Part part);
147 virtual void add_var_nocopy(BaseType *bt, Part part);
148
149 virtual void set_array(Array *p_new_arr);
150 virtual Array *add_map(Array *p_new_map, bool add_copy);
151 virtual Array *prepend_map(Array *p_new_map, bool add_copy);
152
153 BaseType *array_var();
154 Array *get_array();
155
156 // virtual unsigned int width(bool constrained = false);
157
158 virtual int components(bool constrained = false);
159
160 virtual bool projection_yields_grid();
161
162 virtual void clear_constraint();
163
164 virtual void print_decl(ostream &out, string space = " ", bool print_semi = true, bool constraint_info = false,
165 bool constrained = false);
166
167 virtual void print_xml(ostream &out, string space = " ", bool constrained = false);
168 virtual void print_xml_writer(XMLWriter &xml, bool constrained = false);
169
170 virtual void print_val(ostream &out, string space = "", bool print_decl_p = true);
171
172 virtual void print_decl(FILE *out, string space = " ", bool print_semi = true, bool constraint_info = false,
173 bool constrained = false);
174 virtual void print_xml(FILE *out, string space = " ", bool constrained = false);
175 virtual void print_val(FILE *out, string space = "", bool print_decl_p = true);
176
177 virtual void transfer_attributes(AttrTable *at_container);
178
179 virtual bool check_semantics(string &msg, bool all = false);
180
181 Map_iter map_begin();
182 Map_iter map_end();
183 Map_riter map_rbegin();
184 Map_riter map_rend();
185 Map_iter get_map_iter(int i);
186
187 virtual void dump(ostream &strm) const;
188};
189
190} // namespace libdap
191
192#endif // _grid_h
top level DAP object to house generic methods
Definition AISConnect.cc:30
virtual BaseType * ptr_duplicate()=0
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.