#ifndef ROOT_TMVA_MsgLogger
#define ROOT_TMVA_MsgLogger
#include <string>
#include <sstream>
#include <iostream>
#include <map>
#ifndef ROOT_TObject
#include "TObject.h"
#endif
namespace TMVA {
enum EMsgType {
kDEBUG = 1,
kVERBOSE = 2,
kINFO = 3,
kWARNING = 4,
kERROR = 5,
kFATAL = 6,
kSILENT = 7
};
class MsgLogger : public std::ostringstream, public TObject {
public:
MsgLogger( const TObject* source, EMsgType minType = kINFO );
MsgLogger( const std::string& source, EMsgType minType = kINFO );
MsgLogger( EMsgType minType = kINFO );
MsgLogger( const MsgLogger& parent );
~MsgLogger();
void SetSource ( const std::string& source ) { fStrSource = source; }
EMsgType GetMinType() const { return fMinType; }
void SetMinType( EMsgType minType ) { fMinType = minType; }
std::string GetSource() const { return fStrSource; }
std::string GetPrintedSource() const;
std::string GetFormattedSource() const;
static UInt_t GetMaxSourceSize() { return (UInt_t)fgMaxSourceSize; }
MsgLogger& operator= ( const MsgLogger& parent );
static MsgLogger& Endmsg( MsgLogger& logger );
MsgLogger& operator<< ( MsgLogger& ( *_f )( MsgLogger& ) );
MsgLogger& operator<< ( std::ostream& ( *_f )( std::ostream& ) );
MsgLogger& operator<< ( std::ios& ( *_f )( std::ios& ) );
MsgLogger& operator<< ( EMsgType type );
template <class T> MsgLogger& operator<< ( T arg ) {
*(std::ostringstream*)this << arg;
return *this;
}
private:
void Send();
void InitMaps();
void WriteMsg( EMsgType type, const std::string& line ) const;
const TObject* fObjSource;
std::string fStrSource;
const std::string fPrefix;
const std::string fSuffix;
EMsgType fActiveType;
static UInt_t fgMaxSourceSize;
std::map<EMsgType, std::string> fTypeMap;
std::map<EMsgType, std::string> fColorMap;
EMsgType fMinType;
ClassDef(MsgLogger,0)
};
inline MsgLogger& MsgLogger::operator<< ( MsgLogger& (*_f)( MsgLogger& ) )
{
return (_f)(*this);
}
inline MsgLogger& MsgLogger::operator<< ( std::ostream& (*_f)( std::ostream& ) )
{
(_f)(*this);
return *this;
}
inline MsgLogger& MsgLogger::operator<< ( std::ios& ( *_f )( std::ios& ) )
{
(_f)(*this);
return *this;
}
inline MsgLogger& MsgLogger::operator<< ( EMsgType type )
{
fActiveType = type;
return *this;
}
#define Endl MsgLogger::Endmsg
}
#endif // TMVA_MsgLogger
Last change: Sat Nov 1 10:21:59 2008
Last generated: 2008-11-01 10:21
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.