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 dependency graph for Executors.cxx:

Namespaces

namespace  CPyCppyy
 Set of helper functions that are invoked from the pythonizors, on the Python side.
 

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_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_t GILCallI (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
 
static Long_t GILCallL (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
 
static LongDouble_t GILCallLD (Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
 
static Long64_t 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

◆ 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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, CallContext *)=0
intptr_t TCppMethod_t
Definition cpp_cppyy.h:22
void * TCppObject_t
Definition cpp_cppyy.h:21
RPY_EXPORTED TCppScope_t GetScope(const std::string &scope_name)
size_t TCppScope_t
Definition cpp_cppyy.h:18

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)); \
}
static void * GILCallR(Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, CPyCppyy::CallContext *ctxt)
Definition Executors.cxx:78
PyObject * CreateLowLevelView(bool *, 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 906 of file Executors.cxx.

Function Documentation

◆ 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.

◆ GILCallB()

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

Definition at line 69 of file Executors.cxx.

◆ GILCallC()

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

Definition at line 70 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.

◆ GILCallD()

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

Definition at line 76 of file Executors.cxx.

◆ GILCallF()

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

Definition at line 75 of file Executors.cxx.

◆ GILCallH()

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

Definition at line 71 of file Executors.cxx.

◆ GILCallI()

static Int_t GILCallI ( Cppyy::TCppMethod_t  method,
Cppyy::TCppObject_t  self,
CPyCppyy::CallContext ctxt 
)
inlinestatic

Definition at line 72 of file Executors.cxx.

◆ GILCallL()

static Long_t GILCallL ( Cppyy::TCppMethod_t  method,
Cppyy::TCppObject_t  self,
CPyCppyy::CallContext ctxt 
)
inlinestatic

Definition at line 73 of file Executors.cxx.

◆ GILCallLD()

static LongDouble_t GILCallLD ( Cppyy::TCppMethod_t  method,
Cppyy::TCppObject_t  self,
CPyCppyy::CallContext ctxt 
)
inlinestatic

Definition at line 77 of file Executors.cxx.

◆ GILCallLL()

static Long64_t GILCallLL ( Cppyy::TCppMethod_t  method,
Cppyy::TCppObject_t  self,
CPyCppyy::CallContext ctxt 
)
inlinestatic

Definition at line 74 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.

◆ GILCallR()

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

Definition at line 78 of file Executors.cxx.

◆ GILCallV()

static 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 >
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.