bes  Updated for version 3.20.6
NCSequence.cc
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 
27 // (c) COPYRIGHT URI/MIT 1994-1996
28 // Please read the full copyright statement in the file COPYRIGHT.
29 //
30 // Authors:
31 // reza Reza Nekovei (reza@intcomm.net)
32 
33 // netCDF sub-class implementation for NCByte,...NCGrid.
34 // The files are patterned after the subcalssing examples
35 // Test<type>.c,h files.
36 //
37 // ReZa 1/12/95
38 
39 #include "config_nc.h"
40 
41 static char rcsid[] not_used ={"$Id$"};
42 
43 #include <sstream>
44 #include <algorithm>
45 
46 // #define DODS_DEBUG 1
47 
48 #include <InternalErr.h>
49 #include <debug.h>
50 
51 #include "NCSequence.h"
52 
53 BaseType *
54 NCSequence::ptr_duplicate()
55 {
56  return new NCSequence(*this);
57 }
58 
59 NCSequence::NCSequence(const string &n, const string &d) : Sequence(n, d)
60 {
61 }
62 
63 NCSequence::NCSequence(const NCSequence &rhs) : Sequence(rhs)
64 {
65 }
66 
67 NCSequence::~NCSequence()
68 {
69 }
70 
71 NCSequence &
72 NCSequence::operator=(const NCSequence &rhs)
73 {
74  if (this == &rhs)
75  return *this;
76 
77  dynamic_cast<Sequence &>(*this) = rhs; // run Sequence assignment
78 
79  return *this;
80 }
81 
82 void NCSequence::transfer_attributes(AttrTable *at)
83 {
84  if (at) {
85  Vars_iter var = var_begin();
86  while (var != var_end()) {
87  (*var)->transfer_attributes(at);
88  var++;
89  }
90  }
91 }
92 
93 
94 // $Log: NCSequence.cc,v $
95 // Revision 1.17 2005/04/19 23:16:18 jimg
96 // Removed client side parts; the client library is now in libnc-dap.
97 //
98 // Revision 1.16 2005/04/11 18:38:20 jimg
99 // Fixed a problem with NCSequence where nested sequences were not flagged
100 // but instead were translated. The extract_values software cannot process a
101 // nested sequence yet. Now the code inserts an attribute that notes that a
102 // nested sequence has been elided.
103 //
104 // Revision 1.15 2005/04/07 23:35:36 jimg
105 // Changed the value of the translation attribute from "translated" to "flatten".
106 //
107 // Revision 1.14 2005/03/31 00:04:51 jimg
108 // Modified to use the factory class in libdap++ 3.5.
109 //
110 // Revision 1.13 2005/03/19 00:33:03 jimg
111 // Checkpoint: All tests pass and only one memory leak remains (in
112 // NCConnect::flatten_attributes()).
113 //
114 // Revision 1.12 2005/03/05 00:16:58 jimg
115 // checkpoint: working on memory leaks found using unit tests
116 //
117 // Revision 1.11 2005/02/26 00:43:20 jimg
118 // Check point: This version of the CL can now translate strings from the
119 // server into char arrays. This is controlled by two things: First a
120 // compile-time directive STRING_AS_ARRAY can be used to remove/include
121 // this feature. When included in the code, only Strings associated with
122 // variables created by the translation process will be turned into char
123 // arrays. Other String variables are assumed to be single character strings
124 // (although there may be a bug with the way these are handled, see
125 // NCAccess::extract_values()).
126 //
127 // Revision 1.10 2005/02/17 23:44:13 jimg
128 // Modifications for processing of command line projections combined
129 // with the limit stuff and projection info passed in from the API. I also
130 // consolodated some of the code by moving d_source from various
131 // classes to NCAccess. This may it so that DODvario() could be simplified
132 // as could build_constraint() and store_projection() in NCArray.
133 //
134 // Revision 1.9 2005/01/29 00:20:29 jimg
135 // Checkpoint: CEs ont he command line/ncopen() almost work.
136 //
137 // Revision 1.8 2005/01/26 23:25:51 jimg
138 // Implemented a fix for Sequence access by row number when talking to a
139 // 3.4 or earlier server (which contains a bug in is_end_of_rows()).
140 //
141 // Revision 1.7 2004/11/30 22:11:35 jimg
142 // I replaced the flatten_*() functions with a flatten() method in
143 // NCAccess. The default version of this method is in NCAccess and works
144 // for the atomic types; constructors must provide a specialization.
145 // Then I removed the code that copied the variables from vectors to
146 // lists. The translation code in NCConnect was modified to use the
147 // new method.
148 //
149 // Revision 1.6 2004/11/05 17:13:57 jimg
150 // Added code to copy the BaseType pointers from the vector container into
151 // a list. This will enable more efficient translation software to be
152 // written.
153 //
154 // Revision 1.5 2004/10/22 21:51:34 jimg
155 // More massive changes: Translation of Sequences now works so long as the
156 // Sequence contains only atomic types.
157 //
158 // Revision 1.4 2004/09/08 22:08:22 jimg
159 // More Massive changes: Code moved from the files that clone the netCDF
160 // function calls into NCConnect, NCAccess or nc_util.cc. Much of the
161 // translation functions are now methods. The netCDF type classes now
162 // inherit from NCAccess in addition to the DAP type classes.
163 //
164 // Revision 1.3 2003/12/08 18:06:37 edavis
165 // Merge release-3-4 into trunk
166 //
167 // Revision 1.2 2000/10/06 01:22:02 jimg
168 // Moved the CVS Log entries to the ends of files.
169 // Modified the read() methods to match the new definition in the dap library.
170 // Added exception handlers in various places to catch exceptions thrown
171 // by the dap library.
172 //
173 // Revision 1.1 1999/07/28 00:22:44 jimg
174 // Added
175 //
176 // Revision 1.6 1999/05/07 23:45:32 jimg
177 // String --> string fixes
178 //
179 // Revision 1.5 1998/08/06 16:33:24 jimg
180 // Fixed misuse of the read(...) member function. Return true if more data
181 // is to be read, false is if not and error if an error is detected
182 //
183 // Revision 1.4 1996/09/17 17:06:37 jimg
184 // Merge the release-2-0 tagged files (which were off on a branch) back into
185 // the trunk revision.
186 //
187 // Revision 1.3.4.4 1996/09/17 00:26:29 jimg
188 // Merged changes from a side branch which contained various changes from
189 // Reza and Charles.
190 // Removed ncdump and netexec since ncdump is now in its own directory and
191 // netexec is no longer used.
192 //
193 // Revision 1.3.4.3 1996/08/13 21:19:01 jimg
194 // *** empty log message ***
195 //
196 // Revision 1.3.4.2 1996/07/10 21:44:18 jimg
197 // Changes for version 2.06. These fixed lingering problems from the migration
198 // from version 1.x to version 2.x.
199 // Removed some (but not all) warning generated with gcc's -Wall option.
200 //
201 // Revision 1.3.4.1 1996/06/25 22:04:40 jimg
202 // Version 2.0 from Reza.
203 //
204 // Revision 1.3 1995/07/09 21:33:49 jimg
205 // Added copyright notice.
206 //
207 // Revision 1.2 1995/03/16 16:56:41 reza
208 // Updated for the new DAP. All the read_val mfunc. and their memory management
209 // are now moved to their parent class.
210 // Data transfers are now in binary while DAS and DDS are still sent in ASCII.
211 //
212 // Revision 1.1 1995/02/10 04:57:43 reza
213 // Added read and read_val functions.
214 //
NCSequence
Definition: NCSequence.h:46