LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiDebug.h File Reference

Definition of macros for debug purposes. More...

#include <iostream>
#include "ltiClassName.h"
Include dependency graph for ltiDebug.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Debugging Macros

Developers of the LTI-Lib use following macros to activate debugging code in their implementations.

To activate them, the macro _LTI_DEBUG must be defined before including this file. The value of _LTI_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 _lti_debug and _lti_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 "ltiUndebug.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 _LTI_DEBUG
 #define _LTI_DEBUG 1 // comment out this line to remove all debug info.
 #include "ltiDebug.h"

 // somewhere in your code you can use 
 _lti_debug("I've been here with value" << val);
 
 _lti_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 "ltiUndebug.h"


#define _lti_debug(a)   std::cerr << a
#define _lti_if_debug(a)   a
#define _lti_debug1(a)   std::cerr << a
#define _lti_if_debug1(a)   a
#define _lti_debug2(a)   std::cerr << a
#define _lti_if_debug2(a)   a
#define _lti_debug3(a)   std::cerr << a
#define _lti_if_debug3(a)   a
#define _lti_debug4(a)   std::cerr << a
#define _lti_if_debug4(a)   a
#define _lti_enterCTOR()   _lti_debug2(_lti_cname.get(*this) << "::ctor(" << std::endl)
#define _lti_leaveCTOR()   _lti_debug2(_lti_cname.get(*this) << "::ctor)" << std::endl)
#define _lti_enterDTOR()   _lti_debug2(_lti_cname.get(*this) << "::dtor(" << std::endl)
#define _lti_leaveDTOR()   _lti_debug2(_lti_cname.get(*this) << "::dtor)" << std::endl)
#define _lti_showVar(a)   _lti_debug(#a " = " << a << "\n")
static lti::className _lti_cname

Detailed Description

Definition of macros for debug purposes.


Define Documentation

#define _lti_debug (  )     std::cerr << a

Debug Information Level 0 (always displayed).

Referenced by lti::studentDistribution::acceptLUT().

#define _lti_debug1 (  )     std::cerr << a

Debug Information Level 1 (always displayed).

#define _lti_debug2 (  )     std::cerr << a

Debug Information Level 2.

#define _lti_debug3 (  )     std::cerr << a

Debug Information Level 3.

#define _lti_debug4 (  )     std::cerr << a

Debug Information Level 4.

 
#define _lti_enterCTOR (  )     _lti_debug2(_lti_cname.get(*this) << "::ctor(" << std::endl)

Debug macro to indicate "entering constructor".

It displays the class name followed by the string "::ctor(". It uses debug level 2.

 
#define _lti_enterDTOR (  )     _lti_debug2(_lti_cname.get(*this) << "::dtor(" << std::endl)

Debug macro to indicate "entering destructor".

It displays the class name followed by the string "::dtor(". It uses debug level 2.

#define _lti_if_debug (  )     a

Debug Information Level 0 (always displayed).

#define _lti_if_debug1 (  )     a

Debug Information Level 0 (always displayed).

#define _lti_if_debug2 (  )     a

Debug Information Level 0 (always displayed).

#define _lti_if_debug3 (  )     a

Debug Information Level 0 (always displayed).

#define _lti_if_debug4 (  )     a

Debug Information Level 0 (always displayed).

 
#define _lti_leaveCTOR (  )     _lti_debug2(_lti_cname.get(*this) << "::ctor)" << std::endl)

Debug macro to indicate "leaving constructor".

It displays the class name followed by the string "::ctor)". It uses debug level 2.

 
#define _lti_leaveDTOR (  )     _lti_debug2(_lti_cname.get(*this) << "::dtor)" << std::endl)

Debug macro to indicate "leaving destructor".

It displays the class name followed by the string "::ctor)". It uses debug level 2.

#define _lti_showVar (  )     _lti_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.


Variable Documentation

Debug Information Level 0 (always displayed).


Generated on Sat Apr 10 15:26:24 2010 for LTI-Lib by Doxygen 1.6.1