bes Updated for version 3.20.13
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
49class hcerr;
50
51using std::string;
52using std::ostream;
53
54#include <libdap/Error.h>
55
56using namespace libdap;
57
58#define THROW(x) throw x(__FILE__,__LINE__)
59
60// HDFClass exceptions class
61class hcerr: public Error {
62public:
63 hcerr(const char *msg, const char *file, int line);
64 virtual ~ hcerr(void) throw() {
65 }
66};
67
68// Define valid HDFClass exceptions
69class hcerr_invfile: public hcerr {
70public:
71 hcerr_invfile(const char *file, int line) :
72 hcerr("Invalid file", file, line) {
73 }
74}; // invalid file given
75
76class hcerr_invsize: public hcerr {
77public:
78 hcerr_invsize(const char *file, int line) :
79 hcerr("Invalid size", file, line) {
80 }
81}; // invalid size parameter given
82
83class hcerr_invnt: public hcerr {
84public:
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
90class hcerr_invarr: public hcerr {
91public:
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
97class hcerr_nomemory: public hcerr {
98public:
99 hcerr_nomemory(const char *file, int line) :
100 hcerr("Memory allocation failed", file, line) {
101 }
102}; // out of memory (new failed)
103
104class hcerr_range: public hcerr {
105public:
106 hcerr_range(const char *file, int line) :
107 hcerr("Subscript out of range", file, line) {
108 }
109};
110
111class hcerr_invstream: public hcerr {
112public:
113 hcerr_invstream(const char *file, int line) :
114 hcerr("Invalid hdfstream", file, line) {
115 }
116}; // hdfstream class uninitialized
117
118class hcerr_copystream: public hcerr {
119public:
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
125class hcerr_openfile: public hcerr {
126public:
127 hcerr_openfile(const char *file, int line) :
128 hcerr("Could not open file", file, line) {
129 }
130}; // open file call failed
131
132class hcerr_fileinfo: public hcerr {
133public:
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
139class hcerr_anninit: public hcerr {
140public:
141 hcerr_anninit(const char *file, int line) :
142 hcerr("Could not initialize annotation interface", file, line) {
143 }
144}; // ANstart() failed
145
146class hcerr_anninfo: public hcerr {
147public:
148 hcerr_anninfo(const char *file, int line) :
149 hcerr("Could not retrieve annotation info", file, line) {
150 }
151}; // ANfileinfo() or ANnumann() failed
152
153class hcerr_annlist: public hcerr {
154public:
155 hcerr_annlist(const char *file, int line) :
156 hcerr("Could not retrieve list of annotations", file, line) {
157 }
158}; // ANannlist() failed
159
160class hcerr_annread: public hcerr {
161public:
162 hcerr_annread(const char *file, int line) :
163 hcerr("Could not read an annotation", file, line) {
164 }
165}; // ANreadann() failed
166
167class hcerr_dftype: public hcerr {
168public:
169 hcerr_dftype(const char *file, int line) :
170 hcerr("Invalid HDF data type specified", file, line) {
171 }
172};
173
174class hcerr_dataexport: public hcerr {
175public:
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
181class hcerr_sdsinit: public hcerr {
182public:
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
188class hcerr_nosds: public hcerr {
189public:
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
195class hcerr_sdsinfo: public hcerr {
196public:
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
202class hcerr_sdsfind: public hcerr {
203public:
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
210class hcerr_sdsopen: public hcerr {
211public:
212 hcerr_sdsopen(const char *file, int line) :
213 hcerr("Could not open an SDS", file, line) {
214 }
215}; // if SDstart() fails
216
217class hcerr_maxdim: public hcerr {
218public:
219 hcerr_maxdim(const char *file, int line) :
220 hcerr("SDS rank exceeds the maximum supported", file, line) {
221 }
222}; //
223
224class hcerr_iscoord: public hcerr {
225public:
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
233class hcerr_sdsread: public hcerr {
234public:
235 hcerr_sdsread(const char *file, int line) :
236 hcerr("Problem reading SDS", file, line) {
237 }
238}; // if SDreaddata() fails
239
240class hcerr_sdsscale: public hcerr {
241public:
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
247class hcerr_vdataopen: public hcerr {
248public:
249 hcerr_vdataopen(const char *file, int line) :
250 hcerr("Could not open a Vdata.", file, line) {
251 }
252}; // if VSattach() fails
253
254class hcerr_vdatainfo: public hcerr {
255public:
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
261class hcerr_vdatafind: public hcerr {
262public:
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
268class hcerr_vdataread: public hcerr {
269public:
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
275class hcerr_vdataseek: public hcerr {
276public:
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
282class hcerr_vgroupopen: public hcerr {
283public:
284 hcerr_vgroupopen(const char *file, int line) :
285 hcerr("Could not open a Vgroup.", file, line) {
286 }
287}; // if Vattach() fails
288
289class hcerr_vgroupinfo: public hcerr {
290public:
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
296class hcerr_vgroupfind: public hcerr {
297public:
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
303class hcerr_vgroupread: public hcerr {
304public:
305 hcerr_vgroupread(const char *file, int line) :
306 hcerr("Could not read Vgroup records.", file, line) {
307 }
308}; // if Vgettagref() fails
309
310class hcerr_griinfo: public hcerr {
311public:
312 hcerr_griinfo(const char *file, int line) :
313 hcerr("Could not retrieve information about an GRI", file, line) {
314 }
315};
316
317class hcerr_griread: public hcerr {
318public:
319 hcerr_griread(const char *file, int line) :
320 hcerr("Problem reading GRI", file, line) {
321 }
322}; // if GRreadiamge() fails
323
324class hcerr_invslab: public hcerr {
325public:
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
331class hcerr_interlace: public hcerr {
332public:
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
Definition: hcerr.h:61