ATLAS Offline Software
TrigConfMessaging.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGCONFBASE_TRIGCONFMESSAGING_H
6 #define TRIGCONFBASE_TRIGCONFMESSAGING_H 1
7 
15 #include <string>
16 #include <boost/thread/tss.hpp>
17 #include "TrigConfBase/MsgStream.h"
19 
20 namespace TrigConf {
21 
29  public:
30 
34  TrigConfMessaging (const std::string& name) :
35  m_name(name)
36  {}
37 
39  virtual ~TrigConfMessaging() = default;
40 
46  bool msgLvl (const MSGTC::Level lvl) const;
47 
52  MsgStreamTC& msg() const;
53 
58  MsgStreamTC& msg (const MSGTC::Level lvl) const;
59 
60  private:
61  TrigConfMessaging() = delete;
62  TrigConfMessaging( const TrigConfMessaging& rhs ) = delete;
64 
66  mutable boost::thread_specific_ptr<MsgStreamTC> m_msg_tls;
67  std::string m_name;
68  };
69 
70  inline bool TrigConfMessaging::msgLvl (const MSGTC::Level lvl) const
71  {
72  if (msg().level() <= lvl) {
73  msg() << lvl;
74  return true;
75  }
76  else {
77  return false;
78  }
79  }
80 
82  {
83  MsgStreamTC* ms = m_msg_tls.get();
84  if (!ms) {
85  ms = new MsgStreamTC(m_name);
86  m_msg_tls.reset(ms);
87  }
88  return *ms;
89  }
90 
91  inline MsgStreamTC& TrigConfMessaging::msg (const MSGTC::Level lvl) const
92  {
93  return msg() << lvl;
94  }
95 
96 } // namespace TrigConf
97 
98 #endif
TrigConf::TrigConfMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)
Definition: TrigConfMessaging.h:66
MsgStream.h
MsgStream for TrigConf classes.
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::MsgStreamTC
MsgStreamTC class to be used in TrigConf equivalent to Gaudi's MsgStream.
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:48
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
TrigConf::TrigConfMessaging::m_name
std::string m_name
Definition: TrigConfMessaging.h:67
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition: TrigConfMessaging.h:81
TrigConf::TrigConfMessaging::TrigConfMessaging
TrigConfMessaging()=delete
TrigConf::TrigConfMessaging::~TrigConfMessaging
virtual ~TrigConfMessaging()=default
Destructor.
TrigConf::TrigConfMessaging::TrigConfMessaging
TrigConfMessaging(const std::string &name)
Constructor with parameters.
Definition: TrigConfMessaging.h:34
TrigConf::name
Definition: HLTChainList.h:35
MsgStreamMacros.h
TrigConf::TrigConfMessaging
Class to provide easy access to TrigConf::MsgStream for TrigConf classes.
Definition: TrigConfMessaging.h:28
TrigConf::TrigConfMessaging::msgLvl
bool msgLvl(const MSGTC::Level lvl) const
Test the output level.
Definition: TrigConfMessaging.h:70
TrigConf::TrigConfMessaging::TrigConfMessaging
TrigConfMessaging(const TrigConfMessaging &rhs)=delete
TrigConf::TrigConfMessaging::operator=
TrigConfMessaging & operator=(const TrigConfMessaging &rhs)=delete