| 1 |
/* |
| 2 |
* debug.h - TaskJuggler |
| 3 |
* |
| 4 |
* SPDX-FileCopyrightText: 2002 Chris Schlaeger <[email protected]> |
| 5 |
* SPDX-FileCopyrightText: 2011 Dag Andersen <[email protected]> |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of version 2 of the GNU General Public License as |
| 9 |
* published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* $Id$ |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifndef _debug_h_ |
| 15 |
#define _debug_h_ |
| 16 |
|
| 17 |
#include "plantj_export.h" |
| 18 |
|
| 19 |
#define DEBUGMODE DebugCtrl.getDebugMode() |
| 20 |
#define DEBUGLEVEL DebugCtrl.getDebugLevel() |
| 21 |
|
| 22 |
#define PFDEBUG 1 // Project File Reader |
| 23 |
#define PSDEBUG 2 // Project Scheduler |
| 24 |
#define TSDEBUG 4 // Task Scheduler |
| 25 |
#define RSDEBUG 8 // Resource Scheduler |
| 26 |
#define EXDEBUG 16 // Expression Tree Ev. |
| 27 |
#define MADEBUG 32 // Macro Expander |
| 28 |
#define XXDEBUG 64 // Unused |
| 29 |
#define PADEBUG 128 // Critical Path |
| 30 |
// Analyzer |
| 31 |
|
| 32 |
#define DEBUGPF(l) ((DEBUGMODE & 1) && DEBUGLEVEL >= l) // Project File Reader |
| 33 |
#define DEBUGPS(l) ((DEBUGMODE & 2) && DEBUGLEVEL >= l) // Project Scheduler |
| 34 |
#define DEBUGTS(l) ((DEBUGMODE & 4) && DEBUGLEVEL >= l) // Task Scheduler |
| 35 |
#define DEBUGRS(l) ((DEBUGMODE & 8) && DEBUGLEVEL >= l) // Resource Scheduler |
| 36 |
#define DEBUGEX(l) ((DEBUGMODE & 16) && DEBUGLEVEL >= l) // Expression Tree Ev. |
| 37 |
#define DEBUGMA(l) ((DEBUGMODE & 32) && DEBUGLEVEL >= l) // Macro Expander |
| 38 |
#define DEBUGXX(l) ((DEBUGMODE & 64) && DEBUGLEVEL >= l) // Unused |
| 39 |
#define DEBUGPA(l) ((DEBUGMODE & 128) && DEBUGLEVEL >= l) // Critical Path |
| 40 |
// Analyzer |
| 41 |
|
| 42 |
class PLANTJ_EXPORT DebugController |
| 43 |
{ |
| 44 |
public: |
| 45 |
DebugController() : |
| 46 |
debugLevel(0), |
| 47 |
debugMode(-1) |
| 48 |
{ } |
| 49 |
|
| 50 |
~DebugController() { } |
| 51 |
|
| 52 |
void setDebugLevel(int l) |
| 53 |
{ |
| 54 |
debugLevel = l; |
| 55 |
} |
| 56 |
int getDebugLevel() const { return debugLevel; } |
| 57 |
|
| 58 |
void setDebugMode(int m) |
| 59 |
{ |
| 60 |
debugMode = m; |
| 61 |
} |
| 62 |
int getDebugMode() const { return debugMode; } |
| 63 |
|
| 64 |
protected: |
| 65 |
int debugLevel; |
| 66 |
int debugMode; |
| 67 |
} ; |
| 68 |
|
| 69 |
extern PLANTJ_EXPORT DebugController DebugCtrl; |
| 70 |
|
| 71 |
#endif |
| 72 |
|