| The Gaudi Framework v32r1 (f65d50dc)

Classes | Namespaces | Functions
MsgStream.h File Reference
`#include "GaudiKernel/IMessageSvc.h"`
`#include "GaudiKernel/SerializeSTL.h"`
`#include <cstdio>`
`#include <iomanip>`
`#include <sstream>`
`#include <string>`
`#include <vector>`
Include dependency graph for MsgStream.h:

Go to the source code of this file.

## Classes
class | MsgStream
| Definition of the MsgStream class used to transmit messages. More...

## Namespaces
| MSG
| Print levels enumeration.

## Functions
MsgStream & | endmsg (MsgStream &s)
| MsgStream Modifier: endmsg. Calls the output method of the MsgStream. More...
GAUDI_API std::string | format (const char *,...)
| MsgStream format utility "a la sprintf(...)". More...
template<class _Tm >
MsgStream & | operator<< (MsgStream &s, const std::smanip< _Tm > &manip)
| I/O Manipulator for setfill. More...
MsgStream & | MSG::dec (MsgStream &log)
MsgStream & | MSG::hex (MsgStream &log)
MsgStream & | operator<< (MsgStream &s, const char *arg)
| Specialization to avoid the generation of implementations for char[]. More...
template<typename T >
MsgStream & | operator<< (MsgStream &lhs, const T &arg)
| General templated stream operator. More...

## Function Documentation

## ◆ endmsg()

MsgStream& endmsg | ( | MsgStream & | s | ) |
| inline

MsgStream Modifier: endmsg. Calls the output method of the MsgStream.

Definition at line 192 of file MsgStream.h.

192 { return s.doOutput(); }
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ format()

GAUDI_API std::string format | ( | const char * | ,
|  |  | ...
| ) |  |

MsgStream format utility "a la sprintf(...)".

Definition at line 109 of file MsgStream.cpp.

109 {
110 const int buffsize = 2048;
111 static char buffer[buffsize];
112 va_list arguments;
113 va_start( arguments, fmt );
114 if ( vsnprintf( buffer, buffsize, fmt, arguments ) >= buffsize )
115 throw GaudiException( "Insufficient buffer size (" + std::to_string( buffsize ) + ") when formatting message",
116 "MsgStream", StatusCode::FAILURE );
117 va_end( arguments );
118 return std::string( buffer );
119 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:21
std::to_string
T to_string(T... args)
std::string
STL class.
std::vsnprintf
T vsnprintf(T... args)
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
va_list

## ◆ operator<<() [1/3]

template<class _Tm >

MsgStream& operator<< | ( | MsgStream & | s,
|  | const std::smanip< _Tm > & | manip
| ) |  |
| inline

I/O Manipulator for setfill.

Definition at line 257 of file MsgStream.h.

257 {
258 try {
259 // this may throw, and we cannot afford it if the stream is used in a catch block
260 if ( s.isActive() ) s.stream() << manip;
261 } catch ( ... ) {}
262 return s;
263 }
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ operator<<() [2/3]

MsgStream& operator<< | ( | MsgStream & | s,
|  | const char * | arg
| ) |  |
| inline

Specialization to avoid the generation of implementations for char[].

See also
  {bug #87340}

Definition at line 279 of file MsgStream.h.

279 {
280 try {
281 // this may throw, and we cannot afford it if the stream is used in a catch block
282 if ( s.isActive() ) s.stream() << arg;
283 } catch ( ... ) {}
284 return s;
285 }
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ operator<<() [3/3]

template<typename T >

MsgStream& operator<< | ( | MsgStream & | lhs,
|  | const T & | arg
| ) |  |

General templated stream operator.

Definition at line 289 of file MsgStream.h.

289 {
290 using namespace GaudiUtils;
291 if ( lhs.isActive() ) try {
292 // this may throw, and we cannot afford it if the stream is used in a catch block
293 lhs.stream() << arg;
294 } catch ( ... ) {}
295 return lhs;
296 }
MsgStream::stream
std::ostringstream & stream()
Access string MsgStream.
Definition: MsgStream.h:94
MsgStream::isActive
bool isActive() const
Accessor: is MsgStream active.
Definition: MsgStream.h:111
GaudiUtils
Forward declarations for the functions in SerializeSTL.h.
Definition: GaudiHistoID.h:136