cpp

Coverage Report

Created: 2024-07-28 06:14

/home/uke/oil/mycpp/gc_tuple.h
Line
Count
Source
1
#ifndef MYCPP_GC_TUPLE_H
2
#define MYCPP_GC_TUPLE_H
3
4
#include <type_traits>
5
6
template <class A, class B>
7
class Tuple2 {
8
  typedef Tuple2<A, B> this_type;
9
10
 public:
11
33
  Tuple2(A a, B b) : a_(a), b_(b) {
12
33
  }
_ZN6Tuple2IiiEC2Eii
Line
Count
Source
11
18
  Tuple2(A a, B b) : a_(a), b_(b) {
12
18
  }
Unexecuted instantiation: _ZN6Tuple2IllEC2Ell
_ZN6Tuple2IP6BigStriEC2ES1_i
Line
Count
Source
11
1
  Tuple2(A a, B b) : a_(a), b_(b) {
12
1
  }
Unexecuted instantiation: _ZN6Tuple2IiPvEC2EiS0_
Unexecuted instantiation: _ZN6Tuple2IP6BigStrS1_EC2ES1_S1_
Unexecuted instantiation: _ZN6Tuple2IP4ListIPS0_IPS_IiiEEEP4DictIiiEEC2ES6_S9_
Unexecuted instantiation: _ZN6Tuple2IP6BigStrPN11syntax_asdl5loc_tEEC2ES1_S4_
Unexecuted instantiation: _ZN6Tuple2IP4ListIP6BigStrEPS0_IPN11syntax_asdl12CompoundWordEEEC2ES4_S9_
Unexecuted instantiation: _ZN6Tuple2IP6BigStrbEC2ES1_b
_ZN6Tuple2IiP6BigStrEC2EiS1_
Line
Count
Source
11
14
  Tuple2(A a, B b) : a_(a), b_(b) {
12
14
  }
13
14
40
  A at0() {
15
40
    return a_;
16
40
  }
_ZN6Tuple2IiiE3at0Ev
Line
Count
Source
14
20
  A at0() {
15
20
    return a_;
16
20
  }
_ZN6Tuple2IP6BigStriE3at0Ev
Line
Count
Source
14
1
  A at0() {
15
1
    return a_;
16
1
  }
_ZN6Tuple2IiP6BigStrE3at0Ev
Line
Count
Source
14
19
  A at0() {
15
19
    return a_;
16
19
  }
17
28
  B at1() {
18
28
    return b_;
19
28
  }
_ZN6Tuple2IiiE3at1Ev
Line
Count
Source
17
17
  B at1() {
18
17
    return b_;
19
17
  }
_ZN6Tuple2IP6BigStriE3at1Ev
Line
Count
Source
17
1
  B at1() {
18
1
    return b_;
19
1
  }
_ZN6Tuple2IiP6BigStrE3at1Ev
Line
Count
Source
17
10
  B at1() {
18
10
    return b_;
19
10
  }
20
21
9
  static constexpr ObjHeader obj_header() {
22
9
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
23
9
  }
_ZN6Tuple2IP6BigStriE10obj_headerEv
Line
Count
Source
21
1
  static constexpr ObjHeader obj_header() {
22
1
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
23
1
  }
_ZN6Tuple2IiiE10obj_headerEv
Line
Count
Source
21
3
  static constexpr ObjHeader obj_header() {
22
3
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
23
3
  }
Unexecuted instantiation: _ZN6Tuple2IP4ListIPS0_IPS_IiiEEEP4DictIiiEE10obj_headerEv
Unexecuted instantiation: _ZN6Tuple2IP6BigStrbE10obj_headerEv
_ZN6Tuple2IiP6BigStrE10obj_headerEv
Line
Count
Source
21
5
  static constexpr ObjHeader obj_header() {
22
5
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
23
5
  }
24
25
9
  static constexpr uint32_t field_mask() {
26
9
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
27
9
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
28
9
  }
_ZN6Tuple2IP6BigStriE10field_maskEv
Line
Count
Source
25
1
  static constexpr uint32_t field_mask() {
26
1
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
27
1
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
28
1
  }
_ZN6Tuple2IiiE10field_maskEv
Line
Count
Source
25
3
  static constexpr uint32_t field_mask() {
26
3
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
27
3
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
28
3
  }
Unexecuted instantiation: _ZN6Tuple2IP4ListIPS0_IPS_IiiEEEP4DictIiiEE10field_maskEv
Unexecuted instantiation: _ZN6Tuple2IP6BigStrbE10field_maskEv
_ZN6Tuple2IiP6BigStrE10field_maskEv
Line
Count
Source
25
5
  static constexpr uint32_t field_mask() {
26
5
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
27
5
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
28
5
  }
29
30
 private:
31
  A a_;
32
  B b_;
33
};
34
35
template <class A, class B, class C>
36
class Tuple3 {
37
  typedef Tuple3<A, B, C> this_type;
38
39
 public:
40
1
  Tuple3(A a, B b, C c) : a_(a), b_(b), c_(c) {
41
1
  }
42
1
  A at0() {
43
1
    return a_;
44
1
  }
45
1
  B at1() {
46
1
    return b_;
47
1
  }
48
1
  C at2() {
49
1
    return c_;
50
1
  }
51
52
  static constexpr ObjHeader obj_header() {
53
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
54
  }
55
56
  static constexpr uint32_t field_mask() {
57
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
58
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
59
           (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0);
60
  }
61
62
 private:
63
  A a_;
64
  B b_;
65
  C c_;
66
};
67
68
template <class A, class B, class C, class D>
69
class Tuple4 {
70
  typedef Tuple4<A, B, C, D> this_type;
71
72
 public:
73
  Tuple4(A a, B b, C c, D d) : a_(a), b_(b), c_(c), d_(d) {
74
  }
75
  A at0() {
76
    return a_;
77
  }
78
  B at1() {
79
    return b_;
80
  }
81
  C at2() {
82
    return c_;
83
  }
84
  D at3() {
85
    return d_;
86
  }
87
88
  static constexpr ObjHeader obj_header() {
89
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
90
  }
91
92
  static constexpr uint32_t field_mask() {
93
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
94
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
95
           (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0) |
96
           (std::is_pointer<D>() ? maskbit(offsetof(this_type, d_)) : 0);
97
  }
98
99
 private:
100
  A a_;
101
  B b_;
102
  C c_;
103
  D d_;
104
};
105
106
template <class A, class B, class C, class D, class E>
107
class Tuple5 {
108
  typedef Tuple5<A, B, C, D, E> this_type;
109
110
 public:
111
  Tuple5(A a, B b, C c, D d, E e) : a_(a), b_(b), c_(c), d_(d), e_(e) {
112
  }
113
  A at0() {
114
    return a_;
115
  }
116
  B at1() {
117
    return b_;
118
  }
119
  C at2() {
120
    return c_;
121
  }
122
  D at3() {
123
    return d_;
124
  }
125
  E at4() {
126
    return e_;
127
  }
128
129
  static constexpr ObjHeader obj_header() {
130
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
131
  }
132
133
  static constexpr uint32_t field_mask() {
134
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
135
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0) |
136
           (std::is_pointer<C>() ? maskbit(offsetof(this_type, c_)) : 0) |
137
           (std::is_pointer<D>() ? maskbit(offsetof(this_type, d_)) : 0) |
138
           (std::is_pointer<E>() ? maskbit(offsetof(this_type, e_)) : 0);
139
  }
140
141
 private:
142
  A a_;
143
  B b_;
144
  C c_;
145
  D d_;
146
  E e_;
147
};
148
149
#endif  // MYCPP_GC_TUPLE_H