//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00017 #ifndef _ERRORMACROS_H 00018 #define _ERRORMACROS_H 00019 00020 #include <iostream> 00021 00024 #ifdef NVERBOSE // Not verbose mode 00025 # ifndef REPORT 00026 # define REPORT 00027 # endif 00028 # ifndef MESSAGE 00029 // Cannot be empty because of the comma operator in THROW(x) 00030 # define MESSAGE(x) 0 00031 # endif 00032 # ifndef MESSAGE_IF 00033 # define MESSAGE_IF(cond, m) 0 00034 # endif 00035 #else // Verbose mode 00036 # ifndef REPORT 00037 # define REPORT std::cerr << "\nIn file " << __FILE__ << ", line " << __LINE__ << std::endl 00038 # endif 00039 # ifndef MESSAGE 00040 # define MESSAGE(x) std::cerr << "\nIn file " << __FILE__ << ", line " << __LINE__ << ": " << x << std::endl 00041 # endif 00042 # ifndef MESSAGE_IF 00043 # define MESSAGE_IF(cond, m) do {if(cond) MESSAGE(m);} while(0) 00044 # endif 00045 #endif 00046 00047 #ifndef GO_NO_CHECKS 00048 #define GO_NO_CHECKS 00049 #endif 00050 00052 #ifndef THROW 00053 # define THROW(x) MESSAGE(x), throw std::exception() 00054 #endif 00055 00056 #define ALWAYS_ERROR_IF(condition, message) do {if(condition){ THROW(message);}} while(0) 00057 00061 #ifdef NDEBUG // Not in debug mode 00062 # ifndef ASSERT 00063 # define ASSERT(x) 00064 # endif 00065 # ifndef ASSERT2 00066 # define ASSERT2(cond, x) 00067 # endif 00068 # ifndef DEBUG_ERROR_IF 00069 # define DEBUG_ERROR_IF(cond, x) 00070 # endif 00071 #else // Debug mode 00072 # ifndef ASSERT 00073 # define ASSERT(cond) if (!(cond)) THROW("Assertion \'" #cond "\' failed.") 00074 # endif 00075 # ifndef ASSERT2 00076 # define ASSERT2(cond, x) do { if (!(cond)) THROW(x);} while(0) 00077 # endif 00078 # ifndef DEBUG_ERROR_IF 00079 //# define DEBUG_ERROR_IF(cond, x) if (cond) THROW(x) 00080 # define DEBUG_ERROR_IF(cond, x) do { if (cond) THROW(x); } while(0) 00081 # endif 00082 #endif 00083 00084 00085 #endif // _ERRORMACROS_H 00086 00087 00088 00089
Generated on Tue Sep 21 15:44:17 2010 for GoTools Core by  doxygen 1.6.3