laexcp.h

Go to the documentation of this file.
00001 // -*-C++-*- 
00002 
00003 // Copyright (C) 2004 
00004 // Christian Stimming <stimming@tuhh.de>
00005 
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public License as
00008 // published by the Free Software Foundation; either version 2, or (at
00009 // your option) any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 
00016 // You should have received a copy of the GNU Lesser General Public License along
00017 // with this library; see the file COPYING.  If not, write to the Free
00018 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019 // USA.
00020 
00021 //      LAPACK++ (V. 1.1)
00022 //      (C) 1992-1996 All Rights Reserved.
00023 
00024 // (obsolete comment:)
00025 //  C++ exception handling is not currently supported by most compilers.
00026 //  The macros below allow one to "mimic" the throw expression of
00027 //  character strings.  Transfer of control does not correspond
00028 //  to a "try" block, but rather exits the program with the proper
00029 //  banner.  This is a similar behavior to the real exception handling
00030 //  if there was no explicit user-supplied try block.
00031 //
00032 
00037 #ifndef _LA_EXCEPTION_H_
00038 #define _LA_EXCEPTION_H_
00039 
00040 #include <iostream>
00041 #include <cstdlib>
00042 
00043 #include <stdexcept>
00044 #include "arch.h"
00045 
00046 #ifndef __ASSERT_H
00047 # include <cassert>
00048 # ifndef __ASSERT_H
00049 #  define __ASSERT_H
00050 # endif
00051 #endif
00052 
00053 // If you want to have exceptions thrown rather than failed
00054 // assertions, uncomment the following lines. Then, in your
00055 // application you have to make sure to include only this file,
00056 // <laexcp.h>, and not <cassert>, and also to include this file
00057 // first of all lapackpp headers.
00058 /*
00059 #undef assert
00060 // This probably works for gcc 3.3.5 on Linux
00061 #define assert(expr) { if (!(expr)) \
00062   { throw LaException(__STRING(expr), __FILE__, \
00063   __LINE__, __ASSERT_FUNCTION); } }
00064 // This was seen to work for gcc 3.4.5 on Win32/mingw
00065 //#define assert(expr) { if (!(expr)) { throw LaException(#expr, __FILE__, __LINE__, ""); } }
00066 */
00067 
00068 
00073 class DLLIMPORT LaException : public std::runtime_error
00074 {
00075    public:
00077       LaException();
00078       
00089       LaException(const char *where, const char *what);
00090 
00097       LaException(const char *assertion, const char *file,
00098                   unsigned int line, const char *function);
00099 
00107       static void enablePrint(bool enable);
00108    private:
00109       static bool _print;
00110 };
00111 
00112 #endif  // _LA_EXCEPTION_H_
00113 

Generated on Sat Jul 14 11:40:36 2007 for Lapack++ by  doxygen 1.5.0