source: anuga_core/install/winxp/NetCDFWinInstaller/include/H5Exception.h @ 7310

Last change on this file since 7310 was 7310, checked in by rwilson, 15 years ago

Added the NetCDF Windows installer.

  • Property svn:executable set to *
File size: 5.6 KB
Line 
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 files COPYING and Copyright.html.  COPYING can be found at the root   *
10 * of the source code distribution tree; Copyright.html can be found at the  *
11 * root level of an installed copy of the electronic HDF5 document set and   *
12 * is linked from the top-level documents page.  It can also be found at     *
13 * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
14 * access to either file, you may request a copy from help@hdfgroup.org.     *
15 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16
17#ifndef _H5Exception_H
18#define _H5Exception_H
19
20#include <string>
21
22#ifndef H5_NO_NAMESPACE
23namespace H5 {
24#ifdef H5_NO_STD
25    #define H5std_string ::string
26#else
27    #define H5std_string std::string
28#endif
29#endif
30
31class H5_DLLCPP Exception {
32   public:
33        // Creates an exception with a function name where the failure occurs
34        // and an optional detailed message
35        Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
36
37        // Returns a character string that describes the error specified by
38        // a major error number.
39        H5std_string getMajorString( hid_t err_major_id ) const;
40
41        // Returns a character string that describes the error specified by
42        // a minor error number.
43        H5std_string getMinorString( hid_t err_minor_id ) const;
44
45        // Returns the detailed message set at the time the exception is thrown
46        H5std_string getDetailMsg() const;
47        const char* getCDetailMsg() const;      // C string of detailed message
48        H5std_string getFuncName() const;       // function name as a string object
49        const char* getCFuncName() const;       // function name as a char string
50
51        // Turns on the automatic error printing.
52        static void setAutoPrint( H5E_auto2_t& func, void* client_data);
53
54        // Turns off the automatic error printing.
55        static void dontPrint();
56
57        // Retrieves the current settings for the automatic error stack
58        // traversal function and its data.
59        static void getAutoPrint( H5E_auto2_t& func, void** client_data);
60
61        // Clears the error stack for the current thread.
62        static void clearErrorStack();
63
64        // Walks the error stack for the current thread, calling the
65        // specified function.
66        static void walkErrorStack( H5E_direction_t direction,
67                                H5E_walk2_t func, void* client_data);
68
69        // Prints the error stack in a default manner.
70        virtual void printError( FILE* stream = NULL ) const;
71
72        // Default constructor
73        Exception();
74
75        // copy constructor
76        Exception( const Exception& orig);
77
78        // virtual Destructor
79        virtual ~Exception();
80
81   private:
82// Because 'string' is not instantiated at compilation time, this
83// warning is displayed when building DLL; but the class is exported
84// so the warning is harmless
85#if defined(_WIN32)
86#pragma warning(disable: 4251)
87#endif
88        H5std_string detail_message;
89        H5std_string func_name;
90
91   protected:
92        // Default value for detail_message
93        static const H5std_string DEFAULT_MSG;
94};
95
96class H5_DLLCPP FileIException : public Exception {
97   public:
98        FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
99        FileIException();
100        virtual ~FileIException();
101};
102
103class H5_DLLCPP GroupIException : public Exception {
104   public:
105        GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
106        GroupIException();
107        virtual ~GroupIException();
108};
109
110class H5_DLLCPP DataSpaceIException : public Exception {
111   public:
112        DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
113        DataSpaceIException();
114        virtual ~DataSpaceIException();
115};
116
117class H5_DLLCPP DataTypeIException : public Exception {
118   public:
119        DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
120        DataTypeIException();
121        virtual ~DataTypeIException();
122};
123
124class H5_DLLCPP PropListIException : public Exception {
125   public:
126        PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
127        PropListIException();
128        virtual ~PropListIException();
129};
130
131class H5_DLLCPP DataSetIException : public Exception {
132   public:
133        DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
134        DataSetIException();
135        virtual ~DataSetIException();
136};
137
138class H5_DLLCPP AttributeIException : public Exception {
139   public:
140        AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
141        AttributeIException();
142        virtual ~AttributeIException();
143};
144
145class H5_DLLCPP ReferenceException : public Exception {
146   public:
147        ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
148        ReferenceException();
149        virtual ~ReferenceException();
150};
151
152class H5_DLLCPP LibraryIException : public Exception {
153   public:
154        LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
155        LibraryIException();
156        virtual ~LibraryIException();
157};
158
159class H5_DLLCPP IdComponentException : public Exception {
160   public:
161        IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
162        IdComponentException();
163        virtual ~IdComponentException();
164};
165
166#ifndef H5_NO_NAMESPACE
167}
168#endif
169
170#endif // _H5Exception_H
Note: See TracBrowser for help on using the repository browser.