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