| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#include |
|
2
|
|
|
|
|
|
|
#include |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
using namespace xs; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
using panda::string; |
|
7
|
|
|
|
|
|
|
using panda::string_view; |
|
8
|
|
|
|
|
|
|
using panda::CallbackDispatcher; |
|
9
|
|
|
|
|
|
|
template using iptr = panda::iptr; |
|
10
|
|
|
|
|
|
|
|
|
11
|
88
|
|
|
|
|
|
struct NoTmStruct { |
|
12
|
|
|
|
|
|
|
string val; |
|
13
|
|
|
|
|
|
|
}; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
struct SomeClass : panda::Refcnt {}; |
|
16
|
|
|
|
|
|
|
struct SomeClass2 : panda::Refcnt {}; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
using cdVS = CallbackDispatcher; |
|
19
|
|
|
|
|
|
|
using cdIS = CallbackDispatcher; |
|
20
|
|
|
|
|
|
|
using cdIV = CallbackDispatcher; |
|
21
|
|
|
|
|
|
|
using cdVIref = CallbackDispatcher; |
|
22
|
|
|
|
|
|
|
using cdVPtrref = CallbackDispatcher&)>; |
|
23
|
|
|
|
|
|
|
using cdVV = CallbackDispatcher; |
|
24
|
|
|
|
|
|
|
using cdPtrPtr = CallbackDispatcher, iptr)>; |
|
25
|
|
|
|
|
|
|
using cdNoTm = CallbackDispatcher; |
|
26
|
|
|
|
|
|
|
|
|
27
|
3
|
50
|
|
|
|
|
struct DispatchingObject { |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
cdVS vs; |
|
29
|
|
|
|
|
|
|
cdIV iv; |
|
30
|
|
|
|
|
|
|
cdVIref viref; |
|
31
|
|
|
|
|
|
|
cdVPtrref vptrref; |
|
32
|
|
|
|
|
|
|
cdIS is; |
|
33
|
|
|
|
|
|
|
cdVV vv; |
|
34
|
|
|
|
|
|
|
cdNoTm notm; |
|
35
|
|
|
|
|
|
|
cdPtrPtr ptrptr; |
|
36
|
|
|
|
|
|
|
}; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
namespace xs { |
|
39
|
|
|
|
|
|
|
template struct Typemap : TypemapObject { |
|
40
|
4
|
|
|
|
|
|
static panda::string_view package () { return "MyTest::DispatchingObject"; } |
|
41
|
|
|
|
|
|
|
}; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
template struct Typemap : TypemapObject { |
|
44
|
0
|
|
|
|
|
|
static panda::string_view package () { return "MyTest::SomeClass"; } |
|
45
|
|
|
|
|
|
|
}; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
template struct Typemap : TypemapObject { |
|
48
|
0
|
|
|
|
|
|
static panda::string_view package () { return "MyTest::SomeClass2"; } |
|
49
|
|
|
|
|
|
|
}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
MODULE = MyTest::Typemap::CD PACKAGE = MyTest::DispatchingObject |
|
53
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
|
54
|
|
|
|
|
|
|
|
|
55
|
2
|
|
|
|
|
|
DispatchingObject* new (SV*) |
|
56
|
1
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
XSCallbackDispatcher* DispatchingObject::vs (string_view type = string_view()) { |
|
58
|
110
|
|
|
|
|
|
if (type == "") |
|
59
|
55
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->vs); |
|
|
|
100
|
|
|
|
|
|
|
60
|
48
|
50
|
|
|
|
|
else if (type == "nullptr") |
|
61
|
7
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->vs, nullptr); |
|
|
|
100
|
|
|
|
|
|
|
62
|
2
|
50
|
|
|
|
|
else if (type == "pair_inout") |
|
63
|
5
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->vs, std::make_pair( |
|
|
|
100
|
|
|
|
|
|
|
64
|
2
|
50
|
|
|
|
|
[](string str) { return Simple(str + " custom_out"); }, |
|
65
|
1
|
50
|
|
|
|
|
[](const Sv& sv) { return xs::in(sv) + " custom_in"; } |
|
66
|
1
|
50
|
|
|
|
|
)); |
|
67
|
4
|
|
|
|
|
|
else if (type == "pair_out") |
|
68
|
3
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->vs, std::make_pair( |
|
|
|
100
|
|
|
|
|
|
|
69
|
1
|
50
|
|
|
|
|
[](string str) { return Simple(str + " custom_out"); }, |
|
70
|
1
|
50
|
|
|
|
|
nullptr |
|
71
|
|
|
|
|
|
|
)); |
|
72
|
1
|
|
|
|
|
|
else if (type == "pair_in") |
|
73
|
2
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->vs, std::make_pair( |
|
|
|
50
|
|
|
|
|
|
|
74
|
2
|
50
|
|
|
|
|
nullptr, |
|
75
|
|
|
|
|
|
|
[](const Sv& sv) { return xs::in(sv) + " custom_in"; } |
|
76
|
1
|
50
|
|
|
|
|
)); |
|
77
|
2
|
|
|
|
|
|
else throw "wtf"; |
|
78
|
0
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
cdIV* DispatchingObject::iv () { |
|
81
|
36
|
|
|
|
|
|
RETVAL = &THIS->iv; |
|
82
|
18
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
XSCallbackDispatcher* DispatchingObject::viref () { |
|
85
|
4
|
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->viref, std::make_pair( |
|
86
|
2
|
50
|
|
|
|
|
[](const int& v) { return xs::out(v); }, |
|
87
|
1
|
50
|
|
|
|
|
[](const Sv& sv) { return xs::in(sv); } |
|
88
|
2
|
|
|
|
|
|
)); |
|
89
|
2
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
cdVPtrref* DispatchingObject::vptrref () { |
|
92
|
0
|
|
|
|
|
|
RETVAL = &THIS->vptrref; |
|
93
|
0
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
XSCallbackDispatcher* DispatchingObject::is (string_view type = string_view()) { |
|
96
|
28
|
|
|
|
|
|
if (type == "") |
|
97
|
14
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->is); |
|
|
|
100
|
|
|
|
|
|
|
98
|
8
|
50
|
|
|
|
|
else if (type == "nullptr") |
|
99
|
6
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->is, nullptr); |
|
|
|
100
|
|
|
|
|
|
|
100
|
2
|
50
|
|
|
|
|
else if (type == "ret_inout") |
|
101
|
4
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->is, std::make_pair( |
|
|
|
100
|
|
|
|
|
|
|
102
|
2
|
50
|
|
|
|
|
[](panda::optional val) { return val ? Simple(*val + 100) : Simple::undef; }, |
|
103
|
2
|
50
|
|
|
|
|
[](const Sv& sv) { return xs::in(sv) + 10; } |
|
104
|
2
|
|
|
|
|
|
)); |
|
105
|
4
|
|
|
|
|
|
else if (type == "ret_arg_inout") |
|
106
|
2
|
50
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->is, std::make_pair( |
|
|
|
50
|
|
|
|
|
|
|
107
|
2
|
50
|
|
|
|
|
[](panda::optional val) { return val ? Simple(*val + 100) : Simple::undef; }, |
|
108
|
2
|
50
|
|
|
|
|
[](const Sv& sv) { return xs::in(sv) + 10; } |
|
109
|
2
|
|
|
|
|
|
), std::make_pair( |
|
110
|
2
|
|
|
|
|
|
[](string str) { return Simple(str + " custom_out"); }, |
|
111
|
1
|
50
|
|
|
|
|
[](const Sv& sv) { return xs::in(sv) + " custom_in"; } |
|
112
|
1
|
50
|
|
|
|
|
)); |
|
113
|
4
|
|
|
|
|
|
else throw "wtf"; |
|
114
|
0
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
cdVV* DispatchingObject::vv () { |
|
117
|
16
|
|
|
|
|
|
RETVAL = &THIS->vv; |
|
118
|
8
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
XSCallbackDispatcher* DispatchingObject::notm () { |
|
121
|
8
|
|
|
|
|
|
auto caster = std::make_pair( |
|
122
|
|
|
|
|
|
|
[](panda::optional a) { return a ? Simple(a.value().val + "o") : Simple::undef; }, |
|
123
|
4
|
50
|
|
|
|
|
[](const Sv& arg) { return NoTmStruct { xs::in(arg) + "i" }; } |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
124
|
4
|
50
|
|
|
|
|
); |
|
125
|
4
|
|
|
|
|
|
RETVAL = XSCallbackDispatcher::create(THIS->notm, caster, caster); |
|
126
|
4
|
50
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
cdPtrPtr* DispatchingObject::ptrptr () { |
|
129
|
0
|
|
|
|
|
|
RETVAL = &THIS->ptrptr; |
|
130
|
0
|
|
|
|
|
|
} |