Testing struct (single object); fixing small bugs, etc.
[iot2.git] / iotjava / iotrmi / C++ / basics / TestClass.hpp
index 4dd11ff1cc3eb6c93edaac6faa6180becec9174c..1892ca068b8c464cfe3b4dadd3bb4de1fdb2bdd2 100644 (file)
@@ -48,6 +48,9 @@ class TestClass : public TestClassInterface {
                vector<Enum>            handleEnumArray(vector<Enum> vecEn);
                vector<Enum>            handleEnumList(vector<Enum> vecEn);
 
+               // Struct
+               Struct                          handleStruct(Struct str);
+
                int                                     getA();
                void                            setA(int _int);
                void                            setB(float _float);
@@ -290,6 +293,41 @@ vector<Enum> TestClass::handleEnumList(vector<Enum> vecEn) {
 }
 
 
+// Struct
+Struct TestClass::handleStruct(Struct str) {
+
+       cout << "Name: " << str.name << endl;
+       cout << "Value: " << str.value << endl;
+       cout << "Year: " << str.year << endl;
+
+       Struct test;
+       test.name = "Anonymous";
+       test.value = 1.33;
+       test.year = 2016;
+       str = test;
+
+       return str;
+}
+
+
+/*vector<Struct> TestClass::handleStruct(vector<Struct> vecStr) {
+
+       for (Struct str : vecStr) {
+
+               cout << "Name: " << str.name << endl;
+               cout << "Value: " << str.value << endl;
+               cout << "Year: " << str.year << endl;
+       }
+       Struct test;
+       test.name = "Anonymous";
+       test.value = 1.33;
+       test.year = 2016;
+       vecStr.push_back(test);
+
+       return vecStr;
+}*/
+
+
 string TestClass::sumArray(vector<string> newA) {
 
        string sum = "";