Logo ROOT   6.12/07
Reference Guide
PyRootType.h
Go to the documentation of this file.
1 // @(#)root/pyroot:$Id$
2 // Author: Wim Lavrijsen, Jan 2005
3 
4 #ifndef PYROOT_PYROOTTYPE_H
5 #define PYROOT_PYROOTTYPE_H
6 
7 // ROOT
8 #include "DllImport.h"
9 
10 #if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 2
11 
12 // In p2.2, PyHeapTypeObject is not yet part of the interface
13 #include "structmember.h"
14 
15 typedef struct {
16  PyTypeObject type;
17  PyNumberMethods as_number;
18  PySequenceMethods as_sequence;
19  PyMappingMethods as_mapping;
20  PyBufferProcs as_buffer;
21  PyObject *name, *slots;
22  PyMemberDef members[1];
23 } PyHeapTypeObject;
24 
25 #endif
26 
27 
28 namespace PyROOT {
29 
30 /** Type object to hold TClassRef instance (this is only semantically a presentation
31  of PyRootType instances, not in a C++ sense)
32  @author WLAV
33  @date 03/28/2008
34  @version 1.0
35  */
36 
37  class PyRootClass {
38  public:
39  PyHeapTypeObject fType; // placeholder, in a single block with the TClassRef
41 
42  private:
44  };
45 
46 //- metatype type and type verification --------------------------------------
47  R__EXTERN PyTypeObject PyRootType_Type;
48 
49  template< typename T >
50  inline Bool_t PyRootType_Check( T* object )
51  {
52  return object && PyObject_TypeCheck( object, &PyRootType_Type );
53  }
54 
55  template< typename T >
56  inline Bool_t PyRootType_CheckExact( T* object )
57  {
58  return object && Py_TYPE(object) == &PyRootType_Type;
59  }
60 
61 } // namespace PyROOT
62 
63 #endif // !PYROOT_PYROOTTYPE_H
TCppScope_t TCppType_t
Definition: Cppyy.h:13
double T(double x)
Definition: ChebyshevPol.h:34
Bool_t PyRootType_CheckExact(T *object)
Definition: PyRootType.h:56
Bool_t PyRootType_Check(T *object)
Definition: PyRootType.h:50
bool Bool_t
Definition: RtypesCore.h:59
PyHeapTypeObject fType
Definition: PyRootType.h:39
PyTypeObject PyRootType_Type
Definition: PyRootType.cxx:191
Type object to hold TClassRef instance (this is only semantically a presentation of PyRootType instan...
Definition: PyRootType.h:37
int type
Definition: TGX11.cxx:120
Cppyy::TCppType_t fCppType
Definition: PyRootType.h:40
#define R__EXTERN
Definition: DllImport.h:27
#define Py_TYPE(ob)
Definition: PyROOT.h:151
char name[80]
Definition: TGX11.cxx:109
_object PyObject
Definition: TPyArg.h:20