Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
CPPFunction.h
Go to the documentation of this file.
1#ifndef CPYRT_CPPFUNCTION_H
2#define CPYRT_CPPFUNCTION_H
3
4// Bindings
5#include "CPPMethod.h"
6
7namespace cppjit::cpyrt {
8
9// Wrapper for global free/static C++ functions
10class CPPFunction : public CPPMethod {
11public:
13
14public:
15 PyObject* GetTypeName() override;
16
17public:
18 PyCallable* Clone() override { return new CPPFunction(*this); }
19 PyObject* Call(CPPInstance*& self, cpyrt_PyArgs_t args, size_t nargsf,
20 PyObject* kwds, CallContext* ctxt = nullptr) override;
21
22protected:
23 bool ProcessArgs(PyCallArgs& args) override;
24};
25
26// Wrapper for global binary operators that swap arguments
28public:
29 using CPPFunction::CPPFunction;
30
31 PyCallable* Clone() override { return new CPPFunction(*this); }
32 PyObject* Call(CPPInstance*& self, cpyrt_PyArgs_t args, size_t nargsf,
33 PyObject* kwds, CallContext* ctxt = nullptr) override;
34
35protected:
36 bool ProcessArgs(PyCallArgs& args) override;
37};
38
39// Helper to add self to the arguments tuple if rebound
40bool AdjustSelf(PyCallArgs& cargs);
41
42} // namespace cppjit::cpyrt
43
44#endif // !CPYRT_CPPFUNCTION_H
_object PyObject
bool ProcessArgs(PyCallArgs &args) override
PyObject * Call(CPPInstance *&self, cpyrt_PyArgs_t args, size_t nargsf, PyObject *kwds, CallContext *ctxt=nullptr) override
PyObject * GetTypeName() override
PyCallable * Clone() override
Definition CPPFunction.h:18
CPPMethod(interop::TCppScope_t scope, interop::TCppMethod_t method)
PyObject * Call(CPPInstance *&self, cpyrt_PyArgs_t args, size_t nargsf, PyObject *kwds, CallContext *ctxt=nullptr) override
PyCallable * Clone() override
Definition CPPFunction.h:31
bool ProcessArgs(PyCallArgs &args) override
PyObject *const * cpyrt_PyArgs_t
Definition cpyrt.h:81
bool AdjustSelf(PyCallArgs &cargs)