| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 2010

# MsgStream.h File Reference

`#include "GaudiKernel/IMessageSvc.h"`
`#include "GaudiKernel/SerializeSTL.h"`
`#include <cstdio>`
`#include <string>`
`#include <iomanip>`
`#include <vector>`
`#include <sstream>`

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...
## Functions
MsgStream & | endmsg (MsgStream &s)
| MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
GAUDI_API std::string | format (const char *,...)
| MsgStream format utility "a la sprintf(...)".
template<class _Tm>
MsgStream & | operator<< (MsgStream &s, const std::smanip< _Tm > &manip)
| I/O Manipulator for setfill.
template<typename T>
MsgStream & | operator<< (MsgStream &lhs, const T &arg)
| General templated stream operator.

## Function Documentation

MsgStream& endmsg | ( | MsgStream & | s | ) | `[inline]`

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

Definition at line 229 of file MsgStream.h.

    00229                                        {
    00230   return s.doOutput();
    00231 }

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

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

Definition at line 108 of file MsgStream.cpp.

    00109 {
    00110   const int buffsize = 2048;
    00111   static char buffer[buffsize];
    00112   va_list arguments;
    00113   va_start( arguments, fmt );
    00114   if( vsprintf(buffer, fmt, arguments) >= buffsize )
    00115     throw GaudiException("Insufficient buffer size (2048) when formatting message",
    00116                          "MsgStream", 0);
    00117   return std::string(buffer);
    00118 }

template<typename T>

MsgStream& operator<< | ( | MsgStream & | lhs,
|  | const T & | arg |
| ) |  |  | `[inline]`

General templated stream operator.

Definition at line 328 of file MsgStream.h.

    00328                                                       {
    00329   using namespace GaudiUtils;
    00330   if(lhs.isActive())
    00331     try {
    00332       // this may throw, and we cannot afford it if the stream is used in a catch block
    00333       lhs.stream() << arg;
    00334     }
    00335     catch (...) {}
    00336   return lhs;
    00337 }

template<class _Tm>

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

I/O Manipulator for setfill.

Definition at line 317 of file MsgStream.h.

    00317                                                                     {
    00318   try {
    00319     // this may throw, and we cannot afford it if the stream is used in a catch block
    00320     if ( s.isActive() ) s.stream() << manip;
    00321   } catch (...) {}
    00322   return s;
    00323 }