ROOT
6.07/01
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
bindings
pyroot
src
TPyException.cxx
Go to the documentation of this file.
1
// @(#)root/pyroot:$Id$
2
// Author: Scott Snyder, Apr 2004
3
4
// Bindings
5
#include "
PyROOT.h
"
6
#include "
TPyException.h
"
7
8
9
//______________________________________________________________________________
10
// C++ exception for throwing python exceptions
11
// ============================================
12
// Purpose: A C++ exception class for throwing python exceptions
13
// through C++ code.
14
// Created: Apr, 2004, sss, from the version in D0's python_util.
15
//
16
// Note: Don't be tempted to declare the virtual functions defined here
17
// as inline.
18
// If you do, you may not be able to properly throw these
19
// exceptions across shared libraries.
20
21
22
//- data ---------------------------------------------------------------------
23
ClassImp
(
PyROOT::TPyException
)
24
void
* PyROOT::
TPyExceptionMagic
= (
PyObject
*)1;
25
void
* PyROOT::
TPyCPPExceptionMagic
= (PyObject*)2;
26
27
namespace {
28
29
class
TManageMagic {
// ensures that no valid PyObject can occupy the magic
30
public
:
31
TManageMagic() {
32
PyROOT::TPyExceptionMagic
=
new
int(1);
33
PyROOT::TPyCPPExceptionMagic
=
new
int(2);
34
}
35
~TManageMagic() {
36
delete
(
int
*)
PyROOT::TPyExceptionMagic
;
37
delete
(
int
*)
PyROOT::TPyCPPExceptionMagic
;
38
}
39
} manageMagic;
40
41
}
// unnamed namespace
42
43
44
//- constructors/destructor --------------------------------------------------
45
PyROOT::TPyException::TPyException
()
46
{
47
// default constructor
48
}
49
50
PyROOT::TPyException::~TPyException
() throw()
51
{
52
// destructor
53
}
54
55
56
//- public members -----------------------------------------------------------
57
const
char
*
PyROOT::TPyException::what
()
const
throw()
58
{
59
// Return reason for throwing this exception: a python exception was raised.
60
return
"python exception"
;
61
}
PyROOT::TPyException::what
virtual const char * what() const
Definition:
TPyException.cxx:57
PyROOT::TPyException
Definition:
TPyException.h:49
PyROOT::TPyExceptionMagic
R__EXTERN void * TPyExceptionMagic
Definition:
TPyException.h:46
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:279
void
typedef void((*Func_t)())
PyROOT::TPyException::~TPyException
virtual ~TPyException()
Definition:
TPyException.cxx:50
PyROOT::TPyException::TPyException
TPyException()
Definition:
TPyException.cxx:45
PyROOT::TPyCPPExceptionMagic
R__EXTERN void * TPyCPPExceptionMagic
Definition:
TPyException.h:47
PyROOT.h
TPyException.h
PyObject
_object PyObject
Definition:
TPyArg.h:22