00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
#ifndef VTK_EXTENSIONS_EXCEPTIONS_H_
00017
# define VTK_EXTENSIONS_EXCEPTIONS_H_
00018
00019
# include "vtkExtensionsConfigure.h"
00020
00021
# if defined(CMAKE_HAVE_EXCEPTION_CXX)
00022
# include <exception>
00023
# endif
00024
00025
# if defined(CMAKE_HAVE_STDEXCEPT_CXX)
00026
# include <stdexcept>
00027
# endif
00028
00029
# if !defined(CMAKE_HAVE_EXCEPTION_CXX) && !defined(CMAKE_HAVE_STDEXCEPT_CXX)
00030 # define VTK_EXTENSIONS_NO_EXCEPTIONS 1
00031
# endif
00032
00033
# if defined(VTK_EXTENSIONS_NO_EXCEPTIONS) || !defined(CMAKE_HAVE_EXCEPTION)
00034 # define THROW_SPEC()
00035 # define THROW_SPEC1(_e1)
00036 # define THROW_SPEC2(_e1,_e2)
00037 # define THROW_SPEC3(_e1,_e2,_e3)
00038 # define THROW_SPEC4(_e1,_e2,_e3,_e4)
00039 # define THROW(_type,_what) ((void *) 0)
00040
# else
00041
# if defined(CMAKE_HAVE_BAD_ALLOC)
00042
# include <new>
00043
# if !defined(CMAKE_HAVE_OVERFLOW_ERROR) && !defined(CMAKE_HAVE_RUNTIME_ERROR)
00044
# include <string>
00045
# endif
00046
# else
00047
# include <string>
00048
# endif
00049
# define THROW_SPEC() throw()
00050
# define THROW_SPEC1(_e1) throw(_e1)
00051
# define THROW_SPEC2(_e1,_e2) throw(_e1,_e2)
00052
# define THROW_SPEC3(_e1,_e2,_e3) throw(_e1,_e2,_e3)
00053
# define THROW_SPEC4(_e1,_e2,_e3,_e4) throw(_e1,_e2,_e3,_e4)
00054
# define THROW(_type,_what) throw _type(_what)
00055
00056
00057
# ifndef vtkstd
00058
# ifndef VTK_NO_STD_NAMESPACE
00059
# define vtkstd std
00060
# else
00061
# define vtkstd
00062
# endif
00063
# endif
00064
00065
extern "C++" {
00066
00067
VTK_EXTENSIONS_NAMESPACE_BEGIN
00068
00077
# if defined(CMAKE_HAVE_BAD_ALLOC)
00078
typedef vtkstd::bad_alloc vtkBadAlloc;
00079
# else
00080
class VTK_EXTENSIONS_COMMON_EXPORT vtkBadAlloc :
public exception
00081 {
00082 vtkstd::string what_;
00083
public:
00084
explicit vtkBadAlloc (
const vtkstd::string& a) : what_(a) {}
00085
virtual const char* what()
const {
return what_.c_str(); }
00086 };
00087
# endif
00088
00089
# if defined(CMAKE_HAVE_OVERFLOW_ERROR)
00090
typedef vtkstd::overflow_error vtkOverflowError;
00091
# elif defined(CMAKE_HAVE_RUNTIME_ERROR)
00092
class VTK_EXTENSIONS_COMMON_EXPORT vtkOverflowError :
public vtkstd::runtime_error
00093 {
00094
public:
00095
explicit vtkOverflowError (
const vtkstd::string& a)
00096 : vtkstd::runtime_error(a) {}
00097 };
00098
# else
00099
class VTK_EXTENSIONS_COMMON_EXPORT vtkOverflowError :
public exception
00100 {
00101 vtkstd::string what_;
00102
public:
00103
explicit vtkOverflowError (
const vtkstd::string& a) : what_(a) {}
00104
virtual const char* what()
const {
return what_.c_str(); }
00105 };
00106
# endif
00107
00108
VTK_EXTENSIONS_NAMESPACE_END
00109 }
00110
# endif
00111
00112
#endif
00113
00114
00115
00116