00001
00007 #ifndef DEBUG_HPP
00008 #define DEBUG_HPP
00009
00010 #include <iostream>
00011 #include <cstdio>
00012 #include <cstdlib>
00013 #include <string>
00014
00015
00016
00017 #define ASSERTIONS_ON 0
00018 #define DEBUG_MESSAGES_ON 0
00019
00020
00021
00022
00023
00024
00025
00026 #if ASSERTIONS_ON
00027
00028 #define fatalAssert( X, MSG ) if( !( X ) ) { std::cout << "Fatal assertion failed: " << std::endl << "\tContidion: " << #X << std::endl << "\tFile: " << __FILE__ << std::endl << "\tLine: " << __LINE__ << std::endl << "\tMessage: " << MSG << std::endl; int *p = NULL; cout << *p; }
00029
00030 #define softAssert( X, MSG ) if( !( X ) ) { std::cout << "Soft assertion failed: " << std::endl << "\tContidion: " << #X << std::endl << "\tFile: " << __FILE__ << std::endl << "\tLine: " << __LINE__ << std::endl << "\tMessage: " << MSG << std::endl; }
00031
00032 #define alwaysAssert( MSG ) { std::cout << "Always assert here: " << std::endl << "\tFile: " << __FILE__ << std::endl << "\tLine: " << __LINE__ << std::endl << "\tMessage: " << MSG << std::endl; int *p = NULL; cout << *p; }
00033 #else
00034 #define fatalAssert( X, MSG ) {}
00035 #define softAssert( X, MSG ) {}
00036 #define alwaysAssert( MSG ) {}
00037 #endif
00038
00039
00040
00041
00042 #if DEBUG_MESSAGES_ON
00043 #define debugMessage( X ) printf X
00044 #else
00045 #define debugMessage( X ) {}
00046 #endif
00047
00048 #endif
00049