line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#pragma once |
2
|
|
|
|
|
|
|
#include "../Sv.h" |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
namespace xs { |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
namespace typemap { |
7
|
|
|
|
|
|
|
struct DefaultType {}; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
template struct Typemap { using _not_exists = void; }; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
template struct has_typemap : std::true_type {}; |
13
|
|
|
|
|
|
|
template struct has_typemap::_not_exists> : std::false_type {}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
template struct TypemapBase { |
16
|
|
|
|
|
|
|
static inline TYPE in (pTHX_ SV*) = delete; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
static inline Sv create (pTHX_ const TYPE&, const Sv& = Sv()) = delete; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
static inline Sv out (pTHX_ const TYPE& var, const Sv& proto = Sv()) { |
21
|
|
|
|
|
|
|
return Typemap::create(aTHX_ var, proto); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
static inline void destroy (pTHX_ const TYPE&, SV*) {} |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
template |
28
|
732
|
|
|
|
|
|
auto in (SV* arg) -> decltype(Typemap::in(aTHX_ arg)) { |
29
|
732
|
|
|
|
|
|
return Typemap::in(aTHX_ arg); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
template ::value, std::decay_t, TYPEMAP>> |
33
|
187
|
|
|
|
|
|
Sv out (TYPE&& var, const Sv& proto = Sv()) { |
34
|
187
|
|
|
|
|
|
return Typemap::out(aTHX_ std::forward(var), proto); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
38
|
|
|
|
|
|
|
template |
39
|
|
|
|
|
|
|
auto in (pTHX_ SV* arg) -> decltype(Typemap::in(aTHX_ arg)) { |
40
|
|
|
|
|
|
|
return Typemap::in(aTHX_ arg); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
template ::value, std::decay_t, TYPEMAP>> |
44
|
|
|
|
|
|
|
Sv out (pTHX_ TYPE&& var, const Sv& proto = Sv()) { |
45
|
|
|
|
|
|
|
return Typemap::out(aTHX_ std::forward(var), proto); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
#endif |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |