Completing stub and skeleton sides' APIs; Adding tests for C++ side; Still need to...
[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                 int                                     setAndGetA(int newA);
17                 int                                     setACAndGetA(string newC, int newA);
18                 //void                          registerCallback(CallBackInterface _cb);
19                 //int                           callBack();
20
21         private:                
22                 int                                     intA;
23                 float                           floatB;
24                 string                          stringC;
25                 //CallBackInterface cb;
26
27 };
28
29
30 TestClass::TestClass() {
31
32         intA = 1;
33         floatB = 2;
34         stringC = "345";
35         //cb = NULL;
36 }
37
38
39 TestClass::TestClass(int _int, float _float, string _string) {
40
41         intA = _int;
42         floatB = _float;
43         stringC = _string;
44         //cb = NULL;
45 }
46
47
48 void TestClass::setA(int _int) {
49
50         intA = _int;
51 }
52
53
54 void TestClass::setB(float _float) {
55
56         floatB = _float;
57 }
58
59
60 void TestClass::setC(string _string) {
61
62         stringC = _string;
63 }
64
65
66 string TestClass::sumArray(vector<string> newA) {
67
68         string sum = "";
69         int len = newA.size();
70         for(int c = 0; c < len; c++) {
71                 sum = sum + newA[c];
72         }
73         return sum;
74 }
75
76
77 int TestClass::setAndGetA(int newA) {
78
79         intA = newA;
80         return intA;
81 }
82
83
84 int TestClass::setACAndGetA(string newC, int newA) {
85
86         stringC = newC;
87         intA = newA;
88         return intA;
89 }
90
91
92 /*void TestClass::registerCallback(CallBackInterface _cb) {
93
94         cb = _cb;
95 }
96
97
98 int TestClass::callBack() {
99
100         return cb.printInt();
101 }*/
102