thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
Debug.h
1 // -*- C++ -*-
2 //
3 // Debug.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2019 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_Debug_H
10 #define ThePEG_Debug_H
11 // This is the declaration of the Debug class.
12 
13 #include <vector>
14 
15 namespace ThePEG {
16 
21 class Debug {
22 
23 public:
24 
28  enum Levels {
29  noDebug = 0,
32  full = 9
33  };
34 
38  static int level;
39 
45  static bool isset;
46 
54  static std::vector<bool> debugItems;
55 
60  static void debugItem(int item, bool on);
61 
65  static void setDebug(int ilev);
66 
71  static bool debugItem(int item)
72  {
73  if ( level == noDebug ) return false;
74  if ( level == full ) return true;
75  return ( item < 0 || std::size_t(item) >= debugItems.size() )? false:
76  debugItems[item];
77  }
78 
86  static void unmaskFpuErrors();
90  static void unmaskFpuOverflow();
94  static void unmaskFpuUnderflow();
98  static void unmaskFpuDivZero();
102  static void unmaskFpuDenorm();
106  static void unmaskFpuInvalid();
110  static void maskFpuErrors();
114  static void maskFpuOverflow();
118  static void maskFpuUnderflow();
122  static void maskFpuDivZero();
126  static void maskFpuDenorm();
130  static void maskFpuInvalid();
132 
133 };
134 
135 }
136 
137 #endif /* ThePEG_Debug_H */
static void unmaskFpuUnderflow()
Switch on signalling underflow FPU exceptions.
The Debug class defines a number of debug levels and a static public member giving the current debug ...
Definition: Debug.h:21
static void maskFpuOverflow()
Switch off signalling overflow FPU exceptions.
static void maskFpuUnderflow()
Switch off signalling underflow FPU exceptions.
static void maskFpuErrors()
Switch off signalling all FPU exceptions.
static void unmaskFpuInvalid()
Switch on signalling invalid operation FPU exceptions.
static bool isset
If true, the debug level has been set from the outside from the calling program.
Definition: Debug.h:45
static bool debugItem(int item)
Check if a given item should be debugged.
Definition: Debug.h:71
No debugging.
Definition: Debug.h:29
static void setDebug(int ilev)
Set the debug level.
static void unmaskFpuDivZero()
Switch on signalling division by zero FPU exceptions.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
static void unmaskFpuDenorm()
Switch on signalling denormalized argument FPU exceptions.
static void debugItem(int item, bool on)
Switch on or off a given debug item.
static void unmaskFpuErrors()
Switch on signalling all FPU exceptions.
Lowest debug level.
Definition: Debug.h:30
Levels
The different debug levels.
Definition: Debug.h:28
static void maskFpuDivZero()
Switch off signalling division by zero FPU exceptions.
static int level
The current level.
Definition: Debug.h:38
Highest possible debug level.
Definition: Debug.h:32
static void maskFpuDenorm()
Switch off signalling denormalized argument FPU exceptions.
static void unmaskFpuOverflow()
Switch on signalling overflow FPU exceptions.
static std::vector< bool > debugItems
A vector of switches indicating whether a given debug item is switched on or not. ...
Definition: Debug.h:54
Higher debug level.
Definition: Debug.h:31
static void maskFpuInvalid()
Switch off signalling invalid operation FPU exceptions.