| The Gaudi Framework v27r1

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

- File List
- File Members

Classes | Functions
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. 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 & | 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 244 of file MsgStream.h.

244 {
245 return s.doOutput();
246 }
MsgStream::doOutput
virtual GAUDI_API MsgStream & doOutput()
Output method.
Definition: MsgStream.cpp:64

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

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

Definition at line 119 of file MsgStream.cpp.

120 {
121 const int buffsize = 2048;
122 static char buffer[buffsize];
123 va_list arguments;
124 va_start( arguments, fmt );
125 if( vsnprintf(buffer, buffsize, fmt, arguments) >= buffsize )
126 throw GaudiException("Insufficient buffer size (" + std::to_string(buffsize) + ") when formatting message",
127 "MsgStream", 0);
128 va_end( arguments );
129 return std::string(buffer);
130 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
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 332 of file MsgStream.h.

332 {
333 try {
334 // this may throw, and we cannot afford it if the stream is used in a catch block
335 if ( s.isActive() ) s.stream() << manip;
336 } catch (...) {}
337 return s;
338 }
MsgStream::stream
std::ostringstream & stream()
Access string MsgStream.
Definition: MsgStream.h:98
MsgStream::isActive
bool isActive() const
Accessor: is MsgStream active.
Definition: MsgStream.h:128
gaudirun.s
string s
Definition: gaudirun.py:245

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

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

See also
  {bug #87340}

Definition at line 343 of file MsgStream.h.

343 {
344 try {
345 // this may throw, and we cannot afford it if the stream is used in a catch block
346 if ( s.isActive() ) s.stream() << arg;
347 } catch (...) {}
348 return s;
349 }
MsgStream::stream
std::ostringstream & stream()
Access string MsgStream.
Definition: MsgStream.h:98
MsgStream::isActive
bool isActive() const
Accessor: is MsgStream active.
Definition: MsgStream.h:128
gaudirun.s
string s
Definition: gaudirun.py:245
template<typename T >

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

General templated stream operator.

Definition at line 353 of file MsgStream.h.

353 {
354 using namespace GaudiUtils;
355 if(lhs.isActive())
356 try {
357 // this may throw, and we cannot afford it if the stream is used in a catch block
358 lhs.stream() << arg;
359 }
360 catch (...) {}
361 return lhs;
362 }
MsgStream::stream
std::ostringstream & stream()
Access string MsgStream.
Definition: MsgStream.h:98
MsgStream::isActive
bool isActive() const
Accessor: is MsgStream active.
Definition: MsgStream.h:128
GaudiUtils
Forward declarations for the functions in SerializeSTL.h.
Definition: GaudiHistoID.h:139