HDF5 C++ API Reference Manual

 

 

 

H5Exception.h

Go to the documentation of this file.
00001 // C++ informative line for the emacs editor: -*- C++ -*-
00002 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00003  * Copyright by The HDF Group.                                               *
00004  * Copyright by the Board of Trustees of the University of Illinois.         *
00005  * All rights reserved.                                                      *
00006  *                                                                           *
00007  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00008  * terms governing use, modification, and redistribution, is contained in    *
00009  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00010  * of the source code distribution tree; Copyright.html can be found at the  *
00011  * root level of an installed copy of the electronic HDF5 document set and   *
00012  * is linked from the top-level documents page.  It can also be found at     *
00013  * https://support.hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00014  * access to either file, you may request a copy from help@hdfgroup.org.     *
00015  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00016 
00017 #ifndef _H5Exception_H
00018 #define _H5Exception_H
00019 
00020 #include <string>
00021 
00022 #ifndef H5_NO_NAMESPACE
00023 namespace H5 {
00024 #ifdef H5_NO_STD
00025     #define H5std_string ::string
00026 #else
00027     #define H5std_string std::string
00028 #endif
00029 #endif
00030 
00031 class H5_DLLCPP Exception {
00032    public:
00033         // Creates an exception with a function name where the failure occurs
00034         // and an optional detailed message
00035         Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00036 
00037         // Returns a character string that describes the error specified by
00038         // a major error number.
00039         H5std_string getMajorString( H5E_major_t major_num ) const;
00040 
00041         // Returns a character string that describes the error specified by
00042         // a minor error number.
00043         H5std_string getMinorString( H5E_minor_t minor_num ) const;
00044 
00045         // Returns the detailed message set at the time the exception is thrown
00046         H5std_string getDetailMsg() const;
00047         const char* getCDetailMsg() const;      // C string of detailed message
00048         H5std_string getFuncName() const;       // function name as a string object
00049         const char* getCFuncName() const;       // function name as a char string
00050 
00051         // Turns on the automatic error printing.
00052         static void setAutoPrint( H5E_auto_t& func, void* client_data);
00053 
00054         // Turns off the automatic error printing.
00055         static void dontPrint();
00056 
00057         // Retrieves the current settings for the automatic error stack
00058         // traversal function and its data.
00059         static void getAutoPrint( H5E_auto_t& func, void** client_data);
00060 
00061         // Clears the error stack for the current thread.
00062         static void clearErrorStack();
00063 
00064         // Walks the error stack for the current thread, calling the
00065         // specified function.
00066         static void walkErrorStack( H5E_direction_t direction,
00067                                 H5E_walk_t func, void* client_data);
00068 
00069         // Prints the error stack in a default manner.
00070         virtual void printError( FILE* stream = NULL ) const;
00071 
00072         // Default constructor
00073         Exception();
00074 
00075         // copy constructor
00076         Exception( const Exception& orig);
00077 
00078         // virtual Destructor
00079         virtual ~Exception();
00080 
00081    private:
00082 // Because 'string' is not instantiated at compilation time, this
00083 // warning is displayed when building DLL; but the class is exported
00084 // so the warning is harmless
00085 #if defined(WIN32)
00086 #pragma warning(disable: 4251)
00087 #endif
00088         H5std_string detail_message;
00089         H5std_string func_name;
00090 
00091    protected:
00092         // Default value for detail_message
00093         static const H5std_string DEFAULT_MSG;
00094 };
00095 
00096 class H5_DLLCPP FileIException : public Exception {
00097    public:
00098         FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00099         FileIException();
00100         virtual ~FileIException();
00101 };
00102 
00103 class H5_DLLCPP GroupIException : public Exception {
00104    public:
00105         GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00106         GroupIException();
00107         virtual ~GroupIException();
00108 };
00109 
00110 class H5_DLLCPP DataSpaceIException : public Exception {
00111    public:
00112         DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00113         DataSpaceIException();
00114         virtual ~DataSpaceIException();
00115 };
00116 
00117 class H5_DLLCPP DataTypeIException : public Exception {
00118    public:
00119         DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00120         DataTypeIException();
00121         virtual ~DataTypeIException();
00122 };
00123 
00124 class H5_DLLCPP PropListIException : public Exception {
00125    public:
00126         PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00127         PropListIException();
00128         virtual ~PropListIException();
00129 };
00130 
00131 class H5_DLLCPP DataSetIException : public Exception {
00132    public:
00133         DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00134         DataSetIException();
00135         virtual ~DataSetIException();
00136 };
00137 
00138 class H5_DLLCPP AttributeIException : public Exception {
00139    public:
00140         AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00141         AttributeIException();
00142         virtual ~AttributeIException();
00143 };
00144 
00145 class H5_DLLCPP ReferenceException : public Exception {
00146    public:
00147         ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00148         ReferenceException();
00149         virtual ~ReferenceException();
00150 };
00151 
00152 class H5_DLLCPP LibraryIException : public Exception {
00153    public:
00154         LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00155         LibraryIException();
00156         virtual ~LibraryIException();
00157 };
00158 
00159 class H5_DLLCPP IdComponentException : public Exception {
00160    public:
00161         IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
00162         IdComponentException();
00163         virtual ~IdComponentException();
00164 };
00165 
00166 #ifndef H5_NO_NAMESPACE
00167 }
00168 #endif
00169 
00170 #endif // _H5Exception_H

Generated on Wed Nov 4 14:13:07 2009 by  doxygen 1.4.7