1 |
//--------------------------------------------------------------------------------------------------
|
2 |
// $Id: Debug.h,v 1.3 2008/06/11 13:27:48 loizides Exp $
|
3 |
//
|
4 |
// Debug
|
5 |
//
|
6 |
// Detailed logging / debug scheme:
|
7 |
// This class defines the debuging masks (EDebugMask), which
|
8 |
// are used with the MDB (MIT DeBug) macro together with
|
9 |
// the log levels to control the verbosity.
|
10 |
// As a rule of thumb:
|
11 |
// level 1 and 2 should not be used in (event) loops,
|
12 |
// level 3 and 4 might be used in loops.
|
13 |
// Please, do not introduce more levels!
|
14 |
//
|
15 |
// Authors: C.Loizides
|
16 |
//
|
17 |
//--------------------------------------------------------------------------------------------------
|
18 |
|
19 |
#ifndef DATAUTIL_DEBUG_H
|
20 |
#define DATAUTIL_DEBUG_H
|
21 |
|
22 |
#include <Rtypes.h>
|
23 |
#include <TError.h>
|
24 |
|
25 |
namespace mithep
|
26 |
{
|
27 |
class Debug
|
28 |
{
|
29 |
public:
|
30 |
enum EDebugMask {
|
31 |
kNone = 0,
|
32 |
kGeneral = 1,
|
33 |
kTreeIO = 2,
|
34 |
kAnalysis = 4,
|
35 |
kModules = 8,
|
36 |
kAll = 0xFFFFFFFF
|
37 |
};
|
38 |
private:
|
39 |
Debug();
|
40 |
virtual ~Debug() {}
|
41 |
Debug(const Debug &cpy);
|
42 |
|
43 |
ClassDef(Debug, 0) // Defines different debug masks
|
44 |
|
45 |
};
|
46 |
|
47 |
}
|
48 |
|
49 |
R__EXTERN mithep::Debug::EDebugMask gDebugMask;
|
50 |
R__EXTERN Int_t gDebugLevel;
|
51 |
|
52 |
#define MDB(mask,level) \
|
53 |
if ((mithep::Debug::mask & gDebugMask) && gDebugLevel >= (level))
|
54 |
|
55 |
#define MitAssert(f,e) \
|
56 |
if (!(e)) Fatal(f, kAssertMsg, _QUOTE_(e), __LINE__, __FILE__)
|
57 |
|
58 |
#define MitAssertStatic(f,e) \
|
59 |
if (!(e)) ::Fatal(f, kAssertMsg, _QUOTE_(e), __LINE__, __FILE__)
|
60 |
|
61 |
#endif
|