All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

MsgStreamendmsg (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 >
MsgStreamoperator<< (MsgStream &s, const std::smanip< _Tm > &manip)
 I/O Manipulator for setfill. More...
 
MsgStreamoperator<< (MsgStream &s, const char *arg)
 Specialization to avoid the generation of implementations for char[]. More...
 
template<typename T >
MsgStreamoperator<< (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 243 of file MsgStream.h.

243  {
244  return s.doOutput();
245 }
virtual GAUDI_API MsgStream & doOutput()
Output method.
Definition: MsgStream.cpp:72
GAUDI_API std::string format ( const char *  ,
  ... 
)

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

Definition at line 133 of file MsgStream.cpp.

134 {
135  const int buffsize = 2048;
136  static char buffer[buffsize];
137  va_list arguments;
138  va_start( arguments, fmt );
139  if( vsprintf(buffer, fmt, arguments) >= buffsize )
140  throw GaudiException("Insufficient buffer size (2048) when formatting message",
141  "MsgStream", 0);
142  return std::string(buffer);
143 }
Define general base for Gaudi exception.
template<class _Tm >
MsgStream& operator<< ( MsgStream s,
const std::smanip< _Tm > &  manip 
)
inline

I/O Manipulator for setfill.

Definition at line 331 of file MsgStream.h.

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

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

See also
{bug #87340}

Definition at line 342 of file MsgStream.h.

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

General templated stream operator.

Definition at line 352 of file MsgStream.h.

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