Debian Codegraph @

native/common/include/jp_proxy.h

raw symbols SCIP
1 /*****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 *****************************************************************************/
16 #ifndef _JPPROXY_H_
17 #define _JPPROXY_H_
18
19 struct PyJPProxy;
20 class JPProxy;
21 class JPFunctional;
22
23 class JPProxy
24 {
25 public:
26 friend class JPProxyType;
27 JPProxy(PyJPProxy* inst, JPClassList& intf);
28 virtual ~JPProxy();
29
30 const JPClassList& getInterfaces() const
31 {
32 return m_InterfaceClasses;
33 }
34
35 jvalue getProxy();
36
37 virtual JPPyObject getCallable(const string& cname, int& addSelf) = 0;
38 static void releaseProxyPython(void* host);
39
40 PyJPProxy* getInstance()
41 {
42 return m_Instance;
43 }
44
45 PyJPProxy* m_Instance;
46 JPObjectRef m_Proxy;
47 JPClassList m_InterfaceClasses;
48 jweak m_Ref;
49 } ;
50
51 class JPProxyDirect : public JPProxy
52 {
53 public:
54 JPProxyDirect(PyJPProxy* inst, JPClassList& intf);
55 ~JPProxyDirect() override;
56 JPPyObject getCallable(const string& cname, int& addSelf) override;
57 } ;
58
59 class JPProxyIndirect : public JPProxy
60 {
61 public:
62 JPProxyIndirect(PyJPProxy* inst, JPClassList& intf);
63 ~JPProxyIndirect() override;
64 JPPyObject getCallable(const string& cname, int& addSelf) override;
65 } ;
66
67 class JPProxyFunctional : public JPProxy
68 {
69 public:
70 JPProxyFunctional(PyJPProxy* inst, JPClassList& intf);
71 ~JPProxyFunctional() override;
72 JPPyObject getCallable(const string& cname, int& addSelf) override;
73 private:
74 JPFunctional *m_Functional;
75 } ;
76
77 /** Special wrapper for round trip returns
78 */
79 class JPProxyType : public JPClass
80 {
81 public:
82 JPProxyType(JPJavaFrame& frame,
83 jclass clss,
84 const string& name,
85 JPClass* super,
86 JPClassList& interfaces,
87 jint modifiers);
88 ~ JPProxyType() override;
89
90 public: // JPClass implementation
91 JPPyObject convertToPythonObject(JPJavaFrame& frame, jvalue val, bool cast) override;
92
93 private:
94 JPClassRef m_ProxyClass;
95 jmethodID m_GetInvocationHandlerID;
96 jfieldID m_InstanceID;
97 } ;
98
99 #endif // JPPROXY_H