3 #include "TestClassComplete_Stub.hpp"
4 #include "CallBack.hpp"
8 int main(int argc, char *argv[])
12 const char* address = "localhost";
13 //const char* address = "128.195.136.170"; // dc-9.calit2.uci.edu
17 ports.push_back(12345);
19 TestClassComplete *tcStub = new TestClassComplete_Stub(port, address, rev, &bResult, ports);
20 cout << "==== ENUM ====" << endl;
23 Enum res = tcStub->handleEnum(en);
24 cout << "Return value: " << res << endl;
25 Enum resComp = tcStub->handleEnumComplex(en, 23, 'c');
26 cout << "Return value: " << resComp << endl;*/
28 vecEn.push_back(APPLE);
29 vecEn.push_back(ORANGE);
30 vecEn.push_back(APPLE);
31 vecEn.push_back(GRAPE);
32 /* vector<Enum> vecRes = tcStub->handleEnumArray(vecEn);
33 for (Enum en : vecRes) {
34 cout << "Enum value: " << en << endl;
36 vector<Enum> vecRes2 = tcStub->handleEnumList(vecEn);
37 for (Enum en : vecRes2) {
38 cout << "Enum value: " << en << endl;
40 vector<Enum> vecRes3 = tcStub->handleEnumComplex2(vecEn, 23, 'c');
41 for (Enum en : vecRes3) {
42 cout << "Enum value: " << en << endl;
46 cout << "==== STRUCT ====" << endl;
51 /* Struct resStr = tcStub->handleStruct(str);
52 cout << "Name: " << resStr.name << endl;
53 cout << "Value:" << resStr.value << endl;
54 cout << "Year" << resStr.year << endl;
55 Struct resStr2 = tcStub->handleStructComplex(23, 'c', str);
56 cout << "Name: " << resStr2.name << endl;
57 cout << "Value:" << resStr2.value << endl;
58 cout << "Year" << resStr2.year << endl;*/
60 str2.name = "Trimananda";
63 vector<Struct> vecStr;
64 vecStr.push_back(str);
65 vecStr.push_back(str2);
66 /* vector<Struct> vecRetStr = tcStub->handleStructArray(vecStr);
67 for (Struct st : vecRetStr) {
68 cout << "Name: " << st.name << endl;
69 cout << "Value: " << st.value << endl;
70 cout << "Year: " << st.year << endl;
72 vector<Struct> vecRetStr2 = tcStub->handleStructList(vecStr);
73 for (Struct st : vecRetStr2) {
74 cout << "Name: " << st.name << endl;
75 cout << "Value: " << st.value << endl;
76 cout << "Year: " << st.year << endl;
78 vector<Struct> vecRetStr3 = tcStub->handleStructComplex2(23, 'c', vecStr);
79 for (Struct st : vecRetStr3) {
80 cout << "Name: " << st.name << endl;
81 cout << "Value:" << st.value << endl;
82 cout << "Year" << st.year << endl;
84 vector<Enum> vecRes4 = tcStub->handleEnumStruct(vecEn, vecStr, 'c');
85 for (Enum en : vecRes4) {
86 cout << "Enum value: " << en << endl;
89 /* cout << "==== CALLBACK ====" << endl;
90 CallBackInterface *cbSingle = new CallBack(2354);
91 tcStub->registerCallback(cbSingle);
92 cout << "Return value from callback: " << tcStub->callBack() << endl;
93 CallBackInterface *cb1 = new CallBack(23);
94 CallBackInterface *cb2 = new CallBack(33);
95 CallBackInterface *cb3 = new CallBack(43);
96 vector<CallBackInterface*> cb;
100 tcStub->registerCallbackArray(cb);
101 cout << "Return value from callback: " << tcStub->callBack() << endl;*/
102 CallBackInterface *cb4 = new CallBack(53);
103 CallBackInterface *cb5 = new CallBack(63);
104 CallBackInterface *cb6 = new CallBack(73);
105 vector<CallBackInterface*> cblist;
106 cblist.push_back(cb4);
107 cblist.push_back(cb5);
108 cblist.push_back(cb6);
109 // tcStub->registerCallbackList(cblist);
110 // cout << "Return value from callback: " << tcStub->callBack() << endl;
111 /* tcStub->registerCallbackComplex(23, cblist, 0.1234);
112 cout << "Return value from callback: " << tcStub->callBack() << endl;
113 vector<Enum> vecRes5 = tcStub->handleAll(vecEn, vecStr, 'c', cblist);
114 for (Enum en : vecRes5) {
115 cout << "Enum value: " << en << endl;
118 vector<Enum> vecRes6 = tcStub->handleCallbackEnum(vecEn, 'c', cblist);
119 for (Enum en : vecRes6) {
120 cout << "Enum value: " << en << endl;
122 //vector<Enum> vecRes7 = tcStub->handleAllTwo(vecEn, vecStr, vecStr, vecEn, 'c', cblist, cblist);
123 /*vector<Enum> vecRes7 = tcStub->handleAllTwo(vecEn, vecEn, vecStr, vecStr, 'c', cblist, cblist);
124 for (Enum en : vecRes7) {
125 cout << "Enum value: " << en << endl;
127 vector<Enum> vecRes8 = tcStub->handleEnumTwo(vecEn, vecEn);
128 for (Enum en : vecRes8) {
129 cout << "Enum value: " << en << endl;
131 vector<Enum> vecRes9 = tcStub->handleEnumThree(vecEn, vecEn, vecStr, vecStr);
132 for (Enum en : vecRes9) {
133 cout << "Enum value: " << en << endl;
135 vector<Struct> vecRetStr2 = tcStub->handleStructTwo(vecStr, vecStr);
136 for (Struct st : vecRetStr2) {
137 cout << "Name: " << st.name << endl;
138 cout << "Value: " << st.value << endl;
139 cout << "Year: " << st.year << endl;
141 vector<Struct> vecRetStr3 = tcStub->handleStructThree(vecStr, vecStr, vecStr);
142 for (Struct st : vecRetStr3) {
143 cout << "Name: " << st.name << endl;
144 cout << "Value: " << st.value << endl;
145 cout << "Year: " << st.year << endl;