Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

vtkExtensionsExceptions.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 * 00003 * $Id: vtkExtensionsExceptions.h,v 1.2 2004/08/10 07:37:21 xpxqx Exp $ 00004 * 00005 * Copyright (c) 2004 Sean McInerney 00006 * All rights reserved. 00007 * 00008 * See Copyright.txt or http://vtkextensions.sourceforge.net/Copyright.html 00009 * for details. 00010 * 00011 * This software is distributed WITHOUT ANY WARRANTY; without even 00012 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 * PURPOSE. See the above copyright notice for more information. 00014 * 00015 */ 00016 #ifndef VTK_EXTENSIONS_EXCEPTIONS_H_ 00017 # define VTK_EXTENSIONS_EXCEPTIONS_H_ 00018 /* First include the local configuration for this machine. */ 00019 # include "vtkExtensionsConfigure.h" // vtkExtensions configuration 00020 00021 # if defined(CMAKE_HAVE_EXCEPTION_CXX) 00022 # include <exception> /* Exceptions Base */ 00023 # endif /* CMAKE_HAVE_EXCEPTION_CXX */ 00024 00025 # if defined(CMAKE_HAVE_STDEXCEPT_CXX) 00026 # include <stdexcept> /* Standard Exceptions */ 00027 # endif /* CMAKE_HAVE_STDEXCEPT_CXX */ 00028 00029 # if !defined(CMAKE_HAVE_EXCEPTION_CXX) && !defined(CMAKE_HAVE_STDEXCEPT_CXX) 00030 # define VTK_EXTENSIONS_NO_EXCEPTIONS 1 00031 # endif /* CMAKE_HAVE_STDEXCEPT_CXX || CMAKE_HAVE_EXCEPTION_CXX */ 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> /* bad_alloc */ 00043 # if !defined(CMAKE_HAVE_OVERFLOW_ERROR) && !defined(CMAKE_HAVE_RUNTIME_ERROR) 00044 # include <string> /* STL String */ 00045 # endif /* !CMAKE_HAVE_OVERFLOW_ERROR && !CMAKE_HAVE_RUNTIME_ERROR */ 00046 # else 00047 # include <string> /* STL String */ 00048 # endif /* CMAKE_HAVE_BAD_ALLOC */ 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 /* Setup vtkstd, a portable namespace for std. */ 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 /* !CMAKE_HAVE_BAD_ALLOC */ 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 /* CMAKE_HAVE_BAD_ALLOC */ 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 /* !CMAKE_HAVE_OVERFLOW_ERROR && !CMAKE_HAVE_RUNTIME_ERROR */ 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 /* CMAKE_HAVE_BAD_ALLOC */ 00107 00108 VTK_EXTENSIONS_NAMESPACE_END 00109 } // extern "C++" 00110 # endif /* !VTK_EXTENSIONS_NO_EXCEPTIONS */ 00111 00112 #endif /* VTK_EXTENSIONS_EXCEPTIONS_H_ */ 00113 /* 00114 * End of: $Id: vtkExtensionsExceptions.h,v 1.2 2004/08/10 07:37:21 xpxqx Exp $. 00115 * 00116 */

Generated on Tue Aug 10 03:37:11 2004 for vtkExtensions by doxygen 1.3.7