ROOT logo
// @(#)root/pyroot:$Name:  $:$Id: TPyException.h 21958 2008-02-02 10:39:18Z rdm $
// Author: Scott Snyder, Apr 2004

#ifndef ROOT_TPyException
#define ROOT_TPyException

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// TPyException                                                             //
//                                                                          //
// Purpose: A C++ exception class for throwing python exceptions            //
//          through C++ code.                                               //
// Created: Apr, 2004, sss, from the version in D0's python_util.           //
//                                                                          //
// The situation is:                                                        //
//   - We're calling ROOT C++ code from python.                             //
//   - The C++ code can call back to python.                                //
//   - What to do then if the python callback throws an exception?          //
//                                                                          //
// We need to get the control flow back to where PyROOT makes the ROOT call.//
// To do that we throw a TPyException.                                      //
// We can then catch this exception when we do the ROOT call.               //
//                                                                          //
// Note that we don't need to save any state in the exception -- it's       //
// already in the python error info variables.                              //
// (??? Actually, if the program is multithreaded, this is dangerous        //
// if the code has released and reacquired the lock along the call chain.   //
// Punt on this for now, though.)                                           //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

// ROOT
#ifndef ROOT_DllImport
#include "DllImport.h"
#endif
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif

// Standard
#include <exception>


namespace PyROOT {

R__EXTERN void* TPyExceptionMagic;

class TPyException : public std::exception {
public:
// default constructor
   TPyException();

// destructor
   virtual ~TPyException() throw();

// give reason for raised exception
   virtual const char* what() const throw();

   ClassDef(TPyException,0)   //C++ exception for throwing python exceptions
};

} // namespace PyROOT

#if defined(G__DICTIONARY) && defined(R__SOLARIS)
// Force the inclusion of rw/math.h
#include <limits>
// Work around interaction between a struct named exception in math.h,
// std::exception and the use of using namespace std;
#define exception std::exception
#endif
#endif
 TPyException.h:1
 TPyException.h:2
 TPyException.h:3
 TPyException.h:4
 TPyException.h:5
 TPyException.h:6
 TPyException.h:7
 TPyException.h:8
 TPyException.h:9
 TPyException.h:10
 TPyException.h:11
 TPyException.h:12
 TPyException.h:13
 TPyException.h:14
 TPyException.h:15
 TPyException.h:16
 TPyException.h:17
 TPyException.h:18
 TPyException.h:19
 TPyException.h:20
 TPyException.h:21
 TPyException.h:22
 TPyException.h:23
 TPyException.h:24
 TPyException.h:25
 TPyException.h:26
 TPyException.h:27
 TPyException.h:28
 TPyException.h:29
 TPyException.h:30
 TPyException.h:31
 TPyException.h:32
 TPyException.h:33
 TPyException.h:34
 TPyException.h:35
 TPyException.h:36
 TPyException.h:37
 TPyException.h:38
 TPyException.h:39
 TPyException.h:40
 TPyException.h:41
 TPyException.h:42
 TPyException.h:43
 TPyException.h:44
 TPyException.h:45
 TPyException.h:46
 TPyException.h:47
 TPyException.h:48
 TPyException.h:49
 TPyException.h:50
 TPyException.h:51
 TPyException.h:52
 TPyException.h:53
 TPyException.h:54
 TPyException.h:55
 TPyException.h:56
 TPyException.h:57
 TPyException.h:58
 TPyException.h:59
 TPyException.h:60
 TPyException.h:61
 TPyException.h:62
 TPyException.h:63
 TPyException.h:64
 TPyException.h:65
 TPyException.h:66
 TPyException.h:67
 TPyException.h:68
 TPyException.h:69
 TPyException.h:70
 TPyException.h:71