File: Error.h

package info (click to toggle)
bornagain 23.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,956 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 356; ruby: 173; xml: 130; makefile: 45; ansic: 24
file content (121 lines) | stat: -rw-r--r-- 4,717 bytes parent folder | download | duplicates (5)
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
// @(#)root/mathcore:$Id$
// Authors: L. Moneta

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2007 LCG ROOT Math team,  CERN/PH-SFT                *
 *                                                                    *
 **********************************************************************/

#ifndef ROOT_Math_Error
#define ROOT_Math_Error




#ifdef DEBUG
#ifndef WARNINGMSG
#define WARNINGMSG
#endif
#endif



/**
   Pre-processor macro to report messages
   which can be configured to use ROOT error or
   simply an std::iostream in case of stan-alone builds
*/

#ifndef USE_ROOT_ERROR

// use std::iostream instead of ROOT

#include <iostream>

#ifndef ROOT_MATH_LOG
#define ROOT_MATH_OS std::cerr
#else
#define ROOT_MATH_LOG
#endif

// giving a location + string

#define MATH_INFO_MSG(loc,str)                   \
   ROOT_MATH_OS << "Info in ROOT::Math::" << loc << ">: "  << str \
       << std::endl;
#define MATH_WARN_MSG(loc,str)                      \
   ROOT_MATH_OS << "Warning in ROOT::Math::" << loc << ">: " << str \
       << std::endl;
#define MATH_ERROR_MSG(loc,str)                   \
   ROOT_MATH_OS << "Error in ROOT::Math::" << loc << ">: " << str \
       << std::endl;

// giving location +  a value

# define MATH_INFO_VAL(loc,x)                                           \
   ROOT_MATH_OS << "Info in <ROOT::Math::" << loc << ">: " << #x << " = " << (x) << std::endl;
# define MATH_WARN_VAL(loc,x)                                           \
   ROOT_MATH_OS << "Warning in ROOT::Math::" << loc << ">: " << #x << " = " << (x) << std::endl;
# define MATH_ERROR_VAL(loc,x)                                          \
   ROOT_MATH_OS << "Error in ROOT::Math::" << loc << ">: " << #x << " = " << (x) << std::endl;

// giving a location + string + value

# define MATH_INFO_MSGVAL(loc,str,x)                                    \
   ROOT_MATH_OS << "Info in <ROOT::Math::" << loc << ">: "  << str << "; " << #x << " = " << (x) << std::endl;
# define MATH_WARN_MSGVAL(loc,str,x)                                    \
   ROOT_MATH_OS << "Warning in ROOT::Math::" << loc << ">: " << str << "; " << #x << " = " << (x) << std::endl;
# define MATH_ERROR_MSGVAL(loc,str,x)                                   \
   ROOT_MATH_OS << "Error in ROOT::Math::" << loc << ">: " << str << "; " << #x << " = " << (x) << std::endl;


#else
// use ROOT error reporting system

#include "TError.h"
#include "Math/Util.h"

#define  MATH_INFO_MSG(loc,str)                 \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
      ::Info(sl.c_str(),"%s",str);}
#define  MATH_WARN_MSG(loc,str)                 \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
      ::Warning(sl.c_str(),"%s",str);}
#define  MATH_ERROR_MSG(loc,str)                \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
      ::Error(sl.c_str(),"%s",str);}

# define MATH_INFO_VAL(loc,x)                                           \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
    std::string str = std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
   ::Info(sl.c_str(),"%s",str.c_str() );}
# define MATH_WARN_VAL(loc,x)                                           \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
    std::string str = std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
   ::Warning(sl.c_str(),"%s",str.c_str() );}
# define MATH_ERROR_VAL(loc,x)                                          \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
    std::string str = std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
   ::Error(sl.c_str(),"%s",str.c_str() );}


# define MATH_INFO_MSGVAL(loc,txt,x)                    \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
    std::string str = std::string(txt) + std::string("; ") + std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
   ::Info(sl.c_str(),"%s",str.c_str() );}
# define MATH_WARN_MSGVAL(loc,txt,x)                      \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
    std::string str = std::string(txt) + std::string("; ") + std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
   ::Warning(sl.c_str(),"%s",str.c_str() );}
# define MATH_ERROR_MSGVAL(loc,txt,x)                     \
   {std::string sl = "ROOT::Math::" + std::string(loc); \
    std::string str = std::string(txt) + std::string("; ") + std::string(#x) + std::string(" = ") + ::ROOT::Math::Util::ToString(x); \
   ::Error(sl.c_str(),"%s",str.c_str() );}



#endif


#endif  // ROOT_MATH_Error