bes  Updated for version 3.20.6
hcerr.h
1 #ifndef _HCERR_H
2 #define _HCERR_H
3 
5 // This file is part of the hdf4 data handler for the OPeNDAP data server.
6 
7 // Copyright (c) 2005 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 License
21 // along with this software; if not, write to the Free Software Foundation,
22 // 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 // Copyright 1996, by the California Institute of Technology.
27 // ALL RIGHTS RESERVED. United States Government Sponsorship
28 // acknowledged. Any commercial use must be negotiated with the
29 // Office of Technology Transfer at the California Institute of
30 // Technology. This software may be subject to U.S. export control
31 // laws and regulations. By accepting this software, the user
32 // agrees to comply with all applicable U.S. export laws and
33 // regulations. User has the responsibility to obtain export
34 // licenses, or other export authority as may be required before
35 // exporting such information to foreign countries or providing
36 // access to foreign persons.
37 
38 //
39 // U.S. Government Sponsorship under NASA Contract
40 // NAS7-1260 is acknowledged.
41 //
42 // Author: Todd.K.Karakashian@jpl.nasa.gov
43 //
45 
46 #include <iostream>
47 #include <string>
48 
49 class hcerr;
50 
51 using std::string;
52 using std::ostream;
53 
54 #include <Error.h>
55 
56 using namespace libdap;
57 
58 #define THROW(x) throw x(__FILE__,__LINE__)
59 
60 // HDFClass exceptions class
61 class hcerr: public Error {
62 public:
63  hcerr(const char *msg, const char *file, int line);
64  virtual ~ hcerr(void) throw() {
65  }
66 };
67 
68 // Define valid HDFClass exceptions
69 class hcerr_invfile: public hcerr {
70 public:
71  hcerr_invfile(const char *file, int line) :
72  hcerr("Invalid file", file, line) {
73  }
74 }; // invalid file given
75 
76 class hcerr_invsize: public hcerr {
77 public:
78  hcerr_invsize(const char *file, int line) :
79  hcerr("Invalid size", file, line) {
80  }
81 }; // invalid size parameter given
82 
83 class hcerr_invnt: public hcerr {
84 public:
85  hcerr_invnt(const char *file, int line) :
86  hcerr("Invalid HDF number type", file, line) {
87  }
88 }; // invalid HDF number type parameter given
89 
90 class hcerr_invarr: public hcerr {
91 public:
92  hcerr_invarr(const char *file, int line) :
93  hcerr("Invalid array given", file, line) {
94  }
95 }; // invalid array given as an argument to a function
96 
97 class hcerr_nomemory: public hcerr {
98 public:
99  hcerr_nomemory(const char *file, int line) :
100  hcerr("Memory allocation failed", file, line) {
101  }
102 }; // out of memory (new failed)
103 
104 class hcerr_range: public hcerr {
105 public:
106  hcerr_range(const char *file, int line) :
107  hcerr("Subscript out of range", file, line) {
108  }
109 };
110 
111 class hcerr_invstream: public hcerr {
112 public:
113  hcerr_invstream(const char *file, int line) :
114  hcerr("Invalid hdfstream", file, line) {
115  }
116 }; // hdfstream class uninitialized
117 
118 class hcerr_copystream: public hcerr {
119 public:
120  hcerr_copystream(const char *file, int line) :
121  hcerr("Streams must be passed by reference", file, line) {
122  }
123 }; // copying of streams disallowed
124 
125 class hcerr_openfile: public hcerr {
126 public:
127  hcerr_openfile(const char *file, int line) :
128  hcerr("Could not open file", file, line) {
129  }
130 }; // open file call failed
131 
132 class hcerr_fileinfo: public hcerr {
133 public:
134  hcerr_fileinfo(const char *file, int line) :
135  hcerr("Could not retrieve information about a file", file, line) {
136  }
137 }; // a file query function failed
138 
139 class hcerr_anninit: public hcerr {
140 public:
141  hcerr_anninit(const char *file, int line) :
142  hcerr("Could not initialize annotation interface", file, line) {
143  }
144 }; // ANstart() failed
145 
146 class hcerr_anninfo: public hcerr {
147 public:
148  hcerr_anninfo(const char *file, int line) :
149  hcerr("Could not retrieve annotation info", file, line) {
150  }
151 }; // ANfileinfo() or ANnumann() failed
152 
153 class hcerr_annlist: public hcerr {
154 public:
155  hcerr_annlist(const char *file, int line) :
156  hcerr("Could not retrieve list of annotations", file, line) {
157  }
158 }; // ANannlist() failed
159 
160 class hcerr_annread: public hcerr {
161 public:
162  hcerr_annread(const char *file, int line) :
163  hcerr("Could not read an annotation", file, line) {
164  }
165 }; // ANreadann() failed
166 
167 class hcerr_dftype: public hcerr {
168 public:
169  hcerr_dftype(const char *file, int line) :
170  hcerr("Invalid HDF data type specified", file, line) {
171  }
172 };
173 
174 class hcerr_dataexport: public hcerr {
175 public:
176  hcerr_dataexport(const char *file, int line) :
177  hcerr("Could not export data from generic vector", file, line) {
178  }
179 }; // if trying to export data into wrong type of STL vector
180 
181 class hcerr_sdsinit: public hcerr {
182 public:
183  hcerr_sdsinit(const char *file, int line) :
184  hcerr("Could not select an SDS in SDS input stream", file, line) {
185  }
186 }; // if SDfileinfo() fails when opening an hdfistream_sds
187 
188 class hcerr_nosds: public hcerr {
189 public:
190  hcerr_nosds(const char *file, int line) :
191  hcerr("There are no SDS's in the stream", file, line) {
192  }
193 }; // if SDfileinfo() indicates no SDS's in the file
194 
195 class hcerr_sdsinfo: public hcerr {
196 public:
197  hcerr_sdsinfo(const char *file, int line) :
198  hcerr("Could not retrieve information about an SDS", file, line) {
199  }
200 }; // if SDgetinfo() or SDfileinfo() fails
201 
202 class hcerr_sdsfind: public hcerr {
203 public:
204  hcerr_sdsfind(const char *file, int line) :
205  hcerr("Could not find an SDS with the specified parameters",
206  file, line) {
207  }
208 }; // if SDnametoindex() fails
209 
210 class hcerr_sdsopen: public hcerr {
211 public:
212  hcerr_sdsopen(const char *file, int line) :
213  hcerr("Could not open an SDS", file, line) {
214  }
215 }; // if SDstart() fails
216 
217 class hcerr_maxdim: public hcerr {
218 public:
219  hcerr_maxdim(const char *file, int line) :
220  hcerr("SDS rank exceeds the maximum supported", file, line) {
221  }
222 }; //
223 
224 class hcerr_iscoord: public hcerr {
225 public:
226  hcerr_iscoord(const char *file, int line) :
227  hcerr(
228  "SDS cannot be opened because it is a coordinate variable",
229  file, line) {
230  }
231 }; //
232 
233 class hcerr_sdsread: public hcerr {
234 public:
235  hcerr_sdsread(const char *file, int line) :
236  hcerr("Problem reading SDS", file, line) {
237  }
238 }; // if SDreaddata() fails
239 
240 class hcerr_sdsscale: public hcerr {
241 public:
242  hcerr_sdsscale(const char *file, int line) :
243  hcerr("Cannot determine dim scale; SDS is in a bad state.", file, line) {
244  }
245 }; // if hdf_sds::has_scale() fails
246 
247 class hcerr_vdataopen: public hcerr {
248 public:
249  hcerr_vdataopen(const char *file, int line) :
250  hcerr("Could not open a Vdata.", file, line) {
251  }
252 }; // if VSattach() fails
253 
254 class hcerr_vdatainfo: public hcerr {
255 public:
256  hcerr_vdatainfo(const char *file, int line) :
257  hcerr("Could not obtain information about a Vdata.", file, line) {
258  }
259 }; // if VSinquire() fails
260 
261 class hcerr_vdatafind: public hcerr {
262 public:
263  hcerr_vdatafind(const char *file, int line) :
264  hcerr("Could not locate Vdata in the HDF file.", file, line) {
265  }
266 }; // if VSfind() fails
267 
268 class hcerr_vdataread: public hcerr {
269 public:
270  hcerr_vdataread(const char *file, int line) :
271  hcerr("Could not read Vdata records.", file, line) {
272  }
273 }; // if VSread() or VSsetfields() fails
274 
275 class hcerr_vdataseek: public hcerr {
276 public:
277  hcerr_vdataseek(const char *file, int line) :
278  hcerr("Could not seek to first Vdata record.", file, line) {
279  }
280 }; // if VSseek() fails
281 
282 class hcerr_vgroupopen: public hcerr {
283 public:
284  hcerr_vgroupopen(const char *file, int line) :
285  hcerr("Could not open a Vgroup.", file, line) {
286  }
287 }; // if Vattach() fails
288 
289 class hcerr_vgroupinfo: public hcerr {
290 public:
291  hcerr_vgroupinfo(const char *file, int line) :
292  hcerr("Could not obtain information about a Vgroup.", file, line) {
293  }
294 }; // if Vinquire() fails
295 
296 class hcerr_vgroupfind: public hcerr {
297 public:
298  hcerr_vgroupfind(const char *file, int line) :
299  hcerr("Could not locate Vgroup in the HDF file.", file, line) {
300  }
301 }; // if Vfind() fails
302 
303 class hcerr_vgroupread: public hcerr {
304 public:
305  hcerr_vgroupread(const char *file, int line) :
306  hcerr("Could not read Vgroup records.", file, line) {
307  }
308 }; // if Vgettagref() fails
309 
310 class hcerr_griinfo: public hcerr {
311 public:
312  hcerr_griinfo(const char *file, int line) :
313  hcerr("Could not retrieve information about an GRI", file, line) {
314  }
315 };
316 
317 class hcerr_griread: public hcerr {
318 public:
319  hcerr_griread(const char *file, int line) :
320  hcerr("Problem reading GRI", file, line) {
321  }
322 }; // if GRreadiamge() fails
323 
324 class hcerr_invslab: public hcerr {
325 public:
326  hcerr_invslab(const char *file, int line) :
327  hcerr("Invalid slab parameters for SDS or GR", file, line) {
328  }
329 }; // if slab parameters do not make sense
330 
331 class hcerr_interlace: public hcerr {
332 public:
333  hcerr_interlace(const char *file, int line) :
334  hcerr("Unknown interlace type.", file, line) {
335  }
336 }; // if bad interlace type is passed to setinterlace
337 
338 #endif // ifndef _HCERR_H
hcerr_nosds
Definition: hcerr.h:188
hcerr_sdsinfo
Definition: hcerr.h:195
hcerr_annlist
Definition: hcerr.h:153
hcerr_invstream
Definition: hcerr.h:111
hcerr_iscoord
Definition: hcerr.h:224
hcerr_griread
Definition: hcerr.h:317
hcerr_sdsopen
Definition: hcerr.h:210
hcerr_anninfo
Definition: hcerr.h:146
hcerr_openfile
Definition: hcerr.h:125
hcerr_vdatafind
Definition: hcerr.h:261
hcerr_vdataseek
Definition: hcerr.h:275
hcerr_sdsfind
Definition: hcerr.h:202
hcerr_range
Definition: hcerr.h:104
hcerr_nomemory
Definition: hcerr.h:97
hcerr_sdsscale
Definition: hcerr.h:240
hcerr_maxdim
Definition: hcerr.h:217
hcerr_invarr
Definition: hcerr.h:90
hcerr_vgroupopen
Definition: hcerr.h:282
hcerr_dataexport
Definition: hcerr.h:174
hcerr_vdatainfo
Definition: hcerr.h:254
libdap
Definition: BESDapFunctionResponseCache.h:35
hcerr_sdsinit
Definition: hcerr.h:181
hcerr_fileinfo
Definition: hcerr.h:132
hcerr_sdsread
Definition: hcerr.h:233
hcerr_vdataopen
Definition: hcerr.h:247
hcerr_dftype
Definition: hcerr.h:167
hcerr_vgroupinfo
Definition: hcerr.h:289
hcerr_invnt
Definition: hcerr.h:83
hcerr_invslab
Definition: hcerr.h:324
hcerr_vgroupread
Definition: hcerr.h:303
hcerr_invfile
Definition: hcerr.h:69
hcerr_griinfo
Definition: hcerr.h:310
hcerr_interlace
Definition: hcerr.h:331
hcerr
Definition: hcerr.h:61
hcerr_annread
Definition: hcerr.h:160
Error
hcerr_anninit
Definition: hcerr.h:139
hcerr_vgroupfind
Definition: hcerr.h:296
hcerr_vdataread
Definition: hcerr.h:268
hcerr_invsize
Definition: hcerr.h:76
hcerr_copystream
Definition: hcerr.h:118