ATLAS Offline Software
Control/AthToolSupport/AsgMessaging/AsgMessaging/MsgStream.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 ASGMESSAGING_MSGSTREAM_H
6 #define ASGMESSAGING_MSGSTREAM_H
7 
8 // System include(s):
9 #include <string>
10 #include <sstream>
11 
12 // Local include(s):
13 #include "AsgMessaging/MsgLevel.h"
15 
16 #ifndef XAOD_STANDALONE
17 # include "GaudiKernel/MsgStream.h"
18 #else // not XAOD_STANDALONE
19 
31 class MsgStream : public std::ostringstream {
32 
33 public:
35  MsgStream( const INamedInterface* tool = 0 );
37  MsgStream( const std::string& name );
39  MsgStream( void* msgSvc, const std::string& name, int buffer_length = 128 );
40 
43 
45  MsgStream& operator<< ( MsgStream& ( *_f )( MsgStream& ) );
47  MsgStream& operator<< ( std::ostream& ( *_f )( std::ostream& ) );
49  MsgStream& operator<< ( std::ios& ( *_f )( std::ios& ) );
50 
52  MsgStream& operator<< ( MSG::Level lvl );
53 
55  template< class T >
56  MsgStream& operator<< ( const T& arg ) {
57  ( * ( std::ostringstream* ) this ) << arg;
58  return *this;
59  }
60 
62 
64  MsgStream& doOutput();
65 
67  static void setSourceWidth( size_t width );
68 
71 
73  void setLevel( MSG::Level lvl );
74 
76  bool msgLevel( MSG::Level lvl ) const;
77 
79  MSG::Level level() const;
80 
82  template<typename T> void
83  declarePropertyFor (T& parent);
84 
86  MSG::Level currentLevel() const;
87 
89 
91  const std::string& name() const;
93  void setName( const std::string& name );
94 
95 private:
97  const INamedInterface* m_tool;
99  std::string m_name;
102  int m_lvl;
104  MSG::Level m_reqlvl;
105 
106 }; // class MsgStream
107 
109 inline MsgStream& endmsg( MsgStream& s ) {
110  return s.doOutput();
111 }
112 
113 template<typename T> void MsgStream ::
114 declarePropertyFor (T& parent)
115 {
116  parent.declareProperty ("OutputLevel", m_lvl, "output message level");
117 }
119 #define endreq endmsg
120 
121 #endif // not XAOD_STANDALONE
122 #endif // ASGMESSAGING_MSGSTREAM_H
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
INamedInterface.h
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
pool::DbPrintLvl::setLevel
void setLevel(MsgLevel l)
Definition: DbPrint.h:32
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
test_pyathena.parent
parent
Definition: test_pyathena.py:15
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
operator<<
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
Definition: TestGaudiProperty.cxx:69
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
MsgLevel.h
Definition of message levels and a helper function.
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35