Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 -----------------
49  R__EXTERN PyTypeObject TCustomInstanceMethod_Type;
50 
51  template< typename T >
52  inline Bool_t TCustomInstanceMethod_Check( T* object )
53  {
54  return object && PyObject_TypeCheck( object, &TCustomInstanceMethod_Type );
55  }
56 
57  template< typename T >
58  inline Bool_t TCustomInstanceMethod_CheckExact( T* object )
59  {
60  return object && Py_TYPE(object) == &TCustomInstanceMethod_Type;
61  }
62 
63  PyObject* TCustomInstanceMethod_New( PyObject* func, PyObject* self, PyObject* pyclass );
64 
65 } // namespace PyROOT
66 
67 #endif // !PYROOT_TCUSTOMPYTYPES_H