| 1 |
|
| MODE: INLINE |
| 2 |
|
| |
| 3 |
|
| template <int i> |
| 4 |
|
| struct _MyConst { |
| 5 |
|
| int val; |
| 6 |
|
| _MyConst (int arg) : val(arg) {} |
| 7 |
|
| int get_val () const { return val; } |
| 8 |
|
| virtual _MyConst* clone () const { return new _MyConst(val); } |
| 9 |
|
| virtual ~_MyConst () { dcnt.c++; } |
| 10 |
|
| }; |
| 11 |
|
| |
| 12 |
|
| using MyConst = _MyConst<0>; |
| 13 |
|
| using MyConst2 = _MyConst<1>; |
| 14 |
|
| |
| 15 |
|
| namespace xs { |
| 16 |
|
| template <class TYPE> struct Typemap<MyConst*, TYPE> : TypemapObject<MyConst*, TYPE, ObjectTypePtr, ObjectStorageMG> { |
| 17 |
|
| static std::string package () { return "MyTest::MyConst"; } |
| 18 |
|
| }; |
| 19 |
|
| |
| 20 |
|
| template <class TYPE> struct Typemap<MyConst2*, TYPE> : TypemapObject<MyConst2*, TYPE, ObjectTypePtr, ObjectStorageMG> { |
| 21 |
|
| static std::string package () { return "MyTest::MyConst2"; } |
| 22 |
|
| static Sv out (TYPE var, const Sv& proto = {}) { |
| 23 |
|
| var->val = 555; |
| 24 |
|
| return TypemapObject<MyConst2*, TYPE, ObjectTypePtr, ObjectStorageMG>::out(var, proto); |
| 25 |
|
| } |
| 26 |
|
| }; |
| 27 |
|
| template <class TYPE> struct Typemap<const MyConst2*, TYPE> : TypemapObject<const MyConst2*, TYPE, ObjectTypePtr, ObjectStorageMG> { |
| 28 |
|
| static std::string package () { return "MyTest::MyConst2"; } |
| 29 |
|
| }; |
| 30 |
|
| } |
| 31 |
|
| |
| 32 |
|
| |
| 33 |
|
| MODULE = MyTest::Typemap PACKAGE = MyTest::MyConst |
| 34 |
|
| PROTOTYPES: DISABLE |
| 35 |
|
| |
| 36 |
1 |
| MyConst* new (SV*, int arg) |
| 37 |
1 |
▶ | |
Branch: 2 branches
| Branch | True | False | Total |
|
1 |
0 |
1 |
|
1 |
0 |
1 |
|
| 38 |
|
| const MyConst* new_const (SV*, int arg) { |
| 39 |
2 |
| RETVAL = new MyConst(arg); |
| 40 |
2 |
▶ | } |
Branch: 2 branches
| Branch | True | False | Total |
| } |
2 |
0 |
2 |
| } |
2 |
0 |
2 |
|
| 41 |
|
| |
| 42 |
6 |
| int MyConst::get_val () : const |
| 43 |
|
| |
| 44 |
2 |
| void MyConst::set_val (SV* newval) { THIS->val = SvIV(newval); } |
| 45 |
|
| |
| 46 |
1 |
▶ | void MyConst::set_from (const MyConst* other) { if (other) THIS->val = other->val; } |
Branch: 1 branch
| Branch | True | False | Total |
| void MyConst::set_from (const MyConst* other) { if (other) THIS->val = other->val; } |
1 |
0 |
1 |
|
| 47 |
|
| |
| 48 |
|
| void MyConst::DESTROY () : const { |
| 49 |
3 |
| dcnt.perl++; |
| 50 |
3 |
▶ | } |
Branch: 1 branch
| Branch | True | False | Total |
| } |
3 |
0 |
3 |
|
| 51 |
|
| |
| 52 |
|
| |
| 53 |
|
| MODULE = MyTest::Typemap PACKAGE = MyTest::MyConst2 |
| 54 |
|
| PROTOTYPES: DISABLE |
| 55 |
|
| |
| 56 |
1 |
| MyConst2* new (SV*, int arg) |
| 57 |
1 |
▶ | |
Branch: 2 branches
| Branch | True | False | Total |
|
1 |
0 |
1 |
|
1 |
0 |
1 |
|
| 58 |
|
| const MyConst2* new_const (SV*, int arg) { |
| 59 |
1 |
| RETVAL = new MyConst2(arg); |
| 60 |
1 |
▶ | } |
Branch: 2 branches
| Branch | True | False | Total |
| } |
1 |
0 |
1 |
| } |
1 |
0 |
1 |
|
| 61 |
|
| |
| 62 |
|
| int MyConst2::get_val () : const { |
| 63 |
2 |
▶ | RETVAL = THIS->val; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = THIS->val; |
0 |
2 |
2 |
|
| 64 |
|
| } |
| 65 |
|
| |
| 66 |
|
| void MyConst2::set_val (SV* newval) { |
| 67 |
0 |
| THIS->val = SvIV(newval); |
| 68 |
|
| } |
| 69 |
|
| |
| 70 |
|
| void MyConst2::set_from (const MyConst2* other) { |
| 71 |
0 |
▶ | if (other) THIS->val = other->val; |
Branch: 1 branch
| Branch | True | False | Total |
| if (other) THIS->val = other->val; |
0 |
0 |
0 |
|
| 72 |
|
| } |
| 73 |
|
| |
| 74 |
|
| void MyConst2::DESTROY () : const { |
| 75 |
2 |
| dcnt.perl++; |
| 76 |
2 |
▶ | } |
Branch: 1 branch
| Branch | True | False | Total |
| } |
2 |
0 |
2 |
|