summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Exception.h
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5Exception.h')
-rw-r--r--c++/src/H5Exception.h216
1 files changed, 113 insertions, 103 deletions
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index b4af2ba..d4533e5 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -1,164 +1,174 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef _H5Exception_H
-#define _H5Exception_H
+#ifndef H5Exception_H
+#define H5Exception_H
#include <string>
-#ifndef H5_NO_NAMESPACE
namespace H5 {
-#ifdef H5_NO_STD
- #define H5std_string ::string
-#else
- #define H5std_string std::string
-#endif
-#endif
+#define H5std_string std::string
+/*! \class Exception
+ \brief Exception provides wrappers of HDF5 error handling functions.
+
+ Many classes are derived from Exception for specific HDF5 C interfaces.
+*/
class H5_DLLCPP Exception {
- public:
- // Creates an exception with a function name where the failure occurs
- // and an optional detailed message
- Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ public:
+ // Creates an exception with a function name where the failure occurs
+ // and an optional detailed message
+ Exception(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
- // Returns a character string that describes the error specified by
- // a major error number.
- H5std_string getMajorString( hid_t err_major_id ) const;
+ // Returns a character string that describes the error specified by
+ // a major error number.
+ H5std_string getMajorString(hid_t err_major_id) const;
- // Returns a character string that describes the error specified by
- // a minor error number.
- H5std_string getMinorString( hid_t err_minor_id ) const;
+ // Returns a character string that describes the error specified by
+ // a minor error number.
+ H5std_string getMinorString(hid_t err_minor_id) const;
- // Returns the detailed message set at the time the exception is thrown
- H5std_string getDetailMsg() const;
- const char* getCDetailMsg() const; // C string of detailed message
- H5std_string getFuncName() const; // function name as a string object
- const char* getCFuncName() const; // function name as a char string
+ // Returns the detailed message set at the time the exception is thrown
+ H5std_string getDetailMsg() const;
+ const char *getCDetailMsg() const; // C string of detailed message
+ H5std_string getFuncName() const; // function name as a string object
+ const char *getCFuncName() const; // function name as a char string
- // Turns on the automatic error printing.
- static void setAutoPrint( H5E_auto2_t& func, void* client_data);
+ // Turns on the automatic error printing.
+ static void setAutoPrint(H5E_auto2_t &func, void *client_data);
- // Turns off the automatic error printing.
- static void dontPrint();
+ // Turns off the automatic error printing.
+ static void dontPrint();
- // Retrieves the current settings for the automatic error stack
- // traversal function and its data.
- static void getAutoPrint( H5E_auto2_t& func, void** client_data);
+ // Retrieves the current settings for the automatic error stack
+ // traversal function and its data.
+ static void getAutoPrint(H5E_auto2_t &func, void **client_data);
- // Clears the error stack for the current thread.
- static void clearErrorStack();
+ // Clears the error stack for the current thread.
+ static void clearErrorStack();
- // Walks the error stack for the current thread, calling the
- // specified function.
- 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.
+ static void walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data);
- // Prints the error stack in a default manner.
- virtual void printError( FILE* stream = NULL ) const;
+ // Prints the error stack in a default manner.
+ static void printErrorStack(FILE *stream = stderr, hid_t err_stack = H5E_DEFAULT);
+ // Deprecated in favor of printErrorStack.
+ // Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2
+ // virtual void printError(FILE* stream = NULL) const;
- // Default constructor
- Exception();
+ // Default constructor
+ Exception();
- // copy constructor
- Exception( const Exception& orig);
+ // copy constructor
+ Exception(const Exception &orig);
- // virtual Destructor
- virtual ~Exception();
+ // virtual Destructor
+ virtual ~Exception() throw();
- private:
- H5std_string detail_message;
- H5std_string func_name;
+ protected:
+ // Default value for detail_message
+ static const char DEFAULT_MSG[];
- protected:
- // Default value for detail_message
- static const char DEFAULT_MSG[];
+ private:
+ H5std_string detail_message;
+ H5std_string func_name;
};
class H5_DLLCPP FileIException : public Exception {
- public:
- FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- FileIException();
- virtual ~FileIException();
+ public:
+ FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ FileIException();
+ virtual ~FileIException() throw() override;
};
class H5_DLLCPP GroupIException : public Exception {
- public:
- GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- GroupIException();
- virtual ~GroupIException();
+ public:
+ GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ GroupIException();
+ virtual ~GroupIException() throw() override;
};
class H5_DLLCPP DataSpaceIException : public Exception {
- public:
- DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataSpaceIException();
- virtual ~DataSpaceIException();
+ public:
+ DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataSpaceIException();
+ virtual ~DataSpaceIException() throw() override;
};
class H5_DLLCPP DataTypeIException : public Exception {
- public:
- DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataTypeIException();
- virtual ~DataTypeIException();
+ public:
+ DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataTypeIException();
+ virtual ~DataTypeIException() throw() override;
+};
+
+class H5_DLLCPP ObjHeaderIException : public Exception {
+ public:
+ ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ ObjHeaderIException();
+ virtual ~ObjHeaderIException() throw() override;
};
class H5_DLLCPP PropListIException : public Exception {
- public:
- PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- PropListIException();
- virtual ~PropListIException();
+ public:
+ PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ PropListIException();
+ virtual ~PropListIException() throw() override;
};
class H5_DLLCPP DataSetIException : public Exception {
- public:
- DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataSetIException();
- virtual ~DataSetIException();
+ public:
+ DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ DataSetIException();
+ virtual ~DataSetIException() throw() override;
};
class H5_DLLCPP AttributeIException : public Exception {
- public:
- AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- AttributeIException();
- virtual ~AttributeIException();
+ public:
+ AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ AttributeIException();
+ virtual ~AttributeIException() throw() override;
};
class H5_DLLCPP ReferenceException : public Exception {
- public:
- ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- ReferenceException();
- virtual ~ReferenceException();
+ public:
+ ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ ReferenceException();
+ virtual ~ReferenceException() throw() override;
};
class H5_DLLCPP LibraryIException : public Exception {
- public:
- LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- LibraryIException();
- virtual ~LibraryIException();
+ public:
+ LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ LibraryIException();
+ virtual ~LibraryIException() throw() override;
};
-class H5_DLLCPP IdComponentException : public Exception {
- public:
- IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- IdComponentException();
- virtual ~IdComponentException();
+class H5_DLLCPP LocationException : public Exception {
+ public:
+ LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ LocationException();
+ virtual ~LocationException() throw() override;
};
-#ifndef H5_NO_NAMESPACE
-}
-#endif
+class H5_DLLCPP IdComponentException : public Exception {
+ public:
+ IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG);
+ IdComponentException();
+ virtual ~IdComponentException() throw() override;
+
+}; // end of IdComponentException
+} // namespace H5
-#endif // _H5Exception_H
+#endif // H5Exception_H