ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TPyException.h
Go to the documentation of this file.
1 // @(#)root/pyroot:$Name: $:$Id$
2 // Author: Scott Snyder, Apr 2004
3 
4 #ifndef ROOT_TPyException
5 #define ROOT_TPyException
6 
7 //////////////////////////////////////////////////////////////////////////////
8 // //
9 // TPyException //
10 // //
11 // Purpose: A C++ exception class for throwing python exceptions //
12 // through C++ code. //
13 // Created: Apr, 2004, sss, from the version in D0's python_util. //
14 // //
15 // The situation is: //
16 // - We're calling ROOT C++ code from python. //
17 // - The C++ code can call back to python. //
18 // - What to do then if the python callback throws an exception? //
19 // //
20 // We need to get the control flow back to where PyROOT makes the ROOT call.//
21 // To do that we throw a TPyException. //
22 // We can then catch this exception when we do the ROOT call. //
23 // //
24 // Note that we don't need to save any state in the exception -- it's //
25 // already in the python error info variables. //
26 // (??? Actually, if the program is multithreaded, this is dangerous //
27 // if the code has released and reacquired the lock along the call chain. //
28 // Punt on this for now, though.) //
29 // //
30 //////////////////////////////////////////////////////////////////////////////
31 
32 // ROOT
33 #ifndef ROOT_DllImport
34 #include "DllImport.h"
35 #endif
36 #ifndef ROOT_Rtypes
37 #include "Rtypes.h"
38 #endif
39 
40 // Standard
41 #include <exception>
42 
43 
44 namespace PyROOT {
45 
48 
49 class TPyException : public std::exception {
50 public:
51 // default constructor
52  TPyException();
53 
54 // destructor
55  virtual ~TPyException() throw();
56 
57 // give reason for raised exception
58  virtual const char* what() const throw();
59 
60  ClassDef(TPyException,0) //C++ exception for throwing python exceptions
61 };
62 
63 } // namespace PyROOT
64 
65 #if defined(G__DICTIONARY) && defined(R__SOLARIS)
66 // Force the inclusion of rw/math.h
67 #include <limits>
68 // Work around interaction between a struct named exception in math.h,
69 // std::exception and the use of using namespace std;
70 #if (__SUNPRO_CC < 0x5050)
71 #define exception std::exception
72 #endif
73 #endif
74 #endif
virtual const char * what() const
R__EXTERN void * TPyExceptionMagic
Definition: TPyException.h:46
#define ClassDef(name, id)
Definition: Rtypes.h:254
#define R__EXTERN
Definition: DllImport.h:27
R__EXTERN void * TPyCPPExceptionMagic
Definition: TPyException.h:47