Go to Overview over all GrAL packages.
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Utility/pre-post-conditions.h

Go to the documentation of this file.
00001 #ifndef NMWR_GB_PRE_POST_CONDITION_H
00002 #define NMWR_GB_PRE_POST_CONDITION_H
00003 
00004 
00005 
00006 // $LICENSE
00007 
00008 #include <iostream.h>
00009 #include <stdlib.h>
00010 
00012   
00013 //----------------------------------------------------------------
00032 //----------------------------------------------------------------
00033 
00034 
00035 #define _ERRORLOG cerr
00036 
00037 #define _PRECONDITION_ERROR  _ERRORLOG << "\nERROR in FILE "  << __FILE__ << ", LINE " << __LINE__\
00038    << "\n(compiled on " << __DATE__ << " at " __TIME__  << " )\n"\
00039    << "precondition violated:\n"
00040 
00041 #define _POSTCONDITION_ERROR  _ERRORLOG << "\nERROR in FILE "  << __FILE__ << ", LINE " << __LINE__\
00042    << "\n(compiled on " << __DATE__ << " at " __TIME__  << " )\n"\
00043                                        << ": postcondition violated:\n"
00044 
00045 #define REQUIRE_ALWAYS(condition, error_msg, severity)\
00046  if(! (condition))  { _PRECONDITION_ERROR << #condition << ' ' << error_msg << endl; abort();}
00047 
00048 #define ENSURE_ALWAYS(condition, error_msg, severity)\
00049  if(! (condition)) { _POSTCONDITION_ERROR << #condition << ' ' << error_msg << endl; abort();}
00050 
00051 #ifdef NMWR_DEBUG
00052 
00053 #define REQUIRE(condition, error_msg, severity)\
00054  if(! (condition))  { _PRECONDITION_ERROR << #condition << ' ' << error_msg << endl; abort();}
00055 
00056 #define ENSURE(condition, error_msg, severity)\
00057  if(! (condition)) { _POSTCONDITION_ERROR << #condition << ' '  << error_msg << endl; abort();}
00058 
00059 #else
00060 #define REQUIRE(condition, error_msg, severity) 
00061 #define ENSURE(condition, error_msg, severity)
00062 #endif
00063 
00065 /*
00066 template <class STRING>
00067 void _handle_my_errors(
00068 */
00069 
00070 #endif

Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 15:57:02 2002 for Utilities by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000