ATLAS Offline Software
VP1Msg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class VP1Msg //
9 // //
10 // Description: Static methods for consistent message output //
11 // //
12 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
13 // Initial version: March 2008 //
14 // //
16 
17 #ifndef VP1MSG_H
18 #define VP1MSG_H
19 
20 #include <QStringList>
21 #include "VP1Base/VP1String.h"
22 
23 
24 #pragma once
25 
26 
27 
28 class IVP1System;
29 class VP1Msg : public VP1String {
30 public:
31  static bool verbose() { return m_verbose; } // Returns true if env var VP1_VERBOSE_OUTPUT=1
32  static bool debug() { return m_debug; } // Returns true if env var VP1_DEBUG_OUTPUT=1
33 
34  #if defined BUILDVP1LIGHT
35  static void enableMsg(const QString&, const QString&);
36  #else
37  static void enableMsg(const QString&);
38  #endif
39 
40  static void message(const QString&, IVP1System*sys = 0);//Non-zero sys pointer to get message in GUI
41  static void messageDebug(const QString&);
42  static void messageWarning(const QString&, IVP1System*sys = 0 );
43  static void messageVerbose(const QString&);//This outputs only if verbose() is true.
44  static void messageWarningRed( const QString& str, IVP1System*sys = 0 );
45  static void messageWarningAllRed( const QString& str, IVP1System*sys = 0 );
46  //static void messageWarningAllBlue( const QString& str, IVP1System*sys = 0 );
47 
48  //Overloaded convenience methods, for outputting several lines:
49  static void message(const QStringList&, const QString& addtoend = "", IVP1System*sys = 0 );
50  static void messageDebug(const QStringList&, const QString& addtoend = "" );
51  static void messageVerbose(const QStringList&, const QString& addtoend = "" );
52  static void message(const QString& addtostart, const QStringList&, const QString& addtoend = "", IVP1System*sys = 0 );
53  static void messageDebug(const QString& addtostart, const QStringList&, const QString& addtoend = "" );
54  static void messageVerbose(const QString& addtostart, const QStringList&, const QString& addtoend = "" );
55 
56  static const char* prefix_msg() { return "VP1MESSAGE";}
57  static const char* prefix_debug() { return "VP1MSG_DEBUG";}
58  static const char* prefix_warning() { return "VP1MSG_WARNING";}
59  static const char* prefix_verbose() { return "VP1MSG_VERBOSE";}
60 
61 private:
62  VP1Msg(){}
63  ~VP1Msg(){}
64  static std::atomic<bool> m_verbose;
65  static std::atomic<bool> m_debug;
66 };
67 
68 #endif
VP1Msg::m_debug
static std::atomic< bool > m_debug
Definition: VP1Msg.h:65
VP1Msg::m_verbose
static std::atomic< bool > m_verbose
Definition: VP1Msg.h:64
VP1String
Definition: VP1String.h:43
VP1String.h
VP1Msg::debug
static bool debug()
Definition: VP1Msg.h:32
VP1Msg::messageWarningAllRed
static void messageWarningAllRed(const QString &str, IVP1System *sys=0)
Definition: VP1Msg.cxx:70
VP1Msg::prefix_warning
static const char * prefix_warning()
Definition: VP1Msg.h:58
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
VP1Msg::enableMsg
static void enableMsg(const QString &)
Definition: VP1Msg.cxx:198
IVP1System
Definition: IVP1System.h:36
VP1Msg::VP1Msg
VP1Msg()
Definition: VP1Msg.h:62
VP1Msg::prefix_msg
static const char * prefix_msg()
Definition: VP1Msg.h:56
VP1Msg
Definition: VP1Msg.h:29
VP1Msg::messageWarning
static void messageWarning(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:48
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
VP1Msg::prefix_debug
static const char * prefix_debug()
Definition: VP1Msg.h:57
VP1Msg::prefix_verbose
static const char * prefix_verbose()
Definition: VP1Msg.h:59
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
str
Definition: BTagTrackIpAccessor.cxx:11
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
VP1Msg::messageWarningRed
static void messageWarningRed(const QString &str, IVP1System *sys=0)
Definition: VP1Msg.cxx:57
VP1Msg::~VP1Msg
~VP1Msg()
Definition: VP1Msg.h:63