00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef DEBUG_H
00022 #define DEBUG_H
00023
00024 #include<iostream>
00025 #include<stdlib.h>
00026
00027
00028 #define PRINT_FUNCTION_NAME __func__<<"()"
00029
00030
00031 #ifdef DEBUG_LEVEL_LOGIC
00032 #define DEBUG_LOGIC(S) std::cerr << PRINT_FUNCTION_NAME << ": " << S << std::endl;
00033 #define DEBUG_LEVEL_FUNCTION
00034 #else
00035 #define DEBUG_LOGIC(S)
00036 #endif
00037
00038 #ifdef DEBUG_LEVEL_FUNCTION
00039 #define DEBUG_FUNCTION(S) std::cerr << PRINT_FUNCTION_NAME << ": " << S << std::endl;
00040 #define DEBUG_FUNCTION_NOARGS std::cerr << PRINT_FUNCTION_NAME << std::endl;
00041 #define DEBUG_LEVEL_INFO
00042 #else
00043 #define DEBUG_FUNCTION(S)
00044 #define DEBUG_FUNCTION_NOARGS
00045 #endif
00046
00047 #ifdef DEBUG_LEVEL_INFO
00048 #define DEBUG_INFO(S) std::cerr << PRINT_FUNCTION_NAME << ": " << S << std::endl;
00049 #define DEBUG_LEVEL_WARNING
00050 #else
00051 #define DEBUG_INFO(S)
00052 #endif
00053
00054 #ifdef DEBUG_LEVEL_WARNING
00055 #define DEBUG_WARNING(S) std::cerr << PRINT_FUNCTION_NAME << ": " << S << std::endl;
00056 #define DEBUG_LEVEL_ERROR
00057 #else
00058 #define DEBUG_WARNING(S)
00059 #endif
00060
00061
00062 #ifdef DEBUG_LEVEL_ERROR
00063 #define DEBUG_ERROR(S) std::cerr << PRINT_FUNCTION_NAME << ": " << S << std::endl;
00064 #else
00065 #define DEBUG_ERROR(S)
00066 #endif
00067
00068 #define DEBUG_FATAL(S) std::cerr << PRINT_FUNCTION_NAME << ": " << S << std::endl; exit(1);
00069
00070 #endif