t/cookbook/recipe13.xsi

filter: Statementstmt 0.0% 0 / 15 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 33 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« t/cookbook/recipe11.xsi ↑ Summary t/typemap/object/threads.xsi »
1 MODE: INLINE
2  
3 #include <cmath>
4 #include <iostream>
5  
6 struct PointRecipe13: public panda::Refcnt {
7 double x;
8 double y;
9 PointRecipe13(double xx, double yy): x{xx}, y{yy}{}
10 };
11  
12 using PointRecipe13SP = panda::iptr<PointRecipe13>;
13  
14 struct Shape13: public panda::Refcnt {
15 size_t point_count() const { return points.size(); }
16 PointRecipe13SP get_point(size_t idx) { return points.at(idx); }
17 void add_point(PointRecipe13SP pt) { points.push_back(pt); }
18 private:
19 std::vector<PointRecipe13SP> points;
20 };
21  
22 namespace xs {
23 template <>
24 struct Typemap<PointRecipe13*> : TypemapObject<PointRecipe13*, PointRecipe13*, ObjectTypeRefcntPtr, ObjectStorageMGBackref> {
25 static std::string package () { return "MyTest::Cookbook::PointRecipe13"; }
26 };
27  
28 template <>
29 struct Typemap<Shape13*> : TypemapObject<Shape13*, Shape13*, ObjectTypeRefcntPtr, ObjectStorageMG> {
30 static std::string package () { return "MyTest::Cookbook::Shape13"; }
31 };
32 }
33  
34 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::PointRecipe13
35 PROTOTYPES: DISABLE
36  
37 double PointRecipe13::x(SV* new_val = nullptr) : ALIAS(y = 1) {
38 0 double* val = nullptr;
39 0 ▶ switch(ix) {
Branch: 1 branch
BranchTrueFalseTotal
switch(ix) { 0 0 0
40 0 case 1: val = &THIS->y; break;
41 0 default: val = &THIS->x; break;
42 }
43 0 ▶ if (new_val) {
Branch: 1 branch
BranchTrueFalseTotal
if (new_val) { 0 0 0
44 0 *val = SvNV(new_val);
45 }
46 0 ▶ RETVAL = *val;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = *val; 0 0 0
47 }
48  
49 PointRecipe13* PointRecipe13::new(double x = 0, double y = 0) {
50 0 RETVAL = make_backref<PointRecipe13>(x, y);
51 0 ▶ //RETVAL = new PointRecipe13(x, y);
Branch: 1 branch
BranchTrueFalseTotal
//RETVAL = new PointRecipe13(x, y); 0 0 0
52 0 ▶}
Branch: 2 branches
BranchTrueFalseTotal
} 0 0 0
} 0 0 0
53  
54 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::Shape13
55 PROTOTYPES: DISABLE
56  
57 0 size_t Shape13::point_count()
58  
59 0 ▶void Shape13::add_point(PointRecipe13SP pt)
Branch: 1 branch
BranchTrueFalseTotal
void Shape13::add_point(PointRecipe13SP pt) 0 0 0
60  
61 0 PointRecipe13SP Shape13::get_point(size_t idx)
62 0 ▶ 
Branch: 2 branches
BranchTrueFalseTotal
0 0 0
0 0 0
63 0 Shape13* Shape13::new(...)
« t/cookbook/recipe11.xsi ↑ Summary t/typemap/object/threads.xsi »