TestClassInterface *tc = new TestClass();
cout << "Return value: " << tc->setAndGetA(123) << endl;
cout << "Return value: " << tc->setACAndGetA("string", 123) << endl;
- /*vector<string> input;
+ vector<string> input;
input.push_back("123");
input.push_back("456");
- input.push_back("987");*/
- vector<int> input;
+ input.push_back("987");
+ /*vector<int> input;
input.push_back(123);
input.push_back(456);
- input.push_back(987);
+ input.push_back(987);*/
cout << "Return value: " << tc->sumArray(input) << endl;
void setA(int _int);
void setB(float _float);
void setC(string _string);
- //string sumArray(vector<string> newA);
- int64_t sumArray(vector<int> newA);
+ string sumArray(vector<string> newA);
+ //int64_t sumArray(vector<int> newA);
int setAndGetA(int newA);
int setACAndGetA(string newC, int newA);
//void registerCallback(CallBackInterface _cb);
}
-/*string TestClass::sumArray(vector<string> newA) {
+string TestClass::sumArray(vector<string> newA) {
string sum = "";
int len = newA.size();
sum = sum + newA[c];
}
return sum;
-}*/
+}
-int64_t TestClass::sumArray(vector<int> newA) {
+/*int64_t TestClass::sumArray(vector<int> newA) {
int64_t sum = 0;
int len = newA.size();
sum = sum + newA[c];
}
return sum;
-}
+}*/
int TestClass::setAndGetA(int newA) {
virtual void setA(int _int) = 0;
virtual void setB(float _float) = 0;
virtual void setC(string _string) = 0;
- //virtual string sumArray(vector<string> newA) = 0;
- virtual int64_t sumArray(vector<int> newA) = 0;
+ virtual string sumArray(vector<string> newA) = 0;
+ //virtual int64_t sumArray(vector<int> newA) = 0;
virtual int setAndGetA(int newA) = 0;
virtual int setACAndGetA(string newC, int newA) = 0;
//virtual void registerCallback(CallBackInterface _cb);
using namespace std;
-class TestClass_Skeleton {
+class TestClass_Skeleton : public TestClassInterface {
public:
TestClass_Skeleton(TestClassInterface* _tc, int _port);
~TestClass_Skeleton();
void waitRequestInvokeMethod();
+ void setA(int _int);
+ void setB(float _float);
+ void setC(string _string);
+ string sumArray(vector<string> newA);
+ //int64_t sumArray(vector<int> newA);
+ int setAndGetA(int newA);
+ int setACAndGetA(string newC, int newA);
+ //void registerCallback(CallBackInterface _cb);
+ //int callBack();
private:
TestClassInterface *tc;
"voidsetA(int)",
"voidsetB(float)",
"voidsetC(string)",
- //"sumArray(string[])",
- "sumArray(int[])",
+ "sumArray(string[])",
+ //"sumArray(int[])",
"intsetAndGetA(int)",
"intsetACAndGetA(string,int)",
"intcallBack()",
int param1 = 0;
void* paramObj[] = { ¶m1 };
rmiObj->getMethodParams(paramCls, numParam, paramObj);
- tc->setA(param1);
+ setA(param1);
} else if (methodSign.compare("voidsetB(float)") == 0) {
string paramCls[] = { "float" };
int numParam = 1;
float param1 = 0.0;
void* paramObj[] = { ¶m1 };
rmiObj->getMethodParams(paramCls, numParam, paramObj);
- tc->setB(param1);
+ setB(param1);
} else if (methodSign.compare("voidsetC(string)") == 0) {
string paramCls[] = { "string" };
int numParam = 1;
string param1 = "";
void* paramObj[] = { ¶m1 };
rmiObj->getMethodParams(paramCls, numParam, paramObj);
- tc->setC(param1);
- /*} else if (methodSign.compare("sumArray(string[])") == 0) {
+ setC(param1);
+ } else if (methodSign.compare("sumArray(string[])") == 0) {
string paramCls[] = { "string[]" };
int numParam = 1;
vector<string> param1;
void* paramObj[] = { ¶m1 };
rmiObj->getMethodParams(paramCls, numParam, paramObj);
- string retVal = tc->sumArray(param1);
+ string retVal = sumArray(param1);
void* retObj = &retVal;
- rmiObj->sendReturnObj(retObj, "string");*/
- } else if (methodSign.compare("sumArray(int[])") == 0) {
+ rmiObj->sendReturnObj(retObj, "string");
+ /*} else if (methodSign.compare("sumArray(int[])") == 0) {
string paramCls[] = { "int[]" };
int numParam = 1;
vector<int> param1;
void* paramObj[] = { ¶m1 };
rmiObj->getMethodParams(paramCls, numParam, paramObj);
- int64_t retVal = tc->sumArray(param1);
+ int64_t retVal = sumArray(param1);
void* retObj = &retVal;
- rmiObj->sendReturnObj(retObj, "long");
+ rmiObj->sendReturnObj(retObj, "long");*/
} else if (methodSign.compare("intsetAndGetA(int)") == 0) {
string paramCls[] = { "int" };
int numParam = 1;
int param1 = 0;
void* paramObj[] = { ¶m1 };
rmiObj->getMethodParams(paramCls, numParam, paramObj);
- int retVal = tc->setAndGetA(param1);
+ int retVal = setAndGetA(param1);
void* retObj = &retVal;
rmiObj->sendReturnObj(retObj, "int");
} else if (methodSign.compare("intsetACAndGetA(string,int)") == 0) {
int param2 = 0;
void* paramObj[] = { ¶m1, ¶m2 };
rmiObj->getMethodParams(paramCls, numParam, paramObj);
- int retVal = tc->setACAndGetA(param1, param2);
+ int retVal = setACAndGetA(param1, param2);
void* retObj = &retVal;
rmiObj->sendReturnObj(retObj, "int");
/*} else if (methodSign.compare("voidregisterCallBack(CallBackInterface)") == 0) {
}
-/*void TestClass_Stub::registerCallback(CallBackInterface _cb) {
+void TestClass_Skeleton::setA(int _int) {
- cb = _cb;
+ tc->setA(_int);
}
-int TestClass_Stub::callBack() {
+void TestClass_Skeleton::setB(float _float) {
- return cb.printInt();
+ tc->setB(_float);
+}
+
+
+void TestClass_Skeleton::setC(string _string) {
+
+ tc->setC(_string);
+}
+
+
+string TestClass_Skeleton::sumArray(vector<string> newA) {
+
+ return tc->sumArray(newA);;
+}
+
+
+/*int64_t TestClass_Skeleton::sumArray(vector<int> newA) {
+
+ return tc->sumArray(newA);
+}*/
+
+
+int TestClass_Skeleton::setAndGetA(int newA) {
+
+ return tc->setAndGetA(newA);
+}
+
+
+int TestClass_Skeleton::setACAndGetA(string newC, int newA) {
+
+ return tc->setACAndGetA(newC, newA);
+}
+
+
+/*void TestClass_Skeleton::registerCallback(CallBackInterface _cb) {
+
+ tc->registerCallback(_cb);
+}
+
+
+int TestClass_Skeleton::callBack() {
+
+ return tc->callBack();
}*/
TestClassInterface *tcStub = new TestClass_Stub(port, address, rev, &bResult);
cout << "Return value: " << tcStub->setAndGetA(123) << endl;
cout << "Return value: " << tcStub->setACAndGetA("string", 123) << endl;
- /*vector<string> input;
+ vector<string> input;
input.push_back("123");
input.push_back("456");
- input.push_back("987");*/
- vector<int> input;
+ input.push_back("987");
+ /*vector<int> input;
input.push_back(123);
input.push_back(456);
- input.push_back(987);
+ input.push_back(987);*/
cout << "Return value: " << tcStub->sumArray(input) << endl;
void setA(int _int);
void setB(float _float);
void setC(string _string);
- //string sumArray(vector<string> newA);
- int64_t sumArray(vector<int> newA);
+ string sumArray(vector<string> newA);
+ //int64_t sumArray(vector<int> newA);
int setAndGetA(int newA);
int setACAndGetA(string newC, int newA);
//void registerCallback(CallBackInterface _cb);
}
-/*string TestClass_Stub::sumArray(vector<string> newA) {
+string TestClass_Stub::sumArray(vector<string> newA) {
int numParam = 1;
string sign = "sumArray(string[])";
void* retObj = &retVal;
rmiCall->remoteCall(sign, retType, paramCls, paramObj, numParam, retObj);
return retVal;
-}*/
+}
-int64_t TestClass_Stub::sumArray(vector<int> newA) {
+/*int64_t TestClass_Stub::sumArray(vector<int> newA) {
int numParam = 1;
string sign = "sumArray(int[])";
void* retObj = &retVal;
rmiCall->remoteCall(sign, retType, paramCls, paramObj, numParam, retObj);
return retVal;
-}
+}*/
import java.util.Arrays;
-public class TestClass_Skeleton {
+public class TestClass_Skeleton implements TestClassInterface {
private String[] methodSignatures = {
if (methodSign.equals("voidsetA(int)")) {
paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
new Class<?>[] { null }, new Class<?>[] { null });
- tc.setA((int) paramObj[0]);
+ setA((int) paramObj[0]);
} else if (methodSign.equals("voidsetB(float)")) {
paramObj = rmiObj.getMethodParams(new Class<?>[] { float.class },
new Class<?>[] { null }, new Class<?>[] { null });
- tc.setB((float) paramObj[0]);
+ setB((float) paramObj[0]);
} else if (methodSign.equals("voidsetC(string)")) {
paramObj = rmiObj.getMethodParams(new Class<?>[] { String.class },
new Class<?>[] { null }, new Class<?>[] { null });
- tc.setC((String) paramObj[0]);
+ setC((String) paramObj[0]);
} else if (methodSign.equals("sumArray(string[])")) {
paramObj = rmiObj.getMethodParams(new Class<?>[] { String[].class },
new Class<?>[] { null }, new Class<?>[] { null });
- retObj = tc.sumArray((String[]) paramObj[0]);
+ retObj = sumArray((String[]) paramObj[0]);
} else if (methodSign.equals("intsetAndGetA(int)")) {
paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
new Class<?>[] { null }, new Class<?>[] { null });
- retObj = tc.setAndGetA((int) paramObj[0]);
+ retObj = setAndGetA((int) paramObj[0]);
} else if (methodSign.equals("intsetACAndGetA(string,int)")) {
paramObj = rmiObj.getMethodParams(new Class<?>[] { String.class, int.class },
new Class<?>[] { null, null }, new Class<?>[] { null, null });
- retObj = tc.setACAndGetA((String) paramObj[0], (int) paramObj[1]);
+ retObj = setACAndGetA((String) paramObj[0], (int) paramObj[1]);
} else if (methodSign.equals("voidregisterCallBack(CallBackInterface)")) {
paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class, String.class, int.class },
new Class<?>[] { null, null, null }, new Class<?>[] { null, null, null });
CallBackInterface cbstub = new CallBack_Stub((int) paramObj[0], (String) paramObj[1], (int) paramObj[2]);
- tc.registerCallback((CallBackInterface) cbstub);
+ registerCallback((CallBackInterface) cbstub);
} else if (methodSign.equals("intcallBack()")) {
- retObj = tc.callBack();
+ retObj = callBack();
} else
throw new Error("Signature un-recognized!");
System.out.println("Servicing remote call for method: " + methodSign);
}
}
+
+
+ public void setA(int _int) {
+
+ tc.setA(_int);
+ }
+
+
+ public void setB(float _float) {
+
+ tc.setB(_float);
+ }
+
+
+ public void setC(String _string) {
+
+ tc.setC(_string);
+ }
+
+
+ public String sumArray(String[] newA) {
+
+ return tc.sumArray(newA);
+ }
+
+
+ public int setAndGetA(int newA) {
+
+ return tc.setAndGetA(newA);
+ }
+
+
+ public int setACAndGetA(String newC, int newA) {
+
+ return tc.setACAndGetA(newC, newA);
+ }
+
+
+ public void registerCallback(CallBackInterface _cb) {
+
+ tc.registerCallback(_cb);
+ }
+
+
+ public int callBack() {
+
+ return tc.callBack();
+ }
public static void main(String[] args) throws Exception {
System.out.println("Return value: " + tcstub.setACAndGetA("string", 123));
System.out.println("Return value: " + tcstub.sumArray(new String[] { "123", "456", "987" }));
- CallBack cb = new CallBack(23);
+ /*CallBack cb = new CallBack(23);
tcstub.registerCallback(cb);
- System.out.println("Return value from callback: " + tcstub.callBack());
+ System.out.println("Return value from callback: " + tcstub.callBack());*/
//System.out.println("Return value: " + tcstub.setAndGetA(1234));
}
}