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 (SV*) = delete; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
static inline Sv create (const TYPE&, const Sv& = Sv()) = delete; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
static inline Sv out (const TYPE& var, const Sv& proto = Sv()) { |
21
|
|
|
|
|
|
|
return Typemap::create(var, proto); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
static inline void destroy (const TYPE&, SV*) {} |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
template |
28
|
67
|
|
|
|
|
|
auto in (SV* arg) -> decltype(Typemap::in(arg)) { |
29
|
67
|
|
|
|
|
|
return Typemap::in(arg); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
template ::value, std::decay_t, TYPEMAP>> |
33
|
49
|
|
|
|
|
|
Sv out (TYPE&& var, const Sv& proto = Sv()) { |
34
|
49
|
|
|
|
|
|
return Typemap::out(std::forward(var), proto); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |