bes  Updated for version 3.20.5
NCArray.h
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of nc_handler, a data handler for the OPeNDAP data
5 // server.
6 
7 // Copyright (c) 2002,2003 OPeNDAP, Inc.
8 // Author: James Gallagher <jgallagher@opendap.org>
9 //
10 // This is free software; you can redistribute it and/or modify it under the
11 // terms of the GNU Lesser General Public License as published by the Free
12 // Software Foundation; either version 2.1 of the License, or (at your
13 // option) any later version.
14 //
15 // This software is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 // 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-1996
27 // Please read the full copyright statement in the file COPYRIGHT.
28 //
29 // Authors:
30 // reza Reza Nekovei (reza@intcomm.net)
31 
32 // netCDF sub-class implementation for NCByte,...NCGrid.
33 // The files are patterned after the subcalssing examples
34 // Test<type>.c,h files.
35 //
36 // ReZa 1/12/95
37 
38 #ifndef _ncarray_h
39 #define _ncarray_h 1
40 
41 #include <sys/types.h>
42 
43 #include <sstream>
44 
45 #include <Array.h>
46 
47 #include <NCStructure.h>
48 
49 using namespace libdap ;
50 using namespace std ;
51 
52 class NCArray: public Array {
53 private:
54  long format_constraint(size_t *cor, ptrdiff_t *step, size_t *edg, bool *has_stride);
55 
56  void do_cardinal_array_read(int ncid, int varid, nc_type datatype,
57  vector<char> &values, bool has_values, int values_offset,
58  int nels, size_t cor[], size_t edg[], ptrdiff_t step[], bool has_stride);
59 
60  void do_array_read(int ncid, int varid, nc_type datatype,
61  vector<char> &values, bool has_values, int values_offset,
62  int nels, size_t cor[], size_t edg[], ptrdiff_t step[], bool has_stride);
63 
64  friend class NCStructure;
65 
66 public:
67  NCArray(const string &n, const string &d, BaseType *v);
68  NCArray(const NCArray &nc_array);
69  NCArray &operator=(const NCArray &rhs);
70  virtual ~NCArray();
71 
72  virtual BaseType *ptr_duplicate();
73 
74  virtual bool read();
75 };
76 
77 /*
78  * $Log: NCArray.h,v $
79  * Revision 1.16 2005/04/19 23:16:18 jimg
80  * Removed client side parts; the client library is now in libnc-dap.
81  *
82  * Revision 1.15 2005/04/11 18:38:20 jimg
83  * Fixed a problem with NCSequence where nested sequences were not flagged
84  * but instead were translated. The extract_values software cannot process a
85  * nested sequence yet. Now the code inserts an attribute that notes that a
86  * nested sequence has been elided.
87  *
88  * Revision 1.14 2005/04/08 17:08:47 jimg
89  * Removed old 'virtual ctor' functions which have now been replaced by the
90  * factory class code in libdap++.
91  *
92  * Revision 1.13 2005/03/31 00:04:51 jimg
93  * Modified to use the factory class in libdap++ 3.5.
94  *
95  * Revision 1.12 2005/02/26 00:43:20 jimg
96  * Check point: This version of the CL can now translate strings from the
97  * server into char arrays. This is controlled by two things: First a
98  * compile-time directive STRING_AS_ARRAY can be used to remove/include
99  * this feature. When included in the code, only Strings associated with
100  * variables created by the translation process will be turned into char
101  * arrays. Other String variables are assumed to be single character strings
102  * (although there may be a bug with the way these are handled, see
103  * NCAccess::extract_values()).
104  *
105  * Revision 1.11 2005/02/17 23:44:13 jimg
106  * Modifications for processing of command line projections combined
107  * with the limit stuff and projection info passed in from the API. I also
108  * consolodated some of the code by moving d_source from various
109  * classes to NCAccess. This may it so that DODvario() could be simplified
110  * as could build_constraint() and store_projection() in NCArray.
111  *
112  * Revision 1.10 2005/01/26 23:25:51 jimg
113  * Implemented a fix for Sequence access by row number when talking to a
114  * 3.4 or earlier server (which contains a bug in is_end_of_rows()).
115  *
116  * Revision 1.9 2004/11/30 22:11:35 jimg
117  * I replaced the flatten_*() functions with a flatten() method in
118  * NCAccess. The default version of this method is in NCAccess and works
119  * for the atomic types; constructors must provide a specialization.
120  * Then I removed the code that copied the variables from vectors to
121  * lists. The translation code in NCConnect was modified to use the
122  * new method.
123  *
124  * Revision 1.8 2004/10/28 16:38:19 jimg
125  * Added support for error handling to ClientParams. Added use of
126  * ClientParams to NCConnect, although that's not complete yet. NCConnect
127  * now has an instance of ClientParams. The instance is first built and
128  * then passed into NCConnect's ctor which stores a const reference to the CP
129  * object.
130  *
131  * Revision 1.7 2004/10/22 21:51:34 jimg
132  * More massive changes: Translation of Sequences now works so long as the
133  * Sequence contains only atomic types.
134  *
135  * Revision 1.6 2004/09/08 22:08:21 jimg
136  * More Massive changes: Code moved from the files that clone the netCDF
137  * function calls into NCConnect, NCAccess or nc_util.cc. Much of the
138  * translation functions are now methods. The netCDF type classes now
139  * inherit from NCAccess in addition to the DAP type classes.
140  *
141  * Revision 1.5 2003/12/08 18:06:37 edavis
142  * Merge release-3-4 into trunk
143  *
144  * Revision 1.4 2003/09/25 23:09:36 jimg
145  * Meerged from 3.4.1.
146  *
147  * Revision 1.3.4.2 2003/06/24 11:36:32 rmorris
148  * Removed #pragma interface directives for the OS X.
149  *
150  * Revision 1.3.4.1 2003/06/07 22:02:32 reza
151  * Fixed char vs. byte and long vs. nclong error checks.
152  *
153  * Revision 1.3 2002/05/03 00:01:52 jimg
154  * Merged with release-3-2-7.
155  *
156  * Revision 1.2.4.1 2001/12/26 03:32:24 rmorris
157  * Removed redundant default args. VC++ only allows them to be specified
158  * a single time.
159  *
160  * Revision 1.2 2000/10/06 01:22:02 jimg
161  * Moved the CVS Log entries to the ends of files.
162  * Modified the read() methods to match the new definition in the dap library.
163  * Added exception handlers in various places to catch exceptions thrown
164  * by the dap library.
165  *
166  * Revision 1.1 1999/07/28 00:22:42 jimg
167  * Added
168  *
169  * Revision 1.5 1999/05/07 23:45:31 jimg
170  * String --> string fixes
171  *
172  * Revision 1.4 1996/09/17 17:06:17 jimg
173  * Merge the release-2-0 tagged files (which were off on a branch) back into
174  * the trunk revision.
175  *
176  * Revision 1.3.4.2 1996/07/10 21:43:55 jimg
177  * Changes for version 2.06. These fixed lingering problems from the migration
178  * from version 1.x to version 2.x.
179  * Removed some (but not all) warning generated with gcc's -Wall option.
180  *
181  * Revision 1.3.4.1 1996/06/25 22:04:19 jimg
182  * Version 2.0 from Reza.
183  *
184  * Revision 1.3 1995/03/21 20:58:16 jimg
185  * Resolved conflicts between my (jhrg) files and those checked in by Reza.
186  *
187  * Revision 1.2 1995/03/16 16:56:26 reza
188  * Updated for the new DAP. All the read_val mfunc. and their memory management
189  * are now moved to their parent class.
190  * Data transfers are now in binary while DAS and DDS are still sent in ASCII.
191  *
192  * Revision 1.1 1995/02/10 04:57:15 reza
193  * Added read and read_val functions.
194  */
195 
196 #endif
197 
198