MAIA bb96820c
Multiphysics at AIA
|
The DEBUG class for the maia. More...
#include <debug.h>
Static Public Member Functions | |
static void | maiaerror (MString message, MDebugLevel debugLevel) |
static void | maiaprint (const MString &message, MDebugLevel debugLevel) |
static void | setLevel (MInt debugLevel) |
static void | setLevelNotEnabled (const MInt debugLevel) |
static void | displayOn () |
static void | displayOff () |
Static Public Attributes | |
static MString | debugMessage |
static const MInt | m_minLevel = MAIA_DEBUG_ASSERTION |
static const MInt | m_maxLevel = MAIA_DEBUG_USER5 |
Static Private Attributes | |
static MInt | m_debugLevel |
static MBool | m_debugOn |
static std::basic_string< char > | m_traceSpaces |
This class handles the DEBUG messaging for the maia.
For debugging you mainly use two macros : SET_DEBUG_LEVEL(debuglevel) and DEBUG( message, debuglevel) The SET_DEBUG_LEVEL macro accepts arbitrary or combinations of debug levels, so that you can display only the messages you want to observe. The message that is given to the DEBUG macro is only displayed, if the connected debug level was given to the SET_DEBUG_LEVEL function (as a single value or a combination). If you temporarily want to suppress the DEBUG output you can use the macros DEBUG_DISPLAY_ON and DEBUG_DISPLAY_OFF, which do what their names imply.
The common debug policy in the maia development is that you use MAIA_DEBUG_TRACE only for marking the entry and return point of a function. As long as your code is still experimental use the MAIA_DEBUG_USER levels (choose the numbers at will). If you handover your code, i.e. if it is added to the project all MAIA_DEBUG_USER levels must be removed. All DEBUG output that might be usefull later (i.e. also for other programmers) must be set to MAIA_DEBUG_LEVEL levels.
So (ideally speaking) you should never get code with MAIA_DEBUG_USER levels set and you also should never hand over code which still includes MAIA_DEBUG_USER levels.
------------------------—EXAMPLE :-----------------------------—
SET_DEBUG_LEVEL(MAIA_DEBUG_USER1|MAIA_DEBUG_USER3);
DEBUG ( "Hello", MAIA_DEBUG_USER2 ); // this prints "Hello" if the DEBUG level is set to MAIA_DEBUG_USER2
DEBUG ( "Solver::Solver" << " entry, solverId: " << m_solverId , MAIA_DEBUG_USER2 ); // hint: DEBUG works exactly like cout
--------------------— END OF EXAMPLE :-------------------------—
!!!!!!!!!! Important note !!!!!!!!!!!! SINCE DEBUG IS A MACRO, NEVER BREAK THE LINE IN WHICH YOU USE IT, I.E. DEBUG WON'T WORK WITH ARGUMENTS OF MULTIPLE LINES !
|
inlinestatic |
|
static |
|
inlinestatic |
Definition at line 216 of file debug.h.
|
inlinestatic |
|
inlinestatic |