t/typemap/object/single.xsi

filter: Statementstmt 94.7% 18 / 19 Branchbran 61.7% 21 / 34 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 73.5% 39 / 53 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/xs/Scope.cc ↑ Summary t/typemap/object/avhv.xsi »
1 MODE: INLINE
2  
3 template <int i>
4 class _MyBase {
5 public:
6 int val;
7 _MyBase (int arg) : val(arg) {}
8 virtual _MyBase* clone () const { return new _MyBase(val); }
9 virtual ~_MyBase () { dcnt.c++; }
10 };
11  
12 using MyBase = _MyBase<0>;
13 using PTRMyBase = _MyBase<1>;
14  
15 namespace xs {
16 template <class TYPE> struct Typemap<PTRMyBase*,TYPE*> : TypemapObject<PTRMyBase*, TYPE*, ObjectTypePtr, ObjectStorageIV, DynamicCast> {
17 static std::string package () { return "MyTest::PTRMyBase"; }
18 };
19 template <class TYPE> struct Typemap<MyBase*,TYPE*> : TypemapObject<MyBase*, TYPE*, ObjectTypePtr, ObjectStorageMG, DynamicCast> {
20 static std::string package () { return "MyTest::MyBase"; }
21 static MyBase* dup (const MyBase* obj) { return obj->clone(); }
22 };
23 }
24  
25  
26 MODULE = MyTest::Typemap::Object PACKAGE = MyTest::PTRMyBase
27 PROTOTYPES: DISABLE
28  
29 PTRMyBase* PTRMyBase::new (int arg) {
30 4 if (!arg) XSRETURN_UNDEF;
31 4 ▶ RETVAL = new PTRMyBase(arg);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = new PTRMyBase(arg); 4 0 4
32 4 ▶}
Branch: 1 branch
BranchTrueFalseTotal
} 1 3 4
33 3 ▶ 
Branch: 2 branches
BranchTrueFalseTotal
3 0 3
3 0 3
34 int PTRMyBase::val (SV* newval = NULL) {
35 5 ▶ if (newval) THIS->val = SvIV(newval);
Branch: 1 branch
BranchTrueFalseTotal
if (newval) THIS->val = SvIV(newval); 0 5 5
36 5 ▶ RETVAL = THIS->val;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = THIS->val; 0 5 5
37 }
38  
39 void PTRMyBase::set_from (PTRMyBase* other) {
40 2 ▶ if (other) THIS->val = other->val;
Branch: 1 branch
BranchTrueFalseTotal
if (other) THIS->val = other->val; 1 1 2
41 }
42  
43 void PTRMyBase::DESTROY () {
44 5 dcnt.perl++;
45 5 ▶}
Branch: 1 branch
BranchTrueFalseTotal
} 5 0 5
46  
47  
48 MODULE = MyTest::Typemap::Object PACKAGE = MyTest::MyBase
49 PROTOTYPES: DISABLE
50  
51 MyBase* MyBase::new (int arg) {
52 5 if (!arg) XSRETURN_UNDEF;
53 5 ▶ RETVAL = new MyBase(arg);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = new MyBase(arg); 5 0 5
54 5 ▶}
Branch: 1 branch
BranchTrueFalseTotal
} 1 4 5
55 4 ▶ 
Branch: 2 branches
BranchTrueFalseTotal
4 0 4
4 0 4
56 int MyBase::val (SV* newval = NULL) {
57 9 ▶ if (newval) THIS->val = SvIV(newval);
Branch: 1 branch
BranchTrueFalseTotal
if (newval) THIS->val = SvIV(newval); 0 9 9
58 9 ▶ RETVAL = THIS->val;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = THIS->val; 5 4 9
59 }
60  
61 int MyBase::get_val () {
62 0 ▶ RETVAL = THIS->val;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = THIS->val; 0 0 0
63 }
64  
65 void MyBase::set_from (MyBase* other) {
66 2 ▶ if (other) THIS->val = other->val;
Branch: 1 branch
BranchTrueFalseTotal
if (other) THIS->val = other->val; 1 1 2
67 }
68  
69 void MyBase::DESTROY () {
70 10 dcnt.perl++;
71 10 ▶}
Branch: 1 branch
BranchTrueFalseTotal
} 10 0 10
« src/xs/Scope.cc ↑ Summary t/typemap/object/avhv.xsi »