ROOT
6.13/01
Reference Guide
math
mathcore
inc
Math
Error.h
Go to the documentation of this file.
1
// @(#)root/mathcore:$Id$
2
// Authors: L. Moneta
3
4
/**********************************************************************
5
* *
6
* Copyright (c) 2007 LCG ROOT Math team, CERN/PH-SFT *
7
* *
8
**********************************************************************/
9
10
#ifndef ROOT_Math_Error
11
#define ROOT_Math_Error
12
13
14
15
16
#ifdef DEBUG
17
#ifndef WARNINGMSG
18
#define WARNINGMSG
19
#endif
20
#endif
21
22
23
24
/**
25
Pre-processor macro to report messages
26
which can be configured to use ROOT error or
27
simply an std::iostream in case of stan-alone builds
28
*/
29
30
#ifndef USE_ROOT_ERROR
31
32
// use std::iostream instead of ROOT
33
34
#include <iostream>
35
36
#ifndef ROOT_MATH_LOG
37
#define ROOT_MATH_OS std::cerr
38
#else
39
#define ROOT_MATH_LOG
40
#endif
41
42
// giving a location + string
43
44
#define MATH_INFO_MSG(loc,str) \
45
ROOT_MATH_OS << "Info in ROOT::Math::" << loc << ">: " << str \
46
<< std::endl;
47
#define MATH_WARN_MSG(loc,str) \
48
ROOT_MATH_OS << "Warning in ROOT::Math::" << loc << ">: " << str \
49
<< std::endl;
50
#define MATH_ERROR_MSG(loc,str) \
51
ROOT_MATH_OS << "Error in ROOT::Math::" << loc << ">: " << str \
52
<< std::endl;
53
54
// giving location + a value
55
56
# define MATH_INFO_VAL(loc,x) \
57
ROOT_MATH_OS << "Info in <ROOT::Math::" << loc << ">: " << #x << " = " << (x) << std::endl;
58
# define MATH_WARN_VAL(loc,x) \
59
ROOT_MATH_OS << "Warning in ROOT::Math::" << loc << ">: " << #x << " = " << (x) << std::endl;
60
# define MATH_ERROR_VAL(loc,x) \
61
ROOT_MATH_OS << "Error in ROOT::Math::" << loc << ">: " << #x << " = " << (x) << std::endl;
62
63
// giving a location + string + value
64
65
# define MATH_INFO_MSGVAL(loc,str,x) \
66
ROOT_MATH_OS << "Info in <ROOT::Math::" << loc << ">: " << str << "; " << #x << " = " << (x) << std::endl;
67
# define MATH_WARN_MSGVAL(loc,str,x) \
68
ROOT_MATH_OS << "Warning in ROOT::Math::" << loc << ">: " << str << "; " << #x << " = " << (x) << std::endl;
69
# define MATH_ERROR_MSGVAL(loc,str,x) \
70
ROOT_MATH_OS << "Error in ROOT::Math::" << loc << ">: " << str << "; " << #x << " = " << (x) << std::endl;
71
72
73
#else
74
// use ROOT error reporting system
75
76
#include "TError.h"
77
#include "
Math/Util.h
"
78
79
#define MATH_INFO_MSG(loc,str) \
80
{std::string sl = "ROOT::Math::" + std::string(loc); \
81
::Info(sl.c_str(),"%s",str);}
82
#define MATH_WARN_MSG(loc,str) \
83
{std::string sl = "ROOT::Math::" + std::string(loc); \
84
::Warning(sl.c_str(),"%s",str);}
85
#define MATH_ERROR_MSG(loc,str) \
86
{std::string sl = "ROOT::Math::" + std::string(loc); \
87
::Error(sl.c_str(),"%s",str);}
88
89
# define MATH_INFO_VAL(loc,x) \
90
{std::string sl = "ROOT::Math::" + std::string(loc); \
91
std::string str = std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
92
::Info(sl.c_str(),"%s",str.c_str() );}
93
# define MATH_WARN_VAL(loc,x) \
94
{std::string sl = "ROOT::Math::" + std::string(loc); \
95
std::string str = std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
96
::Warning(sl.c_str(),"%s",str.c_str() );}
97
# define MATH_ERROR_VAL(loc,x) \
98
{std::string sl = "ROOT::Math::" + std::string(loc); \
99
std::string str = std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
100
::Error(sl.c_str(),"%s",str.c_str() );}
101
102
103
# define MATH_INFO_MSGVAL(loc,txt,x) \
104
{std::string sl = "ROOT::Math::" + std::string(loc); \
105
std::string str = std::string(txt) + std::string("; ") + std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
106
::Info(sl.c_str(),"%s",str.c_str() );}
107
# define MATH_WARN_MSGVAL(loc,txt,x) \
108
{std::string sl = "ROOT::Math::" + std::string(loc); \
109
std::string str = std::string(txt) + std::string("; ") + std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
110
::Warning(sl.c_str(),"%s",str.c_str() );}
111
# define MATH_ERROR_MSGVAL(loc,txt,x) \
112
{std::string sl = "ROOT::Math::" + std::string(loc); \
113
std::string str = std::string(txt) + std::string("; ") + std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
114
::Error(sl.c_str(),"%s",str.c_str() );}
115
116
117
118
#endif
119
120
121
#endif // ROOT_MATH_Error
Util.h