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