| 1 |
|
| MODE: INLINE |
| 2 |
|
| |
| 3 |
|
| struct BRUnit : panda::Refcnt { |
| 4 |
|
| int id; |
| 5 |
|
| |
| 6 |
|
| BRUnit (int id) : id(id) {} |
| 7 |
|
| |
| 8 |
|
| virtual BRUnit* clone () { |
| 9 |
|
| //printf("br unit clone\n"); |
| 10 |
|
| return new BRUnit(id); |
| 11 |
|
| } |
| 12 |
|
| |
| 13 |
|
| virtual ~BRUnit () { |
| 14 |
|
| //printf("~BRUnit\n"); |
| 15 |
|
| dcnt.c++; |
| 16 |
|
| } |
| 17 |
|
| }; |
| 18 |
|
| |
| 19 |
|
| struct BRUnitEnabled : BRUnit, Backref { |
| 20 |
|
| using BRUnit::BRUnit; |
| 21 |
|
| |
| 22 |
|
| BRUnit* clone () override { |
| 23 |
|
| //printf("BRUnitEnabled::clone()\n"); |
| 24 |
|
| return new BRUnitEnabled(this->id); |
| 25 |
|
| } |
| 26 |
|
| |
| 27 |
|
| ~BRUnitEnabled () { Backref::dtor(); } |
| 28 |
|
| }; |
| 29 |
|
| |
| 30 |
|
| struct BRStorage { |
| 31 |
|
| BRStorage () : unit(NULL) {} |
| 32 |
|
| |
| 33 |
|
| const panda::iptr<BRUnit>& get_unit () const { return unit; } |
| 34 |
|
| |
| 35 |
|
| void set_unit (BRUnit* val) { unit = val; } |
| 36 |
|
| void set_unit_with_id (int id) { unit = new BRUnit(id); } |
| 37 |
|
| void set_unit_with_id2 (int id) { unit = new BRUnitEnabled(id); } |
| 38 |
|
| |
| 39 |
|
| virtual ~BRStorage () { |
| 40 |
|
| //printf("~BRStorage\n"); |
| 41 |
|
| dcnt.c++; |
| 42 |
|
| } |
| 43 |
|
| |
| 44 |
|
| virtual BRStorage* clone () { |
| 45 |
|
| //printf("BRStorage::clone()\n"); |
| 46 |
|
| BRStorage* ret = new BRStorage(); |
| 47 |
|
| ret->set_unit(unit->clone()); |
| 48 |
|
| return ret; |
| 49 |
|
| } |
| 50 |
|
| private: |
| 51 |
|
| panda::iptr<BRUnit> unit; |
| 52 |
|
| }; |
| 53 |
|
| |
| 54 |
|
| namespace xs { |
| 55 |
|
| template <> struct Typemap<BRUnit*> : TypemapObject<BRUnit*, BRUnit*, ObjectTypeRefcntPtr, ObjectStorageMGBackref, DynamicCast> { |
| 56 |
|
| static std::string package () { return "MyTest::BRUnit"; } |
| 57 |
|
| static BRUnit* dup (BRUnit* obj) { return obj->clone(); } |
| 58 |
|
| }; |
| 59 |
|
| |
| 60 |
|
| template <> struct Typemap<BRStorage*> : TypemapObject<BRStorage*, BRStorage*, ObjectTypePtr, ObjectStorageMG, DynamicCast> { |
| 61 |
|
| static std::string package () { return "MyTest::BRStorage"; } |
| 62 |
|
| static BRStorage* dup (BRStorage* obj) { return obj->clone(); } |
| 63 |
|
| }; |
| 64 |
|
| } |
| 65 |
|
| |
| 66 |
|
| |
| 67 |
|
| MODULE = MyTest::Typemap::Object PACKAGE = MyTest::BRUnit |
| 68 |
|
| PROTOTYPES: DISABLE |
| 69 |
|
| |
| 70 |
2 |
| BRUnit* BRUnit::new (int id) |
| 71 |
2 |
▶ | |
Branch: 1 branch
| Branch | True | False | Total |
|
2 |
0 |
2 |
|
| 72 |
2 |
▶ | BRUnit* new_enabled (SV* CLASS, int id) { |
Branch: 4 branches
| Branch | True | False | Total |
| BRUnit* new_enabled (SV* CLASS, int id) { |
2 |
0 |
2 |
| BRUnit* new_enabled (SV* CLASS, int id) { |
2 |
0 |
2 |
| BRUnit* new_enabled (SV* CLASS, int id) { |
2 |
0 |
2 |
| BRUnit* new_enabled (SV* CLASS, int id) { |
0 |
0 |
0 |
|
| 73 |
7 |
| PROTO = CLASS; |
| 74 |
7 |
▶ | RETVAL = new BRUnitEnabled(id); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = new BRUnitEnabled(id); |
7 |
0 |
7 |
|
| 75 |
7 |
▶ | } |
Branch: 4 branches
| Branch | True | False | Total |
| } |
7 |
0 |
7 |
| } |
7 |
0 |
7 |
| } |
7 |
0 |
7 |
| } |
0 |
0 |
0 |
|
| 76 |
|
| |
| 77 |
1 |
| void BRUnit::retain () |
| 78 |
|
| |
| 79 |
|
| uint64_t BRUnit::br_addr () { |
| 80 |
0 |
| auto xsbr = panda::dyn_cast<xs::Backref*>(THIS); |
| 81 |
0 |
▶ | if (!xsbr) throw "no xsbr"; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!xsbr) throw "no xsbr"; |
0 |
0 |
0 |
|
| 82 |
0 |
▶ | RETVAL = (uint64_t)xsbr->svobj; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (uint64_t)xsbr->svobj; |
0 |
0 |
0 |
|
| 83 |
|
| } |
| 84 |
|
| |
| 85 |
|
| int BRUnit::rcnt_c () { |
| 86 |
0 |
▶ | RETVAL = THIS->refcnt(); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = THIS->refcnt(); |
0 |
0 |
0 |
|
| 87 |
|
| } |
| 88 |
|
| |
| 89 |
|
| int BRUnit::rcnt_sv () { |
| 90 |
0 |
| auto xsbr = panda::dyn_cast<xs::Backref*>(THIS); |
| 91 |
0 |
▶ | if (!xsbr) throw "no xsbr"; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!xsbr) throw "no xsbr"; |
0 |
0 |
0 |
|
| 92 |
|
| //printf("xsbr=%llu\n", xsbr); |
| 93 |
0 |
▶ | RETVAL = SvREFCNT(xsbr->svobj); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = SvREFCNT(xsbr->svobj); |
0 |
0 |
0 |
|
| 94 |
|
| } |
| 95 |
|
| |
| 96 |
|
| int BRUnit::id (SV* newval = NULL) { |
| 97 |
10 |
▶ | if (newval) THIS->id = SvIV(newval); |
Branch: 1 branch
| Branch | True | False | Total |
| if (newval) THIS->id = SvIV(newval); |
0 |
10 |
10 |
|
| 98 |
10 |
▶ | RETVAL = THIS->id; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = THIS->id; |
6 |
4 |
10 |
|
| 99 |
|
| } |
| 100 |
|
| |
| 101 |
|
| void BRUnit::DESTROY () { |
| 102 |
|
| //printf("BRUnit::DESTROY id=%d\n", THIS->id); |
| 103 |
11 |
| dcnt.perl++; |
| 104 |
11 |
▶ | } |
Branch: 1 branch
| Branch | True | False | Total |
| } |
11 |
0 |
11 |
|
| 105 |
|
| |
| 106 |
|
| |
| 107 |
|
| MODULE = MyTest::Typemap::Object PACKAGE = MyTest::BRStorage |
| 108 |
|
| PROTOTYPES: DISABLE |
| 109 |
|
| |
| 110 |
4 |
| BRStorage* BRStorage::new () |
| 111 |
4 |
▶ | |
Branch: 1 branch
| Branch | True | False | Total |
|
4 |
0 |
4 |
|
| 112 |
4 |
▶ | BRUnit* BRStorage::unit (BRUnit* unit = NULL) { |
Branch: 4 branches
| Branch | True | False | Total |
| BRUnit* BRStorage::unit (BRUnit* unit = NULL) { |
4 |
0 |
4 |
| BRUnit* BRStorage::unit (BRUnit* unit = NULL) { |
4 |
0 |
4 |
| BRUnit* BRStorage::unit (BRUnit* unit = NULL) { |
4 |
0 |
4 |
| BRUnit* BRStorage::unit (BRUnit* unit = NULL) { |
0 |
0 |
0 |
|
| 113 |
21 |
| if (items > 1) { |
| 114 |
21 |
▶ | THIS->set_unit(unit); |
Branch: 1 branch
| Branch | True | False | Total |
| THIS->set_unit(unit); |
12 |
9 |
21 |
|
| 115 |
12 |
▶ | XSRETURN_UNDEF; |
Branch: 1 branch
| Branch | True | False | Total |
| XSRETURN_UNDEF; |
12 |
0 |
12 |
|
| 116 |
12 |
| } |
| 117 |
|
| RETVAL = THIS->get_unit(); |
| 118 |
9 |
▶ | } |
Branch: 1 branch
| Branch | True | False | Total |
| } |
9 |
0 |
9 |
|
| 119 |
|
| |
| 120 |
|
| void BRStorage::set_unit_with_id (int id) : ALIAS(set_unit_with_id2=1) { |
| 121 |
0 |
▶ | if (ix == 1) THIS->set_unit_with_id2(id); |
Branch: 1 branch
| Branch | True | False | Total |
| if (ix == 1) THIS->set_unit_with_id2(id); |
0 |
0 |
0 |
|
| 122 |
0 |
| else THIS->set_unit_with_id(id); |
| 123 |
|
| } |
| 124 |
|
| |
| 125 |
|
| void BRStorage::DESTROY () { |
| 126 |
|
| //printf("BRStorage::DESTROY\n"); |
| 127 |
4 |
| dcnt.perl++; |
| 128 |
4 |
▶ | } |
Branch: 1 branch
| Branch | True | False | Total |
| } |
4 |
0 |
4 |
|
| 129 |
|
| |