last update 20 Sep 2009 |
#include <iostream>
#include "cvrClassName.h"
Go to the source code of this file.
Defines | |
Debugging Macros | |
Developers of the CVR-Libuse following macros to activate debugging code in their implementations. To activate them, the macro _CVR_DEBUG must be defined before including this file. The value of _CVR_DEBUG must be an integer value between 1 and 4 Debug level i+1 includes all information of level i. This means, you should use the macros _cvr_debug and _cvr_debug1 to display critical information, that must always be displayed when debugging is activated and less critical information with higher levels. Don't forget to include the "cvrUndebug.h" file at the end of your source code, to undefine all the debug macros defined here, especially if it is a header file (e.g. _template.h, _inline.h). The typical use of this file is: // somewhere at the beginning of your source file #undef _CVR_DEBUG #define _CVR_DEBUG 1 // comment out this line to remove all debug info. #include "cvrDebug.h" // somewhere in your code you can use _cvr_debug("I've been here with value" << val); _cvr_debug4("Only in level 4 this will be displayed"); // at the end of your file you MUST undefine every debugging macro, to // avoid confusion if someone includes your file! Of course this is // not necessary if your file is a .cpp file. This is important for // _template.h and _inline.h files. #include "cvrUndebug.h" | |
#define | _cvr_debug(a) std::cerr << a |
#define | _cvr_if_debug(a) a |
#define | _cvr_debug1(a) std::cerr << a |
#define | _cvr_if_debug1(a) a |
#define | _cvr_debug2(a) std::cerr << a |
#define | _cvr_if_debug2(a) a |
#define | _cvr_debug3(a) std::cerr << a |
#define | _cvr_if_debug3(a) a |
#define | _cvr_debug4(a) std::cerr << a |
#define | _cvr_if_debug4(a) a |
#define | _cvr_enterCTOR() |
#define | _cvr_leaveCTOR() |
#define | _cvr_enterDTOR() |
#define | _cvr_leaveDTOR() |
#define | _cvr_showVar(a) _cvr_debug(#a " = " << a << "\n") |
The main macros are _cvr_debug* and _cvr_if_debug*, which are active only if the macro symbol _CVR_DEBUG is high enough.
#define _cvr_debug | ( | a | ) | std::cerr << a |
Debug Information Level 0 (always displayed).
#define _cvr_debug1 | ( | a | ) | std::cerr << a |
Debug Information Level 1 (always displayed).
#define _cvr_debug2 | ( | a | ) | std::cerr << a |
Debug Information Level 2.
#define _cvr_debug3 | ( | a | ) | std::cerr << a |
Debug Information Level 3.
#define _cvr_debug4 | ( | a | ) | std::cerr << a |
Debug Information Level 4.
#define _cvr_enterCTOR | ( | ) |
Value:
_cvr_debug2(cvr::className::demangle(typeid(*this).name()) << \ "::ctor(" << std::endl)
It displays the class name followed by the string "::ctor(". It uses debug level 2.
#define _cvr_enterDTOR | ( | ) |
Value:
_cvr_debug2(cvr::className::demangle(typeid(*this).name()) << \ "::dtor(" << std::endl)
It displays the class name followed by the string "::dtor(". It uses debug level 2.
#define _cvr_if_debug | ( | a | ) | a |
Debug Information Level 0 (always displayed).
#define _cvr_if_debug1 | ( | a | ) | a |
Debug Information Level 0 (always displayed).
#define _cvr_if_debug2 | ( | a | ) | a |
Debug Information Level 0 (always displayed).
#define _cvr_if_debug3 | ( | a | ) | a |
Debug Information Level 0 (always displayed).
#define _cvr_if_debug4 | ( | a | ) | a |
Debug Information Level 0 (always displayed).
#define _cvr_leaveCTOR | ( | ) |
Value:
_cvr_debug2(cvr::className::demangle(typeid(*this).name()) << \ "::ctor)" << std::endl)
It displays the class name followed by the string "::ctor)". It uses debug level 2.
#define _cvr_leaveDTOR | ( | ) |
Value:
_cvr_debug2(cvr::className::demangle(typeid(*this).name()) << \ "::dtor)" << std::endl)
It displays the class name followed by the string "::ctor)". It uses debug level 2.
#define _cvr_showVar | ( | a | ) | _cvr_debug(#a " = " << a << "\n") |
Debug macro to display at debug level 0 the value of a given variable.
It displays the name of the variable followed by " = " and the contents of it. The type of the variable must be supported by the std::cerr stream.