Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
Executors.cxx File Reference
#include "CPyCppyy.h"
#include "DeclareExecutors.h"
#include "CPPInstance.h"
#include "LowLevelViews.h"
#include "ProxyWrappers.h"
#include "PyStrings.h"
#include "TypeManip.h"
#include "Utility.h"
#include <cstring>
#include <map>
#include <new>
#include <sstream>
#include <utility>
#include <sys/types.h>
#include <complex>

Namespaces

namespace  CPyCppyy

Macros

#define CCOMPLEX_D   "_Complex double"
#define CCOMPLEX_F   "_Complex float"
#define CPPYY_COMPLEX_EXEC(code, type)
#define CPPYY_IMPL_ARRAY_EXEC(name, type, suffix)
#define CPPYY_IMPL_GILCALL(rtype, tcode)
#define CPPYY_IMPL_REFEXEC(name, type, stype, F1, F2)
#define WSTRING1   "std::basic_string<wchar_t>"
#define WSTRING2   "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>"

Typedefs

typedef std::map< std::string, ef_tCPyCppyy::ExecFactories_t

Functions

static PyObjectCPyCppyy_PyBool_FromLong (long b)
static PyObjectCPyCppyy_PyText_FromLong (long cl)
static PyObjectCPyCppyy_PyText_FromULong (unsigned long uc)
static unsigned char GILCallB (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static char GILCallC (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static Cppyy::TCppObject_t GILCallConstructor (Cppyy::TCppMethod_t method, Cppyy::TCppType_t klass, CPyCppyy::CallContext *ctxt)
static double GILCallD (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static float GILCallF (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static short GILCallH (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static int GILCallI (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static long GILCallL (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static PY_LONG_DOUBLE GILCallLD (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static PY_LONG_LONG GILCallLL (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static Cppyy::TCppObject_t GILCallO (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt, Cppyy::TCppType_t klass)
static void * GILCallR (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
static void GILCallV (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
template<typename T>
static std::complex< T > PyComplex_AsComplex (PyObject *pycplx)
template<typename T>
static PyObjectPyComplex_FromComplex (const std::complex< T > &c)
static PyObjectSetInstanceCheckError (PyObject *pyobj)

Variables

static ExecFactories_t CPyCppyy::gExecFactories
std::set< std::string > CPyCppyy::gIteratorTypes

Macro Definition Documentation

◆ CCOMPLEX_D

#define CCOMPLEX_D   "_Complex double"

Definition at line 956 of file Executors.cxx.

◆ CCOMPLEX_F

#define CCOMPLEX_F   "_Complex float"

Definition at line 957 of file Executors.cxx.

◆ CPPYY_COMPLEX_EXEC

#define CPPYY_COMPLEX_EXEC ( code,
type )
Value:
PyObject* CPyCppyy::Complex##code##Executor::Execute( \
{ \
static Cppyy::TCppScope_t scopeid = Cppyy::GetScope("std::complex<"#type">");\
std::complex<type>* result = \
(std::complex<type>*)GILCallO(method, self, ctxt, scopeid); \
if (!result) { \
PyErr_SetString(PyExc_ValueError, "NULL result where temporary expected");\
return nullptr; \
} \
\
PyObject* pyres = PyComplex_FromDoubles(result->real(), result->imag()); \
::operator delete(result); /* Cppyy::CallO calls ::operator new */ \
return pyres; \
}
static Cppyy::TCppObject_t GILCallO(Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt, Cppyy::TCppType_t klass)
Definition Executors.cxx:80
_object PyObject
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, CallContext *)=0
intptr_t TCppMethod_t
Definition cpp_cppyy.h:38
void * TCppObject_t
Definition cpp_cppyy.h:37
RPY_EXPORTED TCppScope_t GetScope(const std::string &scope_name)
size_t TCppScope_t
Definition cpp_cppyy.h:34

Definition at line 534 of file Executors.cxx.

◆ CPPYY_IMPL_ARRAY_EXEC

#define CPPYY_IMPL_ARRAY_EXEC ( name,
type,
suffix )
Value:
PyObject* CPyCppyy::name##ArrayExecutor::Execute( \
{ \
return CreateLowLevelView##suffix((type*)GILCallR(method, self, ctxt), fShape); \
}
static void * GILCallR(Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
Definition Executors.cxx:78
PyObject * CreateLowLevelView(bool *, cdims_t shape)

Definition at line 503 of file Executors.cxx.

◆ CPPYY_IMPL_GILCALL

#define CPPYY_IMPL_GILCALL ( rtype,
tcode )
Value:
static inline rtype GILCall##tcode( \
{ \
return Cppyy::Call##tcode(method, self, ctxt->GetEncodedSize(), ctxt->GetArgs());\
}

Definition at line 60 of file Executors.cxx.

◆ CPPYY_IMPL_REFEXEC

#define CPPYY_IMPL_REFEXEC ( name,
type,
stype,
F1,
F2 )
Value:
PyObject* CPyCppyy::name##RefExecutor::Execute( \
{ \
type* ref = (type*)GILCallR(method, self, ctxt); \
if (!ref) { /* can happen if wrapper compilation fails */ \
PyErr_SetString(PyExc_ReferenceError, "attempt to access a null-pointer");\
return nullptr; \
} \
if (!fAssignable) \
return F1((stype)*ref); \
else { \
*ref = (type)F2(fAssignable); \
Py_DECREF(fAssignable); \
fAssignable = nullptr; \
if (*ref == (type)-1 && PyErr_Occurred()) \
return nullptr; \
Py_INCREF(Py_None); \
return Py_None; \
} \
}
#define F1(x, y, z)
Definition TMD5.cxx:266
#define F2(x, y, z)
Definition TMD5.cxx:267

Definition at line 333 of file Executors.cxx.

◆ WSTRING1

#define WSTRING1   "std::basic_string<wchar_t>"

Definition at line 951 of file Executors.cxx.

◆ WSTRING2

#define WSTRING2   "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>"

Definition at line 952 of file Executors.cxx.

Function Documentation

◆ CPyCppyy_PyBool_FromLong()

PyObject * CPyCppyy_PyBool_FromLong ( long b)
inlinestatic

Definition at line 129 of file Executors.cxx.

◆ CPyCppyy_PyText_FromLong()

PyObject * CPyCppyy_PyText_FromLong ( long cl)
inlinestatic

Definition at line 106 of file Executors.cxx.

◆ CPyCppyy_PyText_FromULong()

PyObject * CPyCppyy_PyText_FromULong ( unsigned long uc)
inlinestatic

Definition at line 118 of file Executors.cxx.

◆ GILCallB()

unsigned char GILCallB ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 69 of file Executors.cxx.

◆ GILCallC()

char GILCallC ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 70 of file Executors.cxx.

◆ GILCallConstructor()

Cppyy::TCppObject_t GILCallConstructor ( Cppyy::TCppMethod_t method,
Cppyy::TCppType_t klass,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 93 of file Executors.cxx.

◆ GILCallD()

double GILCallD ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 76 of file Executors.cxx.

◆ GILCallF()

float GILCallF ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 75 of file Executors.cxx.

◆ GILCallH()

short GILCallH ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 71 of file Executors.cxx.

◆ GILCallI()

int GILCallI ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 72 of file Executors.cxx.

◆ GILCallL()

long GILCallL ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 73 of file Executors.cxx.

◆ GILCallLD()

PY_LONG_DOUBLE GILCallLD ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 77 of file Executors.cxx.

◆ GILCallLL()

PY_LONG_LONG GILCallLL ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 74 of file Executors.cxx.

◆ GILCallO()

Definition at line 80 of file Executors.cxx.

◆ GILCallR()

void * GILCallR ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 78 of file Executors.cxx.

◆ GILCallV()

void GILCallV ( Cppyy::TCppMethod_t method,
Cppyy::TCppObject_t self,
CPyCppyy::CallContext * ctxt )
inlinestatic

Definition at line 68 of file Executors.cxx.

◆ PyComplex_AsComplex()

template<typename T>
std::complex< T > PyComplex_AsComplex ( PyObject * pycplx)
inlinestatic

Definition at line 378 of file Executors.cxx.

◆ PyComplex_FromComplex()

template<typename T>
PyObject * PyComplex_FromComplex ( const std::complex< T > & c)
inlinestatic

Definition at line 373 of file Executors.cxx.

◆ SetInstanceCheckError()

PyObject * SetInstanceCheckError ( PyObject * pyobj)
inlinestatic

Definition at line 681 of file Executors.cxx.