Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
CustomPyTypes.h
Go to the documentation of this file.
1#ifndef CPYRT_CUSTOMPYTYPES_H
2#define CPYRT_CUSTOMPYTYPES_H
3
4#include "Python.h"
5#include "cppjit_interop.h"
6
7namespace cppjit::cpyrt {
8
9/** Custom "builtins," detectable by type, for pass by ref and improved
10 performance.
11 */
12
13//- custom type representing typedef to pointer of class ---------------------
17
18extern PyTypeObject TypedefPointerToClass_Type;
19
20template <typename T> inline bool TypedefPointerToClass_Check(T* object) {
21 return object && PyObject_TypeCheck(object, &TypedefPointerToClass_Type);
22}
23
24template <typename T> inline bool TypedefPointerToClass_CheckExact(T* object) {
25 return object && Py_TYPE(object) == &TypedefPointerToClass_Type;
26}
27
28//- custom instance method object type and type verification -----------------
29extern PyTypeObject CustomInstanceMethod_Type;
30
31template <typename T> inline bool CustomInstanceMethod_Check(T* object) {
32 return object && PyObject_TypeCheck(object, &CustomInstanceMethod_Type);
33}
34
35template <typename T> inline bool CustomInstanceMethod_CheckExact(T* object) {
36 return object && Py_TYPE(object) == &CustomInstanceMethod_Type;
37}
38
40 PyObject* pyclass);
41
42//- custom iterator for high performance std::vector iteration ---------------
44 PyObject_HEAD PyObject* ii_container;
45 Py_ssize_t ii_pos;
46 Py_ssize_t ii_len;
47};
48
49extern PyTypeObject IndexIter_Type;
50
51class Converter;
65
66extern PyTypeObject VectorIter_Type;
67
68} // namespace cppjit::cpyrt
69
70#endif // !CPYRT_CUSTOMPYTYPES_H
_object PyObject
bool TypedefPointerToClass_CheckExact(T *object)
PyObject * CustomInstanceMethod_New(PyObject *func, PyObject *self, PyObject *)
bool CustomInstanceMethod_Check(T *object)
PyTypeObject TypedefPointerToClass_Type
bool CustomInstanceMethod_CheckExact(T *object)
PyTypeObject CustomInstanceMethod_Type
bool TypedefPointerToClass_Check(T *object)
PyTypeObject VectorIter_Type
PyTypeObject IndexIter_Type
Cpp::DeclRef TCppScope_t
Definition API.h:41
PyObject_HEAD PyObject * ii_container
Custom "builtins," detectable by type, for pass by ref and improved performance.
PyObject_HEAD interop::TCppScope_t fCppType
interop::TCppScope_t vi_klass