BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
MsgLogger.h
Go to the documentation of this file.
1
// @(#)root/tmva $Id$
2
// Author: Attila Krasznahorkay, Andreas Hoecker, Joerg Stelzer, Eckhard von Toerne
3
4
/**********************************************************************************
5
* Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6
* Package: TMVA *
7
* Class : MsgLogger *
8
* Web : http://tmva.sourceforge.net *
9
* *
10
* Description: *
11
* TMVA output logger class producing nicely formatted log messages *
12
* *
13
* Author: *
14
* Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - CERN, Switzerland *
15
* Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
16
* Joerg Stelzer <stelzer@cern.ch> - DESY, Germany *
17
* Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany *
18
* *
19
* Copyright (c) 2005-2011: *
20
* CERN, Switzerland *
21
* U. of Victoria, Canada *
22
* MPI-K Heidelberg, Germany *
23
* U. of Bonn, Germany *
24
* *
25
* Redistribution and use in source and binary forms, with or without *
26
* modification, are permitted according to the terms listed in LICENSE *
27
* (http://tmva.sourceforge.net/LICENSE) *
28
**********************************************************************************/
29
30
#ifndef ROOT_TMVA_MsgLogger
31
#define ROOT_TMVA_MsgLogger
32
33
#include "
TMVA/Types.h
"
34
#include "
TObject.h
"
35
#include <iostream>
36
#include <sstream>
37
#include <string>
38
39
namespace
TMVA
40
{
41
42
class
MsgLogger
:
public
std::ostringstream,
public
TObject
43
{
44
45
public
:
46
MsgLogger
(
const
std::string& source)
47
:
fStrSource
(source)
48
{
49
}
50
51
MsgLogger
&
operator<<
(
MsgLogger
& (*_f)(
MsgLogger
&));
52
MsgLogger
&
operator<<
(std::ostream& (*_f)(std::ostream&));
53
MsgLogger
&
operator<<
(std::ios& (*_f)(std::ios&));
54
55
// Accept message type specification
56
MsgLogger
&
operator<<
(
EMsgType
type);
57
58
// For all the "conventional" inputs
59
template
<
class
T>
MsgLogger
&
operator<<
(T arg)
60
{
61
*(std::ostringstream*)
this
<< arg;
62
return
*
this
;
63
}
64
65
private
:
66
std::string
fStrSource
;
67
};
68
69
inline
MsgLogger
&
MsgLogger::operator<<
(
MsgLogger
& (*_f)(
MsgLogger
&)) {
return
(_f)(*this); }
70
71
inline
MsgLogger
&
MsgLogger::operator<<
(std::ostream& (*_f)(std::ostream&))
72
{
73
(_f)(*
this
);
74
return
*
this
;
75
}
76
77
inline
MsgLogger
&
MsgLogger::operator<<
(std::ios& (*_f)(std::ios&))
78
{
79
(_f)(*
this
);
80
return
*
this
;
81
}
82
83
inline
MsgLogger
&
MsgLogger::operator<<
(
EMsgType
type) { *(std::ostringstream*)
this
<< type <<
" "
;
return
*
this
; }
84
85
inline
MsgLogger
&
Endl
(
MsgLogger
& ml)
86
{
87
ml <<
"\n"
;
88
return
ml;
89
}
90
}
91
92
#endif
// TMVA_MsgLogger
Types.h
TObject.h
TMVA::MsgLogger
Definition:
MsgLogger.h:43
TMVA::MsgLogger::MsgLogger
MsgLogger(const std::string &source)
Definition:
MsgLogger.h:46
TMVA::MsgLogger::fStrSource
std::string fStrSource
Definition:
MsgLogger.h:66
TMVA::MsgLogger::operator<<
MsgLogger & operator<<(MsgLogger &(*_f)(MsgLogger &))
Definition:
MsgLogger.h:69
TMVA::MsgLogger::operator<<
MsgLogger & operator<<(T arg)
Definition:
MsgLogger.h:59
TObject
Definition:
TObject.h:5
TMVA
Definition:
GeneticMinimizer.h:21
TMVA::EMsgType
EMsgType
Definition:
Types.h:57
TMVA::Endl
MsgLogger & Endl(MsgLogger &ml)
Definition:
MsgLogger.h:85
Fit
3rdparty
RootMinimizers
TMVA
MsgLogger.h
Generated by
1.9.1