examples

Coverage Report

Created: 2024-07-26 02:37

/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
125
  Tuple2(A a, B b) : a_(a), b_(b) {
12
125
  }
Unexecuted instantiation: _ZN6Tuple2IP6BigStrS1_EC2ES1_S1_
_ZN6Tuple2IiP6BigStrEC2EiS1_
Line
Count
Source
11
17
  Tuple2(A a, B b) : a_(a), b_(b) {
12
17
  }
_ZN6Tuple2IP6BigStriEC2ES1_i
Line
Count
Source
11
50
  Tuple2(A a, B b) : a_(a), b_(b) {
12
50
  }
_ZN6Tuple2IN9expr_asdl5tok_eEP6BigStrEC2ES1_S3_
Line
Count
Source
11
58
  Tuple2(A a, B b) : a_(a), b_(b) {
12
58
  }
Unexecuted instantiation: _ZN6Tuple2IiiEC2Eii
13
14
128
  A at0() {
15
128
    return a_;
16
128
  }
Unexecuted instantiation: _ZN6Tuple2IiiE3at0Ev
_ZN6Tuple2IP6BigStriE3at0Ev
Line
Count
Source
14
50
  A at0() {
15
50
    return a_;
16
50
  }
_ZN6Tuple2IiP6BigStrE3at0Ev
Line
Count
Source
14
20
  A at0() {
15
20
    return a_;
16
20
  }
_ZN6Tuple2IN9expr_asdl5tok_eEP6BigStrE3at0Ev
Line
Count
Source
14
58
  A at0() {
15
58
    return a_;
16
58
  }
17
126
  B at1() {
18
126
    return b_;
19
126
  }
Unexecuted instantiation: _ZN6Tuple2IiiE3at1Ev
_ZN6Tuple2IP6BigStriE3at1Ev
Line
Count
Source
17
48
  B at1() {
18
48
    return b_;
19
48
  }
_ZN6Tuple2IiP6BigStrE3at1Ev
Line
Count
Source
17
20
  B at1() {
18
20
    return b_;
19
20
  }
_ZN6Tuple2IN9expr_asdl5tok_eEP6BigStrE3at1Ev
Line
Count
Source
17
58
  B at1() {
18
58
    return b_;
19
58
  }
20
21
42
  static constexpr ObjHeader obj_header() {
22
42
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
23
42
  }
_ZN6Tuple2IiP6BigStrE10obj_headerEv
Line
Count
Source
21
16
  static constexpr ObjHeader obj_header() {
22
16
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
23
16
  }
_ZN6Tuple2IP6BigStriE10obj_headerEv
Line
Count
Source
21
26
  static constexpr ObjHeader obj_header() {
22
26
    return ObjHeader::Tuple(field_mask(), sizeof(this_type));
23
26
  }
24
25
42
  static constexpr uint32_t field_mask() {
26
42
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
27
42
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
28
42
  }
_ZN6Tuple2IiP6BigStrE10field_maskEv
Line
Count
Source
25
16
  static constexpr uint32_t field_mask() {
26
16
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
27
16
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
28
16
  }
_ZN6Tuple2IP6BigStriE10field_maskEv
Line
Count
Source
25
26
  static constexpr uint32_t field_mask() {
26
26
    return (std::is_pointer<A>() ? maskbit(offsetof(this_type, a_)) : 0) |
27
26
           (std::is_pointer<B>() ? maskbit(offsetof(this_type, b_)) : 0);
28
26
  }
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
  Tuple3(A a, B b, C c) : a_(a), b_(b), c_(c) {
41
  }
42
  A at0() {
43
    return a_;
44
  }
45
  B at1() {
46
    return b_;
47
  }
48
  C at2() {
49
    return c_;
50
  }
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