ROOT  6.06/09
Reference Guide
TCustomPyTypes.h
Go to the documentation of this file.
1 // Author: Wim Lavrijsen, Dec 2006
2 
3 #ifndef PYROOT_TCUSTOMPYTYPES_H
4 #define PYROOT_TCUSTOMPYTYPES_H
5 
6 // ROOT
7 #include "DllImport.h"
8 
9 
10 namespace PyROOT {
11 
12 /** Custom builtins, detectable by type, for pass by ref
13  @author WLAV
14  @date 12/13/2006
15  @version 1.0
16  */
17 
18 //- custom float object type and type verification ---------------------------
19  R__EXTERN PyTypeObject TCustomFloat_Type;
20 
21  template< typename T >
22  inline Bool_t TCustomFloat_Check( T* object )
23  {
24  return object && PyObject_TypeCheck( object, &TCustomFloat_Type );
25  }
26 
27  template< typename T >
28  inline Bool_t TCustomFloat_CheckExact( T* object )
29  {
30  return object && Py_TYPE(object) == &TCustomFloat_Type;
31  }
32 
33 //- custom long object type and type verification ----------------------------
34  R__EXTERN PyTypeObject TCustomInt_Type;
35 
36  template< typename T >
37  inline Bool_t TCustomInt_Check( T* object )
38  {
39  return object && PyObject_TypeCheck( object, &TCustomInt_Type );
40  }
41 
42  template< typename T >
43  inline Bool_t TCustomInt_CheckExact( T* object )
44  {
45  return object && Py_TYPE(object) == &TCustomInt_Type;
46  }
47 
48 //- custom instance method object type and type verification -----------------
50 
51  template< typename T >
53  {
54  return object && PyObject_TypeCheck( object, &TCustomInstanceMethod_Type );
55  }
56 
57  template< typename T >
59  {
60  return object && Py_TYPE(object) == &TCustomInstanceMethod_Type;
61  }
62 
64 
65 } // namespace PyROOT
66 
67 #endif // !PYROOT_TCUSTOMPYTYPES_H
Bool_t TCustomFloat_Check(T *object)
PyObject * TCustomInstanceMethod_New(PyObject *func, PyObject *self, PyObject *pyclass)
double T(double x)
Definition: ChebyshevPol.h:34
bool Bool_t
Definition: RtypesCore.h:59
Bool_t TCustomInt_Check(T *object)
Bool_t TCustomInstanceMethod_CheckExact(T *object)
PyTypeObject TCustomInt_Type
Bool_t TCustomFloat_CheckExact(T *object)
Bool_t TCustomInstanceMethod_Check(T *object)
PyTypeObject TCustomInstanceMethod_Type
double func(double *x, double *p)
Definition: stressTF1.cxx:213
#define R__EXTERN
Definition: DllImport.h:27
#define Py_TYPE(ob)
Definition: PyROOT.h:149
PyTypeObject TCustomFloat_Type
Custom builtins, detectable by type, for pass by ref.
Bool_t TCustomInt_CheckExact(T *object)
_object PyObject
Definition: TPyArg.h:22