00001 /** 00002 * @file Platform/Aperios1.3.2/GTAssert.h 00003 * 00004 * This file contains macros for low level debugging. 00005 * 00006 * @author Thomas Röfer 00007 */ 00008 00009 #ifndef __GTAssert_h_ 00010 #define __GTAssert_h_ 00011 00012 #include <stdio.h> 00013 00014 #ifdef min 00015 #undef min 00016 #endif 00017 #ifdef max 00018 #undef max 00019 #endif 00020 #include <iostream.h> 00021 00022 #ifdef NDEBUG 00023 #define ASSERT(cond) ((void)0) 00024 #define VERIFY(cond) ((void)(cond)) 00025 #define PRINT(text) ((void)0) 00026 00027 #else 00028 00029 /** 00030 * ASSERT prints a message if cond is false and NDEBUG is not defined. 00031 * ASSERT does not evaluate cond if NDEBUG is defined. 00032 * Note that printf will not work in early stages of the creation of an Aperios 00033 * process. Therefore, you will not get any feedback in such a case. If you are 00034 * not sure whether an assertion failure will be reported at a certain position 00035 * in the code, try ASSERT(false). 00036 * @param cond The condition to be checked. 00037 */ 00038 #define ASSERT(cond) {if(!(cond)) ::printf("ASSERT(" #cond ") failed in line %d of file " \ 00039 __FILE__ ".\n",__LINE__);} 00040 00041 /** 00042 * VERIFY prints a message if cond is false and NDEBUG is not defined. 00043 * VERIFY does evaluate cond even if NDEBUG is defined. 00044 * Note that printf will not work in early stages of the creation of an Aperios 00045 * process. Therefore, you will not get any feedback in such a case. If you are 00046 * not sure whether an assertion failure will be reported at a certain position 00047 * in the code, try ASSERT(false). 00048 * @param cond The condition to be checked. 00049 */ 00050 #define VERIFY(cond) {if(!(cond)) ::printf("VERIFY(" #cond ") failed in line %d of file " \ 00051 __FILE__ ".\n",__LINE__);} 00052 00053 /** 00054 * PRINT prints a text directly to the output if and NDEBUG is not defined. 00055 * PRINT does not evaluate the parameter if NDEBUG is defined. 00056 * @param text The text that will be printed. 00057 */ 00058 #define PRINT(text) {cout << text << "\n"; cout.flush();} 00059 00060 #endif 00061 00062 #endif // __GTAssert_h_ 00063 00064 /* 00065 * Change log : 00066 * 00067 * $Log: GTAssert.h,v $ 00068 * Revision 1.3 2004/05/29 13:20:16 dueffert 00069 * GTAssert inclusion problem (min() macro vs. std::min()) really fixed now 00070 * 00071 * Revision 1.2 2004/05/28 18:26:36 dueffert 00072 * GTAssert is allowed in headers again 00073 * 00074 * Revision 1.1.1.1 2004/05/22 17:23:25 cvsadm 00075 * created new repository GT2004_WM 00076 * 00077 * Revision 1.1 2003/10/07 10:06:59 cvsadm 00078 * Created GT2004 (M.J.) 00079 * 00080 * Revision 1.1.1.1 2003/07/02 09:40:24 cvsadm 00081 * created new repository for the competitions in Padova from the 00082 * tamara CVS (Tuesday 2:00 pm) 00083 * 00084 * removed unused solutions 00085 * 00086 * Revision 1.5 2003/05/06 22:19:11 dueffert 00087 * Greenhills compilability restored 00088 * 00089 * Revision 1.4 2003/03/30 11:57:27 loetzsch 00090 * removed backward warnings 00091 * 00092 * Revision 1.3 2003/02/17 10:41:00 dueffert 00093 * greenhills backport 00094 * 00095 * Revision 1.2 2003/02/10 13:59:26 dueffert 00096 * gcc32 adaption 00097 * 00098 * Revision 1.1 2002/09/10 15:40:04 cvsadm 00099 * Created new project GT2003 (M.L.) 00100 * - Cleaned up the /Src/DataTypes directory 00101 * - Removed challenge related source code 00102 * - Removed processing of incoming audio data 00103 * - Renamed AcousticMessage to SoundRequest 00104 * 00105 * Revision 1.1 2002/07/23 13:35:49 loetzsch 00106 * - renamed Debugging.h to GTAssert.h 00107 * - removed #include "Oracle.h" in Win32 version 00108 * 00109 * Revision 1.1.1.1 2002/05/10 12:40:18 cvsadm 00110 * Moved GT2002 Project from ute to tamara. 00111 * 00112 * Revision 1.5 2001/12/30 14:48:37 roefer 00113 * Portable macro PRINT() for direct console output inserted 00114 * 00115 * Revision 1.4 2001/12/10 17:47:08 risler 00116 * change log added 00117 * 00118 */