forked from pythonnet/pythonnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipythonconvertable.cs
More file actions
executable file
·65 lines (47 loc) · 2.96 KB
/
ipythonconvertable.cs
File metadata and controls
executable file
·65 lines (47 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// ==========================================================================
// This software is subject to the provisions of the Zope Public License,
// Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
// FOR A PARTICULAR PURPOSE.
// ==========================================================================
using System;
namespace Python.Runtime {
//========================================================================
// Internal interface for objects that are convertable to a Python object
// representation. The outputs of this interface are generally expected to
// be platform-compatible pointers meaningful to the CPython runtime.
//========================================================================
internal interface IPythonConvertable {
//=====================================================================
// Given an arbitrary managed object, return a valid PyObject pointer
// or null if the given object cannot be converted to a Python object.
//=====================================================================
IntPtr GetPythonObjectPtr(object o);
//=====================================================================
// Given an arbitrary managed object, return a valid PyType_Object
// pointer representing the Python version of the type of that object,
// or null if the object has no meaningful Python type.
//=====================================================================
IntPtr GetPythonTypePtr(object o);
//=====================================================================
// Given an arbitrary managed type object, return a valid PyType_Object
// pointer representing the Python version of that type, or null if the
// given type cannot be converted to a meaningful Python type.
//=====================================================================
IntPtr GetPythonTypePtr(Type t);
//=====================================================================
// Given an arbitrary python object, return the managed object that
// the python object wraps, or null if the python object does not wrap
// a valid managed object.
//=====================================================================
object GetManagedObject(IntPtr op);
//=====================================================================
// Given an arbitrary python object, return a valid managed Type object
// representing the type of the python wrapper object, or null if the
// python object does not wrap a managed type.
//=====================================================================
Type GetManagedType(IntPtr op);
}
}