Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
GenVector_exception.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Authors: W. Brown, M. Fischler, L. Moneta 2005
3
4#ifndef ROOT_MathX_GenVectorX_GenVector_exception
5#define ROOT_MathX_GenVectorX_GenVector_exception 1
6
7// ======================================================================
8// $Id $
9//
10// Define the exception type used throughout this package.
11// ======================================================================
12
13// ----------------------------------------------------------------------
14// Prolog
15
16#include <stdexcept>
17#include <string>
18
20
21#if !defined(ROOT_MATH_SYCL) && !defined(ROOT_MATH_CUDA)
22
23namespace ROOT {
24namespace ROOT_MATH_ARCH {
25
26class GenVector_exception;
27inline void Throw(GenVector_exception &e);
28inline void GenVector_Throw(const char *);
29// ----------------------------------------------------------------------
30// GenVector_exception class definition
31//
32// This class needs to be entirely contained in this header, otherwise
33// the interactive usage of entities such as ROOT::Math::PtEtaPhiMVector
34// is not possible because of missing symbols.
35// This is due to the fact that the Throw function is used in the inline
36// code bu this function is implemented in the Genvector library.
37class GenVector_exception : public std::runtime_error {
38public:
39 GenVector_exception(const std::string &s) : runtime_error(s) {}
40
41 // Compiler-generated copy ctor, copy assignment, dtor are fine
42 // Inherited what() from runtime_error is fine
43
44 static bool EnableThrow()
45 {
46 bool tmp = GenVector_exception::IsOn();
47 IsOn() = true;
48 return tmp;
49 }
50 static bool DisableThrow()
51 {
52 bool tmp = GenVector_exception::IsOn();
53 IsOn() = false;
54 return tmp;
55 }
56
57private:
58 friend void Throw(GenVector_exception &);
59 friend void GenVector_Throw(const char *);
60
61 static bool &IsOn()
62 {
63 static bool isOn = false;
64 return isOn;
65 };
66
67}; // GenVector_exception
68
69// ----------------------------------------------------------------------
70// Epilog
71
72/// throw explicitly GenVector exceptions
74{
76 throw e;
77}
78
79/// function throwing exception, by creating internally a GenVector_exception only when needed
80inline void GenVector_Throw(const char *s)
81{
83 return;
85 throw e;
86}
87
88} // namespace ROOT_MATH_ARCH
89} // namespace ROOT
90
91#endif
92
93#endif // GENVECTOR_EXCEPTION_H
#define e(i)
Definition RSha256.hxx:103
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
friend void Throw(GenVector_exception &)
throw explicitly GenVector exceptions
friend void GenVector_Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed
void GenVector_Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed
void Throw(GenVector_exception &e)
throw explicitly GenVector exceptions