| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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

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

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

Definition at line 209 of file MsgStream.h.

209 { return s.doOutput(); }
MsgStream::doOutput
virtual GAUDI_API MsgStream & doOutput()
Output method.
Definition: MsgStream.cpp:60

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

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

Definition at line 120 of file MsgStream.cpp.

121 {
122 const int buffsize = 2048;
123 static char buffer[buffsize];
124 va_list arguments;
125 va_start( arguments, fmt );
126 if ( vsnprintf( buffer, buffsize, fmt, arguments ) >= buffsize )
127 throw GaudiException( "Insufficient buffer size (" + std::to_string( buffsize ) + ") when formatting message",
128 "MsgStream", 0 );
129 va_end( arguments );
130 return std::string( buffer );
131 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
std::to_string
T to_string(T...args)
std::string
STL class.
std::vsnprintf
T vsnprintf(T...args)
va_list
template<class _Tm >

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

I/O Manipulator for setfill.

Definition at line 286 of file MsgStream.h.

287 {
288 try {
289 // this may throw, and we cannot afford it if the stream is used in a catch block
290 if ( s.isActive() ) s.stream() << manip;
291 } catch ( ... ) {
292 }
293 return s;
294 }
MsgStream::stream
std::ostringstream & stream()
Access string MsgStream.
Definition: MsgStream.h:98
MsgStream::isActive
bool isActive() const
Accessor: is MsgStream active.
Definition: MsgStream.h:116
gaudirun.s
string s
Definition: gaudirun.py:253

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

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

See also
  {bug #87340}

Definition at line 313 of file MsgStream.h.

314 {
315 try {
316 // this may throw, and we cannot afford it if the stream is used in a catch block
317 if ( s.isActive() ) s.stream() << arg;
318 } catch ( ... ) {
319 }
320 return s;
321 }
MsgStream::stream
std::ostringstream & stream()
Access string MsgStream.
Definition: MsgStream.h:98
MsgStream::isActive
bool isActive() const
Accessor: is MsgStream active.
Definition: MsgStream.h:116
gaudirun.s
string s
Definition: gaudirun.py:253
template<typename T >

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

General templated stream operator.

Definition at line 325 of file MsgStream.h.

326 {
327 using namespace GaudiUtils;
328 if ( lhs.isActive() ) try {
329 // this may throw, and we cannot afford it if the stream is used in a catch block
330 lhs.stream() << arg;
331 } catch ( ... ) {
332 }
333 return lhs;
334 }
MsgStream::stream
std::ostringstream & stream()
Access string MsgStream.
Definition: MsgStream.h:98
MsgStream::isActive
bool isActive() const
Accessor: is MsgStream active.
Definition: MsgStream.h:116
GaudiUtils
Forward declarations for the functions in SerializeSTL.h.
Definition: GaudiHistoID.h:140