1 #ifndef GAUDIKERNEL_MSGSTREAM_H
2 #define GAUDIKERNEL_MSGSTREAM_H
247 #if defined(GAUDI_V20_COMPAT) && !defined(G21_NO_ENDREQ)
248 #define endreq endmsg
256 template<
class _E>
inline
257 MsgStream& operator<<( MsgStream& s, const std::_Fillobj<_E>& obj) {
259 if (
s.isActive() )
s.stream().fill(obj._Fill);
261 if (
s.isActive() )
s.stream().fill(obj._Ch);
265 template<
class _Tm>
inline
266 MsgStream& operator << (MsgStream& s, const std::_Smanip<_Tm>& manip) {
268 if (
s.isActive() ) (*manip._Pfun)(
s.stream(), manip._Manarg);
270 if (
s.isActive() ) (*manip._Pf)(
s.stream(), manip._Manarg);
274 #elif defined (__GNUC__)
276 const std::_Setiosflags &manip) {
284 const std::_Resetiosflags &manip) {
292 const std::_Setbase &manip) {
300 const std::_Setprecision &manip) {
308 const std::_Setw &manip) {
319 log.
setf(std::ios_base::dec, std::ios_base::basefield);
324 log.
setf(std::ios_base::hex, std::ios_base::basefield);
329 #else // GCC, version << 3
330 template<
class _Tm>
inline
332 MsgStream& operator << (MsgStream& s, const std::smanip<_Tm>& manip) {
339 #endif // WIN32 or (__GNUC__)
352 template <
typename T>
354 using namespace GaudiUtils;
367 MsgStream& operator << (MsgStream& lhs, const std::_Setfill<T> &manip) {
368 if ( lhs.isActive() )
377 #endif // GAUDIKERNEL_MSGSTREAM_H
std::ostringstream & stream()
Access string MsgStream.
Definition of the MsgStream class used to transmit messages.
MsgStream & operator<<(longlong arg)
const std::string & buffer() const
Access string buffer.
MSG::Level currentLevel()
Retrieve current stream output level.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
bool m_useColors
use colors
GAUDI_API void resetColor()
Reset the colors to defaults.
MSG::Level level()
Retrieve output level.
static bool m_countInactive
Flag to state if the inactive messages has to be counted.
bool isActive() const
Accessor: is MsgStream active.
IMessageSvc * m_service
Pointer to message service if buffer has send.
MsgStream & write(const char *buff, int len)
virtual void incrInactiveCount(MSG::Level level, const std::string &src)=0
Increment deactivated message count.
MsgStream & report(int lvl)
Initialize report of new message: activate if print level is sufficient.
virtual GAUDI_API MsgStream & doOutput()
Output method.
std::string m_source
Use std::string for source information to be passed to the message service.
Provide serialization function (output only) for some common STL classes (vectors, lists, pairs, maps) plus GaudiUtils::Map and GaudiUtils::HashMap.
MSG::Level m_level
Debug level of the message service.
MsgStream & operator<<(MsgStream &s, const std::smanip< _Tm > &manip)
I/O Manipulator for setfill.
GAUDI_API void setColor(MSG::Color col)
Set the text color.
std::ios_base::iostate STATE_TYPE
MsgStream & operator<<(MsgStream &(*_f)(MsgStream &))
Accept MsgStream modifiers.
MsgStream & operator<<(std::ios_base &(*_f)(std::ios_base &))
Accept ios base class modifiers.
long setf(FLAG_TYPE _f, FLAG_TYPE _m)
MsgStream & operator<<(std::ios &(*_f)(std::ios &))
Accept ios modifiers.
void clear(STATE_TYPE _i=std::ios_base::failbit)
void deactivate()
Deactivate MsgStream.
std::ostringstream m_stream
String MsgStream associated to buffer.
The IMessage is the interface implemented by the message service.
void setMsgSvc(IMessageSvc *svc)
Update IMessageSvc pointer.
bool m_active
Flag set to true if formatting engine is active.
std::string m_buffer
Use standard string for information buffering.
MSG::Level m_currLevel
Current debug level.
GAUDI_API MsgStream(IMessageSvc *svc, int buffer_length=128)
Standard constructor: Connect to message service for output.
long flags() const
IOS emulation.
virtual GAUDI_API ~MsgStream()
Standard destructor.
void setLevel(int level)
Update outputlevel.
MsgStream & operator<<(std::ostream &(*_f)(std::ostream &))
Accept oMsgStream modifiers.
void activate()
Activate MsgStream.
MsgStream(const MsgStream &msg)
Copy constructor.
IInactiveMessageCounter * m_inactCounter
Pointer to service counting messages prepared but not printed because of wrong level.
std::ios_base::fmtflags FLAG_TYPE
Error return code in case ios modification is requested for inactive streams.
static GAUDI_API bool enableCountInactive(bool value=true)
Enable/disable the count of inactive messages.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
static GAUDI_API bool countInactive()
Returns the state of the counting of inactive messages (enabled/disabled).
void unsetf(FLAG_TYPE _l)