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);
30 virtual int GetPriority();
31 virtual bool IsGreedy();
32
33 virtual int GetMaxArgs();
34 virtual PyObject* GetCoVarNames();
35 virtual PyObject* GetArgDefault(int iarg);
36 virtual bool IsConst();
37
38 virtual PyObject* GetScopeProxy();
40
41 virtual PyCallable* Clone() { return new CPPMethod(*this); }
42
43 virtual int GetArgMatchScore(PyObject* args_tuple);
44
45public:
46 virtual PyObject* Call(
47 CPPInstance*& self, PyObject* args, PyObject* kwds, CallContext* ctxt = nullptr);
48
49protected:
50 virtual PyObject* PreProcessArgs(CPPInstance*& self, PyObject* args, PyObject* kwds);
51
52 bool Initialize(CallContext* ctxt = nullptr);
54 bool ConvertAndSetArgs(PyObject* args, CallContext* ctxt = nullptr);
55 PyObject* Execute(void* self, ptrdiff_t offset, CallContext* ctxt = nullptr);
56
58// TODO: the following is a special case to allow shimming of the
59// constructor; there's probably a better way ...
63 std::string GetSignatureString(bool show_formalargs = true);
64 std::string GetReturnTypeName();
65
66 virtual bool InitExecutor_(Executor*&, CallContext* ctxt = nullptr);
67
68private:
69 void Copy_(const CPPMethod&);
70 void Destroy_();
71
72 PyObject* ExecuteFast(void*, ptrdiff_t, CallContext*);
73 PyObject* ExecuteProtected(void*, ptrdiff_t, CallContext*);
74
75 bool InitConverters_();
76
77 void SetPyError_(PyObject* msg);
78
79private:
80// representation
84
85// call dispatch buffers
86 std::vector<Converter*> fConverters;
87 std::map<std::string, int>* fArgIndices;
88
89protected:
90// cached value that doubles as initialized flag (uninitialized if -1)
92};
93
94} // namespace CPyCppyy
95
96#endif // !CPYCPPYY_CPPMETHOD_H
_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 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 offset
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:82
virtual PyObject * Reflex(Cppyy::Reflex::RequestId_t request, Cppyy::Reflex::FormatId_t=Cppyy::Reflex::OPTIMAL)
virtual int GetArgMatchScore(PyObject *args_tuple)
virtual bool InitExecutor_(Executor *&, CallContext *ctxt=nullptr)
virtual PyObject * GetArgDefault(int iarg)
virtual bool IsConst()
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:87
virtual PyObject * GetCoVarNames()
std::vector< Converter * > fConverters
Definition CPPMethod.h:86
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:83
Cppyy::TCppMethod_t fMethod
Definition CPPMethod.h:81
Cppyy::TCppScope_t GetScope()
Definition CPPMethod.h:61
virtual PyObject * Call(CPPInstance *&self, PyObject *args, PyObject *kwds, CallContext *ctxt=nullptr)
virtual PyCallable * Clone()
Definition CPPMethod.h:41
void SetMethod(Cppyy::TCppMethod_t m)
Definition CPPMethod.h:60
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:57
Executor * GetExecutor()
Definition CPPMethod.h:62
virtual Cppyy::TCppFuncAddr_t GetFunctionAddress()
Set of helper functions that are invoked from the pythonizors, on the Python side.
const FormatId_t OPTIMAL
Definition Reflex.h:21
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
TMarker m
Definition textangle.C:8