]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCLog.h
Make SetChi2 method public
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCLog.h
1 // @(#) $Id$
2 // Original: AliHLTLog.h,v 1.2 2004/06/11 16:06:33 loizides Exp $
3
4 //* This file is property of and copyright by the ALICE HLT Project        * 
5 //* ALICE Experiment at CERN, All rights reserved.                         *
6 //* See cxx source for full Copyright notice                               *
7
8 #ifndef ALIHLTTPCLOG_H
9 #define ALIHLTTPCLOG_H
10
11 #include <sstream>
12 #include <iostream>
13 #include "AliHLTLogging.h"
14
15 using namespace std;
16
17 /** key to indicate the origin part */
18 #define AliHLTTPCLogKeyOrigin  "__origin"
19 /** key to indicate the keyword part */
20 #define AliHLTTPCLogKeyKeyword "__key" 
21 /** key to indicate the message part */
22 #define AliHLTTPCLogKeyMessage "__message"
23
24 /**
25  * @class AliHLTTPCLog
26  * This class implements the old HLT TPC logging mechanism.
27  * Logging messages are now forwarded to the HLT logging system
28  * \em Note: the old LOG and ENDLOG macros should be used any longer,
29  * use the HLT logging macros or AliRoot logging macros instead. 
30  * @see AliHLTLogging
31  *
32  * @ingroup alihlt_tpc
33  */
34 class AliHLTTPCLog  {
35   public:
36   enum TLogLevel { kNone = 0, kBenchmark=0x01,kDebug= 0x02, kInformational = 0x04, kWarning = 0x08, kError = 0x10 , kFatal = 0x20, kPrimary = 0x80, kAll = 0xBF };
37
38  private:
39   /** not used */
40   static const char* kEnd;                                         //! transient
41   /** not used */
42   static const char* kPrec;                                        //! transient
43  public:
44   /** stream manipulator for hex output, but empty in the implementation */
45   static const char* kHex;                                         //! transient
46   /** stream manipulator for decimal output, but empty in the implementation */
47   static const char* kDec;                                         //! transient
48
49   /**
50    * Flush the stringstream and print output to the HLT logging system.
51    * The attributes are set before the message is streamed into the
52    * stringstream.<br>
53    * The LOG macro sets the attributes from the macro arguments and provides
54    * the stringstream.<br>
55    * The ENDLOG macro calls the Flush method after the message was streamed
56    * into the stringstream.
57    */
58   static const char* Flush();
59
60   /**
61    * Get the stream.
62    */
63   static stringstream& GetStream() {return fgStream;}
64
65   /**
66    * Get the logging level.
67    */
68   static TLogLevel GetLevel() {return fgLevel;}
69
70  private:
71   /** a stringstream to receive the output */
72   static stringstream fgStream;                                    // see above
73
74   /** the logging filter */
75   static TLogLevel fgLevel;                                        // see above
76
77   /** HLT logging instance */
78   static AliHLTLogging fgHLTLogging;                               // see above
79
80   /** copy constructor prohibited */
81   AliHLTTPCLog(const AliHLTTPCLog&);
82   /** assignment operator prohibited */
83   AliHLTTPCLog& operator=(const AliHLTTPCLog&);
84
85 };
86
87 /** LOG macro to be used by the TPC code 
88  * \em Note: this macro should be used any longer 
89  */
90 #define LOG( lvl, origin, keyword ) \
91   if (lvl>=AliHLTTPCLog::GetLevel()) AliHLTTPCLog::GetStream() << lvl   \
92                            << " " << AliHLTTPCLogKeyOrigin  << " " << origin \
93                            << " " << AliHLTTPCLogKeyKeyword << " " << keyword \
94                            << " " << AliHLTTPCLogKeyMessage << " "
95
96 /** ENDLOG macro calls the Flush method 
97  * \em Note: this macro should be used any longer 
98  */
99 #define ENDLOG AliHLTTPCLog::Flush()
100
101 #endif /* ALIHLTTPCLOG_H */