My Project 1.10.8
H5Exception.h
1// C++ informative line for the emacs editor: -*- C++ -*-
2/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3 * Copyright by The HDF Group. *
4 * Copyright by the Board of Trustees of the University of Illinois. *
5 * All rights reserved. *
6 * *
7 * This file is part of HDF5. The full HDF5 copyright notice, including *
8 * terms governing use, modification, and redistribution, is contained in *
9 * the COPYING file, which can be found at the root of the source code *
10 * distribution tree, or in https://www.hdfgroup.org/licenses. *
11 * If you do not have access to either file, you may request a copy from *
12 * help@hdfgroup.org. *
13 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14
15#ifndef H5Exception_H
16#define H5Exception_H
17
18#include <string>
19
20namespace H5 {
21#define H5std_string std::string
22
28class H5_DLLCPP Exception {
29 public:
30 // Creates an exception with a function name where the failure occurs
31 // and an optional detailed message
32 Exception(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
33
34 // Returns a character string that describes the error specified by
35 // a major error number.
36 H5std_string getMajorString(hid_t err_major_id) const;
37
38 // Returns a character string that describes the error specified by
39 // a minor error number.
40 H5std_string getMinorString(hid_t err_minor_id) const;
41
42 // Returns the detailed message set at the time the exception is thrown
43 H5std_string getDetailMsg() const;
44 const char * getCDetailMsg() const; // C string of detailed message
45 H5std_string getFuncName() const; // function name as a string object
46 const char * getCFuncName() const; // function name as a char string
47
48 // Turns on the automatic error printing.
49 static void setAutoPrint(H5E_auto2_t &func, void *client_data);
50
51 // Turns off the automatic error printing.
52 static void dontPrint();
53
54 // Retrieves the current settings for the automatic error stack
55 // traversal function and its data.
56 static void getAutoPrint(H5E_auto2_t &func, void **client_data);
57
58 // Clears the error stack for the current thread.
59 static void clearErrorStack();
60
61 // Walks the error stack for the current thread, calling the
62 // specified function.
63 static void walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data);
64
65 // Prints the error stack in a default manner.
66 static void printErrorStack(FILE *stream = stderr, hid_t err_stack = H5E_DEFAULT);
67 // Deprecated in favor of printErrorStack.
68 // Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
69 // virtual void printError(FILE* stream = NULL) const;
70
71 // Default constructor
72 Exception();
73
74 // copy constructor
75 Exception(const Exception &orig);
76
77 // virtual Destructor
78 virtual ~Exception() throw();
79
80 protected:
81 // Default value for detail_message
82 static const char DEFAULT_MSG[];
83
84 private:
85 H5std_string detail_message;
86 H5std_string func_name;
87};
88
89class H5_DLLCPP FileIException : public Exception {
90 public:
91 FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
93 virtual ~FileIException() throw() H5_OVERRIDE;
94};
95
96class H5_DLLCPP GroupIException : public Exception {
97 public:
98 GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
100 virtual ~GroupIException() throw() H5_OVERRIDE;
101};
102
103class H5_DLLCPP DataSpaceIException : public Exception {
104 public:
105 DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
107 virtual ~DataSpaceIException() throw() H5_OVERRIDE;
108};
109
110class H5_DLLCPP DataTypeIException : public Exception {
111 public:
112 DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
114 virtual ~DataTypeIException() throw() H5_OVERRIDE;
115};
116
117class H5_DLLCPP ObjHeaderIException : public Exception {
118 public:
119 ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
121 virtual ~ObjHeaderIException() throw() H5_OVERRIDE;
122};
123
124class H5_DLLCPP PropListIException : public Exception {
125 public:
126 PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
128 virtual ~PropListIException() throw() H5_OVERRIDE;
129};
130
131class H5_DLLCPP DataSetIException : public Exception {
132 public:
133 DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
135 virtual ~DataSetIException() throw() H5_OVERRIDE;
136};
137
138class H5_DLLCPP AttributeIException : public Exception {
139 public:
140 AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
142 virtual ~AttributeIException() throw() H5_OVERRIDE;
143};
144
145class H5_DLLCPP ReferenceException : public Exception {
146 public:
147 ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
149 virtual ~ReferenceException() throw() H5_OVERRIDE;
150};
151
152class H5_DLLCPP LibraryIException : public Exception {
153 public:
154 LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
156 virtual ~LibraryIException() throw() H5_OVERRIDE;
157};
158
159class H5_DLLCPP LocationException : public Exception {
160 public:
161 LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
163 virtual ~LocationException() throw() H5_OVERRIDE;
164};
165
166class H5_DLLCPP IdComponentException : public Exception {
167 public:
168 IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
170 virtual ~IdComponentException() throw() H5_OVERRIDE;
171
172}; // end of IdComponentException
173} // namespace H5
174
175#endif // H5Exception_H
Definition: H5Exception.h:138
Definition: H5Exception.h:131
Definition: H5Exception.h:103
Definition: H5Exception.h:110
Exception provides wrappers of HDF5 error handling functions.
Definition: H5Exception.h:28
Definition: H5Exception.h:89
Definition: H5Exception.h:96
Definition: H5Exception.h:166
Definition: H5Exception.h:152
Definition: H5Exception.h:159
Definition: H5Exception.h:117
Definition: H5Exception.h:124
Definition: H5Exception.h:145
Definition: H5AbstractDs.cpp:34


The HDF Group Help Desk:
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois