/usr/include/root/TMVA/MsgLogger.h is in libroot-tmva-dev 5.34.30-0ubuntu8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | // @(#)root/tmva $Id$
// Author: Attila Krasznahorkay, Andreas Hoecker, Joerg Stelzer, Eckhard von Toerne
/**********************************************************************************
* Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
* Package: TMVA *
* Class : MsgLogger *
* Web : http://tmva.sourceforge.net *
* *
* Description: *
* TMVA output logger class producing nicely formatted log messages *
* *
* Author: *
* Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - CERN, Switzerland *
* Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
* Joerg Stelzer <stelzer@cern.ch> - DESY, Germany *
* Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany *
* *
* Copyright (c) 2005-2011: *
* CERN, Switzerland *
* U. of Victoria, Canada *
* MPI-K Heidelberg, Germany *
* U. of Bonn, Germany *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted according to the terms listed in LICENSE *
* (http://tmva.sourceforge.net/LICENSE) *
**********************************************************************************/
#ifndef ROOT_TMVA_MsgLogger
#define ROOT_TMVA_MsgLogger
//////////////////////////////////////////////////////////////////////////
// //
// MsgLogger //
// //
// ostringstream derivative to redirect and format output //
// //
//////////////////////////////////////////////////////////////////////////
// STL include(s):
#include <string>
#include <sstream>
#include <iostream>
#include <map>
// ROOT include(s)
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TMVA_Types
#include "TMVA/Types.h"
#endif
// Local include(s):
namespace TMVA {
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();
// Accessors
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; }
// Needed for copying
MsgLogger& operator= ( const MsgLogger& parent );
// Stream modifier(s)
static MsgLogger& Endmsg( MsgLogger& logger );
// Accept stream modifiers
MsgLogger& operator<< ( MsgLogger& ( *_f )( MsgLogger& ) );
MsgLogger& operator<< ( std::ostream& ( *_f )( std::ostream& ) );
MsgLogger& operator<< ( std::ios& ( *_f )( std::ios& ) );
// Accept message type specification
MsgLogger& operator<< ( EMsgType type );
// For all the "conventional" inputs
template <class T> MsgLogger& operator<< ( T arg ) {
*(std::ostringstream*)this << arg;
return *this;
}
// Temporaly disables all the loggers (Caution! Use with care !)
static void InhibitOutput();
static void EnableOutput();
private:
// private utility routines
void Send();
void InitMaps();
void WriteMsg( EMsgType type, const std::string& line ) const;
const TObject* fObjSource; // the source TObject (used for name)
std::string fStrSource; // alternative string source
static const std::string fgPrefix; // the prefix of the source name
static const std::string fgSuffix; // suffix following source name
EMsgType fActiveType; // active type
static UInt_t fgMaxSourceSize; // maximum length of source name
static Bool_t fgOutputSupressed; // disable the output globaly (used by generic booster)
static Bool_t fgInhibitOutput; // flag to suppress all output
static Int_t fgInstanceCounter; // counts open MsgLogger instances
static std::map<EMsgType, std::string>* fgTypeMap; // matches output types with strings
static std::map<EMsgType, std::string>* fgColorMap; // matches output types with terminal colors
EMsgType fMinType; // minimum type for output
ClassDef(MsgLogger,0) // Ostringstream derivative to redirect and format logging output
}; // class MsgLogger
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;
}
// Shortcut
inline MsgLogger& Endl(MsgLogger& ml) { return MsgLogger::Endmsg(ml); }
}
#endif // TMVA_MsgLogger
|