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


The HDF Group Help Desk:
  Copyright by The HDF Group