Logo ROOT  
Reference Guide
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 dependency graph for Executors.cxx:

Namespaces

namespace  CPyCppyy
 

Macros

#define CPPYY_COMPLEX_EXEC(code, type)
 
#define CPPYY_IMPL_ARRAY_EXEC(name, type)
 
#define CPPYY_IMPL_GILCALL(rtype, tcode)
 
#define CPPYY_IMPL_REFEXEC(name, type, stype, F1, F2)
 
#define WSTRING   "basic_string<wchar_t,char_traits<wchar_t>,allocator<wchar_t> >"
 

Typedefs

typedef Executor *(* CPyCppyy::ef_t) ()
 
typedef std::map< std::string, ef_t > CPyCppyy::ExecFactories_t
 

Functions

 CPPYY_IMPL_REFEXEC (ComplexD, std::complex< double >, std::complex< double >, PyComplex_FromComplex< double >, PyComplex_AsComplex< double >) PyObject *CPyCppyy
 
static PyObjectCPyCppyy_PyBool_FromLong (long b)
 
static PyObjectCPyCppyy_PyText_FromLong (long cl)
 
static PyObjectCPyCppyy_PyText_FromULong (unsigned long uc)
 
static Cppyy::TCppObject_t GILCallConstructor (Cppyy::TCppMethod_t method, Cppyy::TCppType_t klass, CPyCppyy::CallContext *ctxt)
 
static Cppyy::TCppObject_t GILCallO (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt, Cppyy::TCppType_t klass)
 
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

◆ 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
Definition: PyMethodBase.h:41
int type
Definition: TGX11.cxx:120
intptr_t TCppMethod_t
Definition: cpp_cppyy.h:22
void * TCppObject_t
Definition: cpp_cppyy.h:21
size_t TCppScope_t
Definition: cpp_cppyy.h:18
RPY_EXPORTED TCppScope_t GetScope(const std::string &scope_name)

Definition at line 516 of file Executors.cxx.

◆ CPPYY_IMPL_ARRAY_EXEC

#define CPPYY_IMPL_ARRAY_EXEC (   name,
  type 
)
Value:
PyObject* CPyCppyy::name##ArrayExecutor::Execute( \
{ \
return CreateLowLevelView((type*)GILCallR(method, self, ctxt)); \
}
char name[80]
Definition: TGX11.cxx:109
PyObject * CreateLowLevelView(const char **, Py_ssize_t *shape=nullptr)

Definition at line 487 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->GetSize(), 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:267
#define F2(x, y, z)
Definition: TMD5.cxx:268

Definition at line 333 of file Executors.cxx.

◆ WSTRING

#define WSTRING   "basic_string<wchar_t,char_traits<wchar_t>,allocator<wchar_t> >"

Definition at line 882 of file Executors.cxx.

Function Documentation

◆ CPPYY_IMPL_REFEXEC()

CPPYY_IMPL_REFEXEC ( ComplexD  ,
std::complex< double ,
std::complex< double ,
PyComplex_FromComplex< double ,
PyComplex_AsComplex< double  
)

Definition at line 383 of file Executors.cxx.

◆ CPyCppyy_PyBool_FromLong()

static PyObject * CPyCppyy_PyBool_FromLong ( long  b)
inlinestatic

Definition at line 129 of file Executors.cxx.

◆ CPyCppyy_PyText_FromLong()

static PyObject * CPyCppyy_PyText_FromLong ( long  cl)
inlinestatic

Definition at line 106 of file Executors.cxx.

◆ CPyCppyy_PyText_FromULong()

static PyObject * CPyCppyy_PyText_FromULong ( unsigned long  uc)
inlinestatic

Definition at line 118 of file Executors.cxx.

◆ GILCallConstructor()

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

Definition at line 93 of file Executors.cxx.

◆ GILCallO()

static Cppyy::TCppObject_t GILCallO ( Cppyy::TCppMethod_t  method,
Cppyy::TCppObject_t  self,
CPyCppyy::CallContext ctxt,
Cppyy::TCppType_t  klass 
)
inlinestatic

Definition at line 80 of file Executors.cxx.

◆ PyComplex_AsComplex()

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

Definition at line 378 of file Executors.cxx.

◆ PyComplex_FromComplex()

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

Definition at line 373 of file Executors.cxx.

◆ SetInstanceCheckError()

static PyObject * SetInstanceCheckError ( PyObject pyobj)
inlinestatic

Definition at line 663 of file Executors.cxx.