Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
CPPMethod.h
Go to the documentation of this file.
1#ifndef CPYCPPYY_CPPMETHOD_H
2#define CPYCPPYY_CPPMETHOD_H
3
4// Bindings
5#include "PyCallable.h"
6
7// Standard
8#include <map>
9#include <string>
10#include <vector>
11
12
13namespace CPyCppyy {
14
15class Executor;
16class Converter;
17
18class CPPMethod : public PyCallable {
19public:
21 CPPMethod(const CPPMethod&);
23 virtual ~CPPMethod();
24
25public:
26 virtual PyObject* GetSignature(bool show_formalargs = true);
27 virtual PyObject* GetPrototype(bool show_formalargs = true);
28 virtual int GetPriority();
29 virtual bool IsGreedy();
30
31 virtual int GetMaxArgs();
32 virtual PyObject* GetCoVarNames();
33 virtual PyObject* GetArgDefault(int iarg);
34 virtual PyObject* GetScopeProxy();
36
37 virtual PyCallable* Clone() { return new CPPMethod(*this); }
38
39public:
40 virtual PyObject* Call(
41 CPPInstance*& self, PyObject* args, PyObject* kwds, CallContext* ctxt = nullptr);
42
43protected:
44 virtual PyObject* PreProcessArgs(CPPInstance*& self, PyObject* args, PyObject* kwds);
45
46 bool Initialize(CallContext* ctxt = nullptr);
48 bool ConvertAndSetArgs(PyObject* args, CallContext* ctxt = nullptr);
49 PyObject* Execute(void* self, ptrdiff_t offset, CallContext* ctxt = nullptr);
50
52// TODO: the following is a special case to allow shimming of the
53// constructor; there's probably a better way ...
57 std::string GetSignatureString(bool show_formalargs = true);
58 std::string GetReturnTypeName();
59
60 virtual bool InitExecutor_(Executor*&, CallContext* ctxt = nullptr);
61
62private:
63 void Copy_(const CPPMethod&);
64 void Destroy_();
65
66 PyObject* ExecuteFast(void*, ptrdiff_t, CallContext*);
67 PyObject* ExecuteProtected(void*, ptrdiff_t, CallContext*);
68
69 bool InitConverters_();
70
71 void SetPyError_(PyObject* msg);
72
73private:
74// representation
78
79// call dispatch buffers
80 std::vector<Converter*> fConverters;
81 std::map<std::string, int>* fArgIndices;
82
83protected:
84// cached value that doubles as initialized flag (uninitialized if -1)
86};
87
88} // namespace CPyCppyy
89
90#endif // !CPYCPPYY_CPPMETHOD_H
_object PyObject
std::string GetReturnTypeName()
bool Initialize(CallContext *ctxt=nullptr)
void SetPyError_(PyObject *msg)
virtual PyObject * GetSignature(bool show_formalargs=true)
Cppyy::TCppScope_t fScope
Definition CPPMethod.h:76
virtual bool InitExecutor_(Executor *&, CallContext *ctxt=nullptr)
virtual PyObject * GetArgDefault(int iarg)
virtual PyObject * GetPrototype(bool show_formalargs=true)
std::string GetSignatureString(bool show_formalargs=true)
PyObject * ExecuteProtected(void *, ptrdiff_t, CallContext *)
std::map< std::string, int > * fArgIndices
Definition CPPMethod.h:81
virtual PyObject * GetCoVarNames()
std::vector< Converter * > fConverters
Definition CPPMethod.h:80
virtual PyObject * GetScopeProxy()
PyObject * ExecuteFast(void *, ptrdiff_t, CallContext *)
Definition CPPMethod.cxx:66
PyObject * Execute(void *self, ptrdiff_t offset, CallContext *ctxt=nullptr)
void Copy_(const CPPMethod &)
Definition CPPMethod.cxx:37
virtual int GetPriority()
PyObject * ProcessKeywords(PyObject *self, PyObject *args, PyObject *kwds)
Executor * fExecutor
Definition CPPMethod.h:77
Cppyy::TCppMethod_t fMethod
Definition CPPMethod.h:75
Cppyy::TCppScope_t GetScope()
Definition CPPMethod.h:55
virtual PyObject * Call(CPPInstance *&self, PyObject *args, PyObject *kwds, CallContext *ctxt=nullptr)
virtual PyCallable * Clone()
Definition CPPMethod.h:37
void SetMethod(Cppyy::TCppMethod_t m)
Definition CPPMethod.h:54
virtual bool IsGreedy()
bool ConvertAndSetArgs(PyObject *args, CallContext *ctxt=nullptr)
CPPMethod & operator=(const CPPMethod &)
virtual PyObject * PreProcessArgs(CPPInstance *&self, PyObject *args, PyObject *kwds)
virtual int GetMaxArgs()
Cppyy::TCppMethod_t GetMethod()
Definition CPPMethod.h:51
Executor * GetExecutor()
Definition CPPMethod.h:56
virtual Cppyy::TCppFuncAddr_t GetFunctionAddress()
Set of helper functions that are invoked from the pythonizors, on the Python side.
intptr_t TCppMethod_t
Definition cpp_cppyy.h:22
size_t TCppScope_t
Definition cpp_cppyy.h:18
void * TCppFuncAddr_t
Definition cpp_cppyy.h:25
auto * m
Definition textangle.C:8