My Project  1.12.0
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://support.hdfgroup.org/ftp/HDF5/releases. *
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 
20 namespace H5 {
21 #ifdef H5_NO_STD
22  #define H5std_string ::string
23 #else
24  #define H5std_string std::string
25 #endif
26 
32 class H5_DLLCPP Exception {
33  public:
34  // Creates an exception with a function name where the failure occurs
35  // and an optional detailed message
36  Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
37 
38  // Returns a character string that describes the error specified by
39  // a major error number.
40  H5std_string getMajorString(hid_t err_major_id) const;
41 
42  // Returns a character string that describes the error specified by
43  // a minor error number.
44  H5std_string getMinorString(hid_t err_minor_id) const;
45 
46  // Returns the detailed message set at the time the exception is thrown
47  H5std_string getDetailMsg() const;
48  const char* getCDetailMsg() const; // C string of detailed message
49  H5std_string getFuncName() const; // function name as a string object
50  const char* getCFuncName() const; // function name as a char string
51 
52  // Turns on the automatic error printing.
53  static void setAutoPrint(H5E_auto2_t& func, void* client_data);
54 
55  // Turns off the automatic error printing.
56  static void dontPrint();
57 
58  // Retrieves the current settings for the automatic error stack
59  // traversal function and its data.
60  static void getAutoPrint(H5E_auto2_t& func, void** client_data);
61 
62  // Clears the error stack for the current thread.
63  static void clearErrorStack();
64 
65  // Walks the error stack for the current thread, calling the
66  // specified function.
67  static void walkErrorStack(H5E_direction_t direction,
68  H5E_walk2_t func, void* client_data);
69 
70  // Prints the error stack in a default manner.
71  static void printErrorStack(FILE* stream = stderr,
72  hid_t err_stack = H5E_DEFAULT);
73  // Deprecated in favor of printErrorStack.
74  // Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
75  // virtual void printError(FILE* stream = NULL) const;
76 
77  // Default constructor
78  Exception();
79 
80  // copy constructor
81  Exception(const Exception& orig);
82 
83  // virtual Destructor
84  virtual ~Exception() throw();
85 
86  protected:
87  // Default value for detail_message
88  static const char DEFAULT_MSG[];
89 
90  private:
91  H5std_string detail_message;
92  H5std_string func_name;
93 };
94 
95 class H5_DLLCPP FileIException : public Exception {
96  public:
97  FileIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
99  virtual ~FileIException() throw();
100 };
101 
102 class H5_DLLCPP GroupIException : public Exception {
103  public:
104  GroupIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
105  GroupIException();
106  virtual ~GroupIException() throw();
107 };
108 
109 class H5_DLLCPP DataSpaceIException : public Exception {
110  public:
111  DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
113  virtual ~DataSpaceIException() throw();
114 };
115 
116 class H5_DLLCPP DataTypeIException : public Exception {
117  public:
118  DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
120  virtual ~DataTypeIException() throw();
121 };
122 
123 class H5_DLLCPP ObjHeaderIException : public Exception {
124  public:
125  ObjHeaderIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
127  virtual ~ObjHeaderIException() throw();
128 };
129 
130 class H5_DLLCPP PropListIException : public Exception {
131  public:
132  PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
134  virtual ~PropListIException() throw();
135 };
136 
137 class H5_DLLCPP DataSetIException : public Exception {
138  public:
139  DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
141  virtual ~DataSetIException() throw();
142 };
143 
144 class H5_DLLCPP AttributeIException : public Exception {
145  public:
146  AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
148  virtual ~AttributeIException() throw();
149 };
150 
151 class H5_DLLCPP ReferenceException : public Exception {
152  public:
153  ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
155  virtual ~ReferenceException() throw();
156 };
157 
158 class H5_DLLCPP LibraryIException : public Exception {
159  public:
160  LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
162  virtual ~LibraryIException() throw();
163 };
164 
165 class H5_DLLCPP LocationException : public Exception {
166  public:
167  LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
169  virtual ~LocationException() throw();
170 };
171 
172 class H5_DLLCPP IdComponentException : public Exception {
173  public:
174  IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
176  virtual ~IdComponentException() throw();
177 
178 }; // end of IdComponentException
179 } // namespace H5
180 
181 #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:268
H5::FileIException::~FileIException
virtual ~FileIException()
Noop destructor.
Definition: H5Exception.cpp:355
H5::Exception
Exception provides wrappers of HDF5 error handling functions.
Definition: H5Exception.h:32
H5::LocationException
Definition: H5Exception.h:165
H5::PropListIException::~PropListIException
virtual ~PropListIException()
Noop destructor.
Definition: H5Exception.cpp:470
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:175
H5::PropListIException
Definition: H5Exception.h:130
H5::LocationException::~LocationException
virtual ~LocationException()
Noop destructor.
Definition: H5Exception.cpp:585
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:302
H5::ObjHeaderIException
Definition: H5Exception.h:123
H5::Exception::DEFAULT_MSG
static const char DEFAULT_MSG[]
Definition: H5Exception.h:88
H5::IdComponentException
Definition: H5Exception.h:172
H5::Exception::dontPrint
static void dontPrint()
Turns off the automatic error printing from the C library.
Definition: H5Exception.cpp:156
H5::DataSpaceIException
Definition: H5Exception.h:109
H5::DataSpaceIException::~DataSpaceIException
virtual ~DataSpaceIException()
Noop destructor.
Definition: H5Exception.cpp:401
H5::Exception::clearErrorStack
static void clearErrorStack()
Clears the error stack for the current thread.
Definition: H5Exception.cpp:192
H5::GroupIException::~GroupIException
virtual ~GroupIException()
Noop destructor.
Definition: H5Exception.cpp:378
H5::DataSpaceIException::DataSpaceIException
DataSpaceIException()
Default constructor.
Definition: H5Exception.cpp:388
H5::FileIException::FileIException
FileIException()
Default constructor.
Definition: H5Exception.cpp:342
H5::FileIException
Definition: H5Exception.h:95
H5::DataTypeIException
Definition: H5Exception.h:116
H5::AttributeIException
Definition: H5Exception.h:144
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:241
H5::LocationException::LocationException
LocationException()
Default constructor.
Definition: H5Exception.cpp:572
H5::ReferenceException::ReferenceException
ReferenceException()
Default constructor.
Definition: H5Exception.cpp:526
H5::IdComponentException::~IdComponentException
virtual ~IdComponentException()
Noop destructor.
Definition: H5Exception.cpp:608
H5::DataSetIException::~DataSetIException
virtual ~DataSetIException()
Noop destructor.
Definition: H5Exception.cpp:493
H5::ObjHeaderIException::ObjHeaderIException
ObjHeaderIException()
Default constructor.
Definition: H5Exception.cpp:434
H5::DataTypeIException::~DataTypeIException
virtual ~DataTypeIException()
Noop destructor.
Definition: H5Exception.cpp:424
H5::Exception::getDetailMsg
H5std_string getDetailMsg() const
Returns the detailed message set at the time the exception is thrown.
Definition: H5Exception.cpp:256
H5::Exception::Exception
Exception()
Default constructor.
Definition: H5Exception.cpp:28
H5::Exception::~Exception
virtual ~Exception()
Noop destructor.
Definition: H5Exception.cpp:332
H5::LibraryIException::LibraryIException
LibraryIException()
Default constructor.
Definition: H5Exception.cpp:549
H5::IdComponentException::IdComponentException
IdComponentException()
Default constructor.
Definition: H5Exception.cpp:595
H5::PropListIException::PropListIException
PropListIException()
Default constructor.
Definition: H5Exception.cpp:457
H5::Exception::getFuncName
H5std_string getFuncName() const
Returns the name of the function, where the exception is thrown.
Definition: H5Exception.cpp:279
H5::ReferenceException
Definition: H5Exception.h:151
H5::Exception::getCFuncName
const char * getCFuncName() const
Returns the name of the function, where the exception is thrown.
Definition: H5Exception.cpp:290
H5::LibraryIException
Definition: H5Exception.h:158
H5::AttributeIException::AttributeIException
AttributeIException()
Default constructor.
Definition: H5Exception.cpp:503
H5::AttributeIException::~AttributeIException
virtual ~AttributeIException()
Noop destructor.
Definition: H5Exception.cpp:516
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:59
H5
Definition: H5AbstractDs.cpp:34
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:98
H5::ObjHeaderIException::~ObjHeaderIException
virtual ~ObjHeaderIException()
Noop destructor.
Definition: H5Exception.cpp:447
H5::GroupIException
Definition: H5Exception.h:102
H5::LibraryIException::~LibraryIException
virtual ~LibraryIException()
Noop destructor.
Definition: H5Exception.cpp:562
H5::Exception::setAutoPrint
static void setAutoPrint(H5E_auto2_t &func, void *client_data)
Turns on the automatic error printing.
Definition: H5Exception.cpp:142
H5::DataSetIException::DataSetIException
DataSetIException()
Default constructor.
Definition: H5Exception.cpp:480
H5::GroupIException::GroupIException
GroupIException()
Default constructor.
Definition: H5Exception.cpp:365
H5::ReferenceException::~ReferenceException
virtual ~ReferenceException()
Noop destructor.
Definition: H5Exception.cpp:539
H5::DataTypeIException::DataTypeIException
DataTypeIException()
Default constructor.
Definition: H5Exception.cpp:411
H5::DataSetIException
Definition: H5Exception.h:137


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