Refactoring type size handler; using Java types as standard
[iot2.git] / iotjava / iotrmi / C++ / sample / TestClass.hpp
1 #include <iostream>
2 #include "TestClassInterface.hpp"
3
4 using namespace std;
5
6 class TestClass : public TestClassInterface {
7         public:
8                 TestClass();
9                 TestClass(int _int, float _float, string _string);
10                 //~TestClass();
11
12                 void                            setA(int _int);
13                 void                            setB(float _float);
14                 void                            setC(string _string);
15                 //string                                sumArray(vector<string> newA);
16                 int64_t                         sumArray(vector<int> newA);
17                 int                                     setAndGetA(int newA);
18                 int                                     setACAndGetA(string newC, int newA);
19                 //void                          registerCallback(CallBackInterface _cb);
20                 //int                           callBack();
21
22         private:                
23                 int                                     intA;
24                 float                           floatB;
25                 string                          stringC;
26                 //CallBackInterface cb;
27
28 };
29
30
31 TestClass::TestClass() {
32
33         intA = 1;
34         floatB = 2;
35         stringC = "345";
36         //cb = NULL;
37 }
38
39
40 TestClass::TestClass(int _int, float _float, string _string) {
41
42         intA = _int;
43         floatB = _float;
44         stringC = _string;
45         //cb = NULL;
46 }
47
48
49 void TestClass::setA(int _int) {
50
51         intA = _int;
52 }
53
54
55 void TestClass::setB(float _float) {
56
57         floatB = _float;
58 }
59
60
61 void TestClass::setC(string _string) {
62
63         stringC = _string;
64 }
65
66
67 /*string TestClass::sumArray(vector<string> newA) {
68
69         string sum = "";
70         int len = newA.size();
71         for(int c = 0; c < len; c++) {
72                 sum = sum + newA[c];
73         }
74         return sum;
75 }*/
76
77
78 int64_t TestClass::sumArray(vector<int> newA) {
79
80         int64_t sum = 0;
81         int len = newA.size();
82         for(int c = 0; c < len; c++) {
83                 sum = sum + newA[c];
84         }
85         return sum;
86 }
87
88
89 int TestClass::setAndGetA(int newA) {
90
91         intA = newA;
92         return intA;
93 }
94
95
96 int TestClass::setACAndGetA(string newC, int newA) {
97
98         stringC = newC;
99         intA = newA;
100         return intA;
101 }
102
103
104 /*void TestClass::registerCallback(CallBackInterface _cb) {
105
106         cb = _cb;
107 }
108
109
110 int TestClass::callBack() {
111
112         return cb.printInt();
113 }*/
114