ROOT  6.06/09
Reference Guide
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_Math_GenVector_GenVector_exception
5 #define ROOT_Math_GenVector_GenVector_exception 1
6 
7 // ======================================================================
8 // $Id $
9 //
10 // Define the exception type used throughout this package.
11 // ======================================================================
12 
13 
14 // ----------------------------------------------------------------------
15 // Prolog
16 
17 #include <stdexcept>
18 #include <string>
19 
20 
21 namespace ROOT {
22 namespace Math {
23 
24 class GenVector_exception;
25 void Throw(GenVector_exception & e);
26 namespace GenVector {
27  void Throw(const char *);
28 }
29 
30 // ----------------------------------------------------------------------
31 // GenVector_exception class definition
32 
34  : public std::runtime_error
35 {
36 public:
37  GenVector_exception( const std::string & s )
38  : runtime_error(s)
39  { }
40 
41 // Compiler-generated copy ctor, copy assignment, dtor are fine
42 // Inherited what() from runtime_error is fine
43 
44  static bool EnableThrow() { bool tmp = fgOn; fgOn = true; return tmp; }
45  static bool DisableThrow() { bool tmp = fgOn; fgOn = false; return tmp; }
46 
47 
48 private:
49  friend void Throw(GenVector_exception &);
50  friend void GenVector::Throw(const char *);
51 
52  static bool fgOn;
53 
54 }; // GenVector_exception
55 
56 
57 // ----------------------------------------------------------------------
58 // Epilog
59 
60 /// throw explicity GenVector exceptions
61 void Throw(GenVector_exception & e);
62 
63 namespace GenVector {
64  /// function throwing exception, by creating internally a GenVector_exception only when needed
65  void Throw(const char *);
66 }
67 
68 
69 } // namespace Math
70 } // namespace ROOT
71 
72 #endif // GENVECTOR_EXCEPTION_H
GenVector_exception(const std::string &s)
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
void Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed ...
void Throw(GenVector_exception &e)
throw explicity GenVector exceptions
Namespace for new Math classes and functions.
friend void Throw(GenVector_exception &)
throw explicity GenVector exceptions