| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#pragma once |
|
2
|
|
|
|
|
|
|
#include "base.h" |
|
3
|
|
|
|
|
|
|
#include "../Hash.h" |
|
4
|
|
|
|
|
|
|
#include "../Array.h" |
|
5
|
|
|
|
|
|
|
#include "../Simple.h" |
|
6
|
|
|
|
|
|
|
#include |
|
7
|
|
|
|
|
|
|
#include |
|
8
|
|
|
|
|
|
|
#include |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
namespace xs { |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
namespace typemap { namespace containers { |
|
13
|
|
|
|
|
|
|
inline const panda::string& to_key (const panda::string& value) { return value; } |
|
14
|
6
|
|
|
|
|
|
inline panda::string_view to_key (const std::string& value) { return panda::string_view(value.data(), value.size()); } |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
template |
|
17
|
8
|
|
|
|
|
|
panda::string to_key (T&& value) { return panda::to_string(std::forward(value)); } |
|
18
|
|
|
|
|
|
|
}} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
template struct VectorTypemap : TypemapBase> { |
|
21
|
1
|
|
|
|
|
|
static Sv out(const std::vector& data, const Sv& = {}){ |
|
22
|
2
|
50
|
|
|
|
|
auto out = Array::create(data.size()); |
|
23
|
6
|
100
|
|
|
|
|
for(const auto& i : data){ |
|
24
|
5
|
50
|
|
|
|
|
out.push(xs::out(i)); |
|
|
|
50
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
|
26
|
2
|
50
|
|
|
|
|
return Ref::create(out); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
|
static std::vector in (Array arg){ |
|
30
|
1
|
|
|
|
|
|
std::vector out; |
|
31
|
1
|
50
|
|
|
|
|
out.reserve(arg.size()); |
|
|
|
50
|
|
|
|
|
|
|
32
|
6
|
50
|
|
|
|
|
for(const auto& i : arg){ |
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
33
|
5
|
50
|
|
|
|
|
out.emplace_back(xs::in(i)); |
|
|
|
50
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
|
35
|
1
|
|
|
|
|
|
return out; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
}; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
template struct Typemap> : VectorTypemap {}; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
template struct Typemap, std::map> : TypemapBase> { |
|
42
|
2
|
|
|
|
|
|
static Sv out (const std::map& data, const Sv& = {}) { |
|
43
|
4
|
50
|
|
|
|
|
auto out = Hash::create(data.size()); |
|
|
|
50
|
|
|
|
|
|
|
44
|
9
|
100
|
|
|
|
|
for(const auto& i : data){ |
|
|
|
100
|
|
|
|
|
|
|
45
|
11
|
50
|
|
|
|
|
auto key = typemap::containers::to_key(i.first); |
|
46
|
7
|
50
|
|
|
|
|
out.store(key, xs::out(i.second)); |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
|
48
|
4
|
50
|
|
|
|
|
return Ref::create(out); |
|
|
|
50
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
2
|
|
|
|
|
|
static std::map in (Hash arg) { |
|
52
|
2
|
|
|
|
|
|
std::map out; |
|
53
|
9
|
50
|
|
|
|
|
for (const auto& element : arg){ |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
54
|
10
|
50
|
|
|
|
|
K key = xs::in(Simple(element.key())); |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
55
|
7
|
50
|
|
|
|
|
V value = xs::in(element.value()); |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
56
|
7
|
50
|
|
|
|
|
out.emplace(key, value); |
|
|
|
50
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
|
58
|
2
|
|
|
|
|
|
return out; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
}; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
template struct Typemap, std::unordered_map> : TypemapBase> { |
|
63
|
|
|
|
|
|
|
static Sv out (const std::unordered_map& data, const Sv& = {}) { |
|
64
|
|
|
|
|
|
|
auto out = Hash::create(data.size()); |
|
65
|
|
|
|
|
|
|
for(const auto& i : data){ |
|
66
|
|
|
|
|
|
|
auto key = typemap::containers::to_key(i.first); |
|
67
|
|
|
|
|
|
|
out.store(key, xs::out(i.second)); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
return Ref::create(out); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
static std::unordered_map in (Hash arg) { |
|
73
|
|
|
|
|
|
|
std::unordered_map out; |
|
74
|
|
|
|
|
|
|
for (const auto& element : arg){ |
|
75
|
|
|
|
|
|
|
K key = xs::in(Simple(element.key())); |
|
76
|
|
|
|
|
|
|
V value = xs::in(element.value()); |
|
77
|
|
|
|
|
|
|
out.emplace(key, value); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
return out; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
}; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |