StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
debug.h
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project *
3  * All rights reserved. *
4  * *
5  * Primary Authors: *
6  * Copyright 2009 Matthias Kretz <kretz@kde.org> *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
17 #ifndef DEBUG_H
18 #define DEBUG_H
19 
20 #include <iostream>
21 
22 static class AliHLTTPCCANoDebugStream {
23  public:
24  inline AliHLTTPCCANoDebugStream &operator<<( std::ostream &(*)(std::ostream &) ) { return *this; }
25 
26  template<typename T>
27  inline AliHLTTPCCANoDebugStream &operator<<( const T & ) { return *this; }
28 } AliHLTTPCCANoDebugStreamInst;
29 
30 #ifdef DEBUG_MESSAGES
31 template<typename T> inline void prepareForDebugOutput( const typename T::Mask k, T *x0,
32  T *x1 = 0, T *x2 = 0, T *x3 = 0, T *x4 = 0, T *x5 = 0, T *x6 = 0, T *x7 = 0, T *x8 = 0, T *x9 = 0) {
33  if ( x0 ) ( *x0 )( k ) = T( 0 );
34  if ( x1 ) ( *x1 )( k ) = T( 0 );
35  if ( x2 ) ( *x2 )( k ) = T( 0 );
36  if ( x3 ) ( *x3 )( k ) = T( 0 );
37  if ( x4 ) ( *x4 )( k ) = T( 0 );
38  if ( x5 ) ( *x5 )( k ) = T( 0 );
39  if ( x6 ) ( *x6 )( k ) = T( 0 );
40  if ( x7 ) ( *x7 )( k ) = T( 0 );
41  if ( x8 ) ( *x8 )( k ) = T( 0 );
42  if ( x9 ) ( *x9 )( k ) = T( 0 );
43 }
44 #if DEBUG_MESSAGES & 1
45 inline std::ostream &debugS() { return std::cerr; }
46 #else
47 inline AliHLTTPCCANoDebugStream &debugS() { return AliHLTTPCCANoDebugStreamInst; }
48 #endif
49 #if DEBUG_MESSAGES & 2
50 inline std::ostream &debugF() { return std::cerr; }
51 #else
52 inline AliHLTTPCCANoDebugStream &debugF() { return AliHLTTPCCANoDebugStreamInst; }
53 #endif
54 #if DEBUG_MESSAGES & 4
55 inline std::ostream &debugKF() { return std::cerr; }
56 #else
57 inline AliHLTTPCCANoDebugStream &debugKF() { return AliHLTTPCCANoDebugStreamInst; }
58 #endif
59 #if DEBUG_MESSAGES & 8
60 inline std::ostream &debugTS() { return std::cerr; }
61 #else
62 inline AliHLTTPCCANoDebugStream &debugTS() { return AliHLTTPCCANoDebugStreamInst; }
63 #endif
64 #if DEBUG_MESSAGES & 16
65 inline std::ostream &debugWO() { return std::cerr; }
66 #else
67 inline AliHLTTPCCANoDebugStream &debugWO() { return AliHLTTPCCANoDebugStreamInst; }
68 #endif
69 #else
70 template<typename T> inline void prepareForDebugOutput( const typename T::Mask, T *,
71  T * = 0, T * = 0, T * = 0, T * = 0, T * = 0, T * = 0, T * = 0, T * = 0, T * = 0) {}
72 inline AliHLTTPCCANoDebugStream &debugS() { return AliHLTTPCCANoDebugStreamInst; }
73 inline AliHLTTPCCANoDebugStream &debugF() { return AliHLTTPCCANoDebugStreamInst; }
74 inline AliHLTTPCCANoDebugStream &debugKF() { return AliHLTTPCCANoDebugStreamInst; }
75 inline AliHLTTPCCANoDebugStream &debugTS() { return AliHLTTPCCANoDebugStreamInst; }
76 inline AliHLTTPCCANoDebugStream &debugWO() { return AliHLTTPCCANoDebugStreamInst; }
77 #endif
78 
79 #endif // DEBUG_H