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 
63  const std::string& getName() const;
64 
65  private:
66  TrigConfMessaging() = delete;
67  TrigConfMessaging( const TrigConfMessaging& rhs ) = delete;
69 
71  mutable boost::thread_specific_ptr<MsgStreamTC> m_msg_tls;
72  std::string m_name;
73  };
74 
75  inline bool TrigConfMessaging::msgLvl (const MSGTC::Level lvl) const
76  {
77  if (msg().level() <= lvl) {
78  msg() << lvl;
79  return true;
80  }
81  else {
82  return false;
83  }
84  }
85 
87  {
88  MsgStreamTC* ms = m_msg_tls.get();
89  if (!ms) {
90  ms = new MsgStreamTC(m_name);
91  m_msg_tls.reset(ms);
92  }
93  return *ms;
94  }
95 
96  inline MsgStreamTC& TrigConfMessaging::msg (const MSGTC::Level lvl) const
97  {
98  return msg() << lvl;
99  }
100 
101  inline const std::string& TrigConfMessaging::getName() const {
102  return m_name;
103  }
104 } // namespace TrigConf
105 
106 #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:71
MsgStream.h
MsgStream for TrigConf classes.
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:72
TrigConf::TrigConfMessaging::getName
const std::string & getName() const
name accessor
Definition: TrigConfMessaging.h:101
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition: TrigConfMessaging.h:86
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:75
TrigConf::TrigConfMessaging::TrigConfMessaging
TrigConfMessaging(const TrigConfMessaging &rhs)=delete
TrigConf::TrigConfMessaging::operator=
TrigConfMessaging & operator=(const TrigConfMessaging &rhs)=delete
python.SystemOfUnits.ms
float ms
Definition: SystemOfUnits.py:148