t/cookbook/recipe01.xsi

filter: Statementstmt 0.0% 0 / 11 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 37 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/xs/typemap/string.h ↑ Summary t/cookbook/recipe03.xsi »
1 MODE: INLINE
2  
3 #include <ctime>
4 #include <iostream>
5  
6 struct DateRecipe01a {
7 DateRecipe01a() { update(false) ; }
8 ~DateRecipe01a() { std::cout << "~DateRecipe01a()\n"; }
9 void update(bool trace = true) {
10 if (trace) std::cout << "DateRecipe01a::update()\n";
11 epoch = std::time(nullptr);
12 }
13  
14 int get_epoch() const { return epoch; }
15 private:
16 std::time_t epoch;
17 };
18  
19 namespace xs {
20 template <>
21 struct Typemap<DateRecipe01a*> : TypemapObject<DateRecipe01a*, DateRecipe01a*, ObjectTypePtr, ObjectStorageIV, StaticCast> {
22 static std::string package () { return "MyTest::Cookbook::DateRecipe01a"; }
23 };
24 }
25  
26 struct DateRecipe01b {
27 DateRecipe01b() { update(false) ; }
28 ~DateRecipe01b() { std::cout << "~DateRecipe01b()\n"; }
29 void update(bool trace = true) {
30 if (trace) std::cout << "DateRecipe01b::update()\n";
31 epoch = std::time(nullptr);
32 }
33  
34 int get_epoch() const { return epoch; }
35 private:
36 std::time_t epoch;
37 };
38  
39 namespace xs {
40 template <>
41 struct Typemap<DateRecipe01b*> : TypemapObject<DateRecipe01b*, DateRecipe01b*, ObjectTypePtr, ObjectStorageMG, StaticCast> {
42 static std::string package () { return "MyTest::Cookbook::DateRecipe01b"; }
43 };
44 }
45  
46  
47 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::DateRecipe01a
48 PROTOTYPES: DISABLE
49  
50 0 DateRecipe01a* DateRecipe01a::new() { RETVAL = new DateRecipe01a(); }
51 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
52 0 ▶void DateRecipe01a::update()
Branch: 4 branches
BranchTrueFalseTotal
void DateRecipe01a::update() 0 0 0
void DateRecipe01a::update() 0 0 0
void DateRecipe01a::update() 0 0 0
void DateRecipe01a::update() 0 0 0
53  
54 0 std::time_t DateRecipe01a::get_epoch()
55 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
56 void DateRecipe01a::DESTROY() {
57 0 ▶ std::cout << "xs-adapter MyTest::Cookbook::DateRecipe01a::DESTROY\n";
Branch: 1 branch
BranchTrueFalseTotal
std::cout << "xs-adapter MyTest::Cookbook::DateRecipe01a::DESTROY\n"; 0 0 0
58 0 ▶}
Branch: 1 branch
BranchTrueFalseTotal
} 0 0 0
59  
60 MODULE = MyTest::Cookbook PACKAGE = MyTest::Cookbook::DateRecipe01b
61 PROTOTYPES: DISABLE
62  
63 0 DateRecipe01b* DateRecipe01a::new() { RETVAL = new DateRecipe01b(); }
64 0 ▶ 
Branch: 1 branch
BranchTrueFalseTotal
0 0 0
65 0 ▶void DateRecipe01b::update()
Branch: 4 branches
BranchTrueFalseTotal
void DateRecipe01b::update() 0 0 0
void DateRecipe01b::update() 0 0 0
void DateRecipe01b::update() 0 0 0
void DateRecipe01b::update() 0 0 0
66  
67 0 std::time_t DateRecipe01b::get_epoch()
« src/xs/typemap/string.h ↑ Summary t/cookbook/recipe03.xsi »