PHONY += rmi
rmi:
mkdir -p $(BIN_DIR)
-# $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java
-# $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java
+ $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java
+ $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java
# mkdir -p $(BIN_DIR)/iotrmi/C++
#$(G++) iotrmi/C++/IoTSocketServer.cpp -o $(BIN_DIR)/iotrmi/C++/IoTSocketServer.out
#$(G++) iotrmi/C++/IoTSocketClient.cpp -o $(BIN_DIR)/iotrmi/C++/IoTSocketClient.out
mkdir -p $(BIN_DIR)/iotrmi/C++/sample
#$(G++) iotrmi/C++/sample/CallBackInterface.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBackInterface.out --std=c++11
#$(G++) iotrmi/C++/sample/CallBack.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack.out --std=c++11
- $(G++) iotrmi/C++/sample/CallBack_CBStub.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBStub.out --std=c++11
- $(G++) iotrmi/C++/sample/CallBack_CBSkeleton.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBSkeleton.out --std=c++11
- $(G++) iotrmi/C++/sample/CallBack_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Stub.out --std=c++11
- $(G++) iotrmi/C++/sample/CallBack_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Skeleton.out --std=c++11
+# $(G++) iotrmi/C++/sample/CallBack_CBStub.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBStub.out --std=c++11
+# $(G++) iotrmi/C++/sample/CallBack_CBSkeleton.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBSkeleton.out --std=c++11
+# $(G++) iotrmi/C++/sample/CallBack_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Stub.out --std=c++11
+# $(G++) iotrmi/C++/sample/CallBack_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Skeleton.out --std=c++11
#$(G++) iotrmi/C++/sample/TestClass.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass.out --std=c++11
- $(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread
- $(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread
+# $(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread
+# $(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread
#$(G++) iotrmi/C++/sample/Test.cpp -o ../bin/iotrmi/C++/sample/Test.out --std=c++11 -lpthread
#$(G++) iotrmi/C++/sample/Test2.cpp -o ../bin/iotrmi/C++/sample/Test2.out --std=c++11 -pthread -pg
# $(G++) iotrmi/C++/sample/StructC.cpp -o ../bin/iotrmi/C++/sample/StructC.out --std=c++11
+# $(G++) iotrmi/C++/sample/EnumC.cpp -o ../bin/iotrmi/C++/sample/EnumC.out --std=c++11
PHONY += run-rmiserver
--- /dev/null
+#include <iostream>
+#include <vector>
+#include "EnumC.hpp"
+
+int main(int argc, char *argv[]) {
+
+ // Enum to integer
+ EnumC en = APPLE;
+ int enum1 = (int) en;
+ cout << "Enum 1: " << enum1 << endl;
+ EnumC en2 = ORANGE;
+ int enum2 = (int) en2;
+ cout << "Enum 2: " << enum2 << endl;
+ EnumC en3 = GRAPE;
+ int enum3 = (int) en3;
+ cout << "Enum 3: " << enum3 << endl;
+
+ // Integer to enum
+ cout << "Enum 1: " << (EnumC) enum1 << endl;
+ cout << "Enum 2: " << (EnumC) enum2 << endl;
+ cout << "Enum 3: " << (EnumC) enum3 << endl;
+
+ return 0;
+}
--- /dev/null
+#ifndef _ENUMC_HPP__
+#define _ENUMC_HPP__
+
+using namespace std;
+
+enum EnumC {
+ APPLE,
+ ORANGE,
+ GRAPE
+} enumC;
+
+#endif
+
void registerCallback(vector<CallBackInterface*> _cb);
int callBack();
void handleStruct(vector<data> vecData);
+ void handleEnum(vector<EnumC> vecEn);
private:
int intA;
}
+void TestClass::handleEnum(vector<EnumC> vecEn) {
+
+ for (EnumC en : vecEn) {
+ cout << "Enum: " << en << endl;
+ }
+}
+
+
//int TestClass::callBack() {
// return cb.printInt();
//}
#include <vector>
#include "CallBackInterface.hpp"
#include "StructC.hpp"
+#include "EnumC.hpp"
using namespace std;
virtual void registerCallback(vector<CallBackInterface*> _cb) = 0;
virtual int callBack() = 0;
virtual void handleStruct(vector<data> vecData) = 0;
+ virtual void handleEnum(vector<EnumC> vecEn) = 0;
};
#endif
void registerCallback(vector<CallBackInterface*> _cb);
int callBack();
void handleStruct(vector<data> vecData);
+ void handleEnum(vector<EnumC> vecEn);
void ___setA();
void ___setB();
// For array of structs
int ___structSize();
void ___handleStruct(int structsize1);
+ int ___enumSize();
+ void ___handleEnum(int enumsize1);
const static int size = 12;
const static string methodSignatures[size];
}
+void TestClass_Skeleton::handleStruct(vector<data> vecData) {
+
+ tc->handleStruct(vecData);
+}
+
+
int TestClass_Skeleton::___structSize() {
string paramCls[] = { "int" };
}
-void TestClass_Skeleton::handleStruct(vector<data> vecData) {
-
- tc->handleStruct(vecData);
-}
-
-
void TestClass_Skeleton::___handleStruct(int structsize1) {
string paramCls[3*structsize1];
}
+void TestClass_Skeleton::handleEnum(vector<EnumC> vecEn) {
+
+ tc->handleEnum(vecEn);
+}
+
+
+int TestClass_Skeleton::___enumSize() {
+
+ string paramCls[] = { "int" };
+ int numParam = 1;
+ int param1 = 0;
+ void* paramObj[] = { ¶m1 };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ return param1;
+}
+
+
+void TestClass_Skeleton::___handleEnum(int enumsize1) {
+
+ string paramCls[enumsize1];
+ void* paramObj[enumsize1];
+ int numParam = enumsize1;
+ // define array of everything
+ int param1[enumsize1];
+ for(int i=0; i < enumsize1; i++) {
+ paramCls[i] = "int";
+ paramObj[i] = ¶m1[i];
+ }
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ vector<EnumC> en(enumsize1);
+ for (int i=0; i < enumsize1; i++) {
+ en[i] = (EnumC) param1[i];
+ }
+ handleEnum(en);
+}
+
+
void TestClass_Skeleton::___waitRequestInvokeMethod() {
int structsize1 = 0;
+ int enumsize1 = 0;
// Loop continuously waiting for incoming bytes
while (true) {
// Handle struct
case 10: ___handleStruct(structsize1); break;
case 11: structsize1 = ___structSize(); break;
+ case 12: ___handleEnum(enumsize1); break;
+ case 13: enumsize1 = ___enumSize(); break;
default:
string error = "Method Id not recognized!";
throw error;
cout << "Return value: " << tcStub->sumArray(input) << endl;
- CallBackInterface *cb1 = new CallBack(23);
+ /*CallBackInterface *cb1 = new CallBack(23);
CallBackInterface *cb2 = new CallBack(33);
CallBackInterface *cb3 = new CallBack(43);
vector<CallBackInterface*> cb;
delete tcStub;
delete cb1;
delete cb2;
- delete cb3;
+ delete cb3;*/
+
+ vector<EnumC> vecEn;
+ vecEn.push_back(APPLE);
+ vecEn.push_back(ORANGE);
+ vecEn.push_back(APPLE);
+ vecEn.push_back(GRAPE);
+ tcStub->handleEnum(vecEn);
return 0;
}
void registerCallback(vector<CallBackInterface*>_cb);
int callBack();
void handleStruct(vector<data> vecData);
+ void handleEnum(vector<EnumC> vecEn);
void ____init_CallBack(); // thread
void ____registerCallBack(); // tell the other side that we are ready
paramObj2[pos] = &vecData[i].year; pos++;
}
void* retObj2 = NULL;
- cout << "In handle struct 3!" << endl;
rmiCall->remoteCall(objectId, methodId2, retType2, paramCls2, paramObj2, numParam2, retObj2);
}
+void TestClass_Stub::handleEnum(vector<EnumC> vecEn) {
+
+ int numParam = 1;
+ int methodId = 13;
+ string retType = "void";
+ string paramCls[] = { "int" };
+ int enumsize = vecEn.size();
+ void* paramObj[] = { &enumsize };
+ void* retObj = NULL;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+
+ int numParam2 = vecEn.size();
+ int methodId2 = 12;
+ string retType2 = "void";
+ string paramCls2[numParam2];
+ // Need to define this container for integer version of enum
+ int paramEnum[numParam2];
+ void* paramObj2[numParam2];
+ for(int i = 0; i < vecEn.size(); i++) {
+ paramCls2[i] = "int";
+ paramEnum[i] = (int) vecEn[i]; // cast enum to integer
+ paramObj2[i] = ¶mEnum[i];
+ }
+ void* retObj2 = NULL;
+ rmiCall->remoteCall(objectId, methodId2, retType2, paramCls2, paramObj2, numParam2, retObj2);
+}
+
+
+
#endif
/**
* remoteCall() calls a method remotely by passing in parameters and getting a return Object
*/
- public synchronized Object remoteCall(int objectId, int methodId, Class<?> retType, Class<?> retGenTypeKey,
+ public synchronized Object remoteCall(int objectId, int methodId, Class<?> retType,
Class<?> retGenTypeVal, Class<?>[] paramCls, Object[] paramObj) {
// Send method info
throw new Error("IoTRMICall: Error when receiving bytes - rmiClient.receiveBytes()");
}
System.out.println("Return object bytes: " + Arrays.toString(retObjBytes));
- retObj = IoTRMIUtil.getParamObject(retType, retGenTypeKey, retGenTypeVal, retObjBytes);
+ retObj = IoTRMIUtil.getParamObject(retType, retGenTypeVal, retObjBytes);
}
return retObj;
}
Boolean[] c2 = (Boolean[]) IoTRMIUtil.getParamObjectArray(Boolean[].class, b2);
System.out.println(Arrays.toString(c2));
- // Set
- /*Set<String> set = new HashSet<String>();
- set.add("1234");
- set.add("5678");
-
- byte[] objBytes = IoTRMIUtil.getObjectBytes(set);
- System.out.println(Arrays.toString(objBytes));
- Object obj = IoTRMIUtil.getParamObject(Set.class, null, String.class, objBytes);
-
- @SuppressWarnings("unchecked")
- Set<String> setStr = (Set<String>) obj;
- System.out.println("Set: " + setStr.toString());*/
-
// List
/*List<Long> list = new ArrayList<Long>();
list.add(12345678l);
List<Long> listStr = (List<Long>) obj;
System.out.println("List: " + listStr.toString());*/
- // Map
- Map<Long,Integer> map = new HashMap<Long,Integer>();
- map.put(12345678l, 1234);
- map.put(23455432l, 5678);
- map.put(34566543l, 4321);
-
- byte[] objBytes = IoTRMIUtil.getObjectBytes(map);
- System.out.println(Arrays.toString(objBytes));
- Object obj = IoTRMIUtil.getParamObject(Map.class, Long.class, Integer.class, objBytes);
-
- map = (Map<Long,Integer>) obj;
- System.out.println("Received map: " + map.toString());
-
//@SuppressWarnings("unchecked")
//List<Long> listStr = (List<Long>) obj;
//System.out.println("List: " + listStr.toString());
* | 32-bit object ID | 32-bit method ID | 32-bit length | n-bit actual data | ...
*
*/
- public Object[] getMethodParams(Class<?>[] arrCls, Class<?>[] arrGenKeyCls, Class<?>[] arrGenValCls) {
+ public Object[] getMethodParams(Class<?>[] arrCls, Class<?>[] arrGenValCls) {
// Byte scanning position
int pos = IoTRMIUtil.OBJECT_ID_LEN + IoTRMIUtil.METHOD_ID_LEN;
byte[] paramBytes = new byte[paramSize];
System.arraycopy(methodBytes, pos, paramBytes, 0, paramSize);
pos = pos + paramSize;
- paramObj[i] = IoTRMIUtil.getParamObject(arrCls[i], arrGenKeyCls[i],
- arrGenValCls[i], paramBytes);
+ paramObj[i] = IoTRMIUtil.getParamObject(arrCls[i], arrGenValCls[i], paramBytes);
}
return paramObj;
/**
* getParamObject() converts byte array of certain object type into Object
*/
- public static Object getParamObject(Class<?> type, Class<?> genTypeKey, Class<?> genTypeVal, byte[] paramBytes) {
+ public static Object getParamObject(Class<?> type, Class<?> genTypeVal, byte[] paramBytes) {
Object retObj = null;
if (type == byte.class ||
// Array
} else if (type.isArray()) {
retObj = getParamObjectArray(type, paramBytes);
- // Set
- // e.g. Set<String> - type = Set.class, genTypeVal = String.class
- /*} else if (type == Set.class) {
- retObj = getParamSetObject(genTypeVal, paramBytes);*/
// List
} else if (type == List.class) {
retObj = getParamListObject(genTypeVal, paramBytes);
- // Map
- // e.g. Map<String,Integer> - type = Map.class, genTypeKey = String.class, genTypeVal = Integer.class
- /*} else if (type == Map.class) {
- retObj = getParamMapObject(genTypeKey, genTypeVal, paramBytes);*/
} else
throw new Error("IoTRMIUtil: Unrecognizable type: " + type.getName());
public void ___setInt(IoTRMIObject rmiObj) {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
setInt((int) paramObj[0]);
}
Class<?> retType = int.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
return (int)retObj;
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { int.class };
Object[] paramObj = new Object[] { _i };
- rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
}
public void ___setInt() {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
setInt((int) paramObj[0]);
}
Class<?> retType = int.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
return (int)retObj;
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { int.class };
Object[] paramObj = new Object[] { _i };
- rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
}
--- /dev/null
+package iotrmi.Java.sample;
+
+public enum EnumJ {
+
+ APPLE,
+ ORANGE,
+ GRAPE
+}
--- /dev/null
+package iotrmi.Java.sample;
+
+public class EnumMain {
+
+ public static void main (String[] args) {
+
+ // Enum to int
+ int enum1 = EnumJ.APPLE.ordinal();
+ System.out.println("Enum 1: " + enum1);
+ int enum2 = EnumJ.ORANGE.ordinal();
+ System.out.println("Enum 2: " + enum2);
+ int enum3 = EnumJ.GRAPE.ordinal();
+ System.out.println("Enum 3: " + enum3);
+
+ // Int to enum
+ EnumJ[] enumJ = EnumJ.values();
+ System.out.println("Enum 1: " + enumJ[enum1]);
+ System.out.println("Enum 1: " + enumJ[enum2]);
+ System.out.println("Enum 1: " + enumJ[enum3]);
+ }
+}
}
+ public void handleEnum(EnumJ[] en) {
+
+ for (EnumJ e : en) {
+ System.out.println("Enum: " + e);
+ }
+ }
+
+
public static void main(String[] args) {
//TestClass tc = new TestClass();
public void registerCallback(CallBackInterface[] _cb);
public int callBack();
public void handleStruct(StructJ[] data);
+ public void handleEnum(EnumJ[] en);
}
public void ___setA() {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
setA((int) paramObj[0]);
}
public void ___setB() {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { float.class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
setB((float) paramObj[0]);
}
public void ___setC() {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { String.class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
setC((String) paramObj[0]);
}
public void ___sumArray() throws IOException {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { String[].class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
Object retObj = sumArray((String[]) paramObj[0]);
rmiObj.sendReturnObj(retObj);
}
public void ___setAndGetA() throws IOException {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
Object retObj = setAndGetA((int) paramObj[0]);
rmiObj.sendReturnObj(retObj);
}
public void ___setACAndGetA() throws IOException {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { String.class, int.class },
- new Class<?>[] { null, null }, new Class<?>[] { null, null });
+ new Class<?>[] { null, null });
Object retObj = setACAndGetA((String) paramObj[0], (int) paramObj[1]);
rmiObj.sendReturnObj(retObj);
}
public void ___registerCallback() throws IOException {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class, String.class, int.class },
- new Class<?>[] { null, null, null }, new Class<?>[] { null, null, null });
+ new Class<?>[] { null, null, null });
CallBackInterface cbstub = new CallBack_Stub((int) paramObj[0], (String) paramObj[1], (int) paramObj[2]);
registerCallback((CallBackInterface) cbstub);
}
public void ____registerCallback() throws IOException {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
int numStubs = (int) paramObj[0];
CallBackInterface[] stub = new CallBackInterface[numStubs];
for (int objId = 0; objId < numStubs; objId++) {
public void ___regCB() throws IOException {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class, String.class, int.class },
- new Class<?>[] { null, null, null }, new Class<?>[] { null, null, null });
+ new Class<?>[] { null, null, null });
//String[] methodSignatures = CallBack_CBStub.getMethodSignatures();
rmiCall = new IoTRMICall((int) paramObj[0], (String) paramObj[1], (int) paramObj[2]);
System.out.println("Creating a new IoTRMICall object");
public int ___structSize() {
Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
- new Class<?>[] { null }, new Class<?>[] { null });
+ new Class<?>[] { null });
return (int) paramObj[0];
}
public void ___handleStruct(int structsize1) {
Class<?>[] paramCls = new Class<?>[3*structsize1];
- Class<?>[] paramClsTyp1 = new Class<?>[3*structsize1];
- Class<?>[] paramClsTyp2 = new Class<?>[3*structsize1];
+ Class<?>[] paramClsVal = new Class<?>[3*structsize1];
int pos = 0;
for(int i=0; i < structsize1; i++) {
paramCls[pos] = String.class;
- paramClsTyp1[pos] = null;
- paramClsTyp2[pos++] = null;
+ paramClsVal[pos++] = null;
paramCls[pos] = float.class;
- paramClsTyp1[pos] = null;
- paramClsTyp2[pos++] = null;
+ paramClsVal[pos++] = null;
paramCls[pos] = int.class;
- paramClsTyp1[pos] = null;
- paramClsTyp2[pos++] = null;
+ paramClsVal[pos++] = null;
}
Object[] paramObj = rmiObj.getMethodParams(paramCls,
- paramClsTyp1, paramClsTyp2);
+ paramClsVal);
StructJ[] data = new StructJ[structsize1];
for (int i=0; i < structsize1; i++) {
data[i] = new StructJ();
}
tc.handleStruct(data);
}
+
+
+ public void handleEnum(EnumJ[] en) {
+
+ tc.handleEnum(en);
+ }
+
+
+ public int ___enumSize() {
+
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
+ new Class<?>[] { null });
+ return (int) paramObj[0];
+ }
+
+
+ public void ___handleEnum(int enumSize1) {
+
+ Class<?>[] paramCls = new Class<?>[enumSize1];
+ Class<?>[] paramClsVal = new Class<?>[enumSize1];
+ for(int i=0; i < enumSize1; i++) {
+ paramCls[i] = int.class;
+ paramClsVal[i] = null;
+ }
+ Object[] paramObj = rmiObj.getMethodParams(paramCls,
+ paramClsVal);
+ // Encoder/decoder
+ EnumJ[] enumJ = EnumJ.values();
+ EnumJ[] data = new EnumJ[enumSize1];
+ for (int i=0; i < enumSize1; i++) {
+ data[i] = enumJ[(int) paramObj[i]];
+ }
+ tc.handleEnum(data);
+ }
private void ___waitRequestInvokeMethod() throws IOException {
// Struct size
- int structsize1 = 0;
+ int structSize1 = 0;
+ int enumSize1 = 0;
// Loop continuously waiting for incoming bytes
while (true) {
// Special option to register callback
case 9: ___regCB(); break;
// Struct handling (3 is the size of the struct)
- case 10: ___handleStruct(structsize1); break;
- case 11: structsize1 = ___structSize(); break;
+ case 10: ___handleStruct(structSize1); break;
+ case 11: structSize1 = ___structSize(); break;
+ case 12: ___handleEnum(enumSize1); break;
+ case 13: enumSize1 = ___enumSize(); break;
default:
throw new Error("Method Id not recognized!");
}
Class<?>[] paramCls = new Class<?>[] { int.class, String.class, int.class };
Object[] paramObj = new Object[] { ports[0], address, 0 };
//rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
- rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
}
Class<?>[] paramCls = new Class<?>[] { int.class };
Object[] paramObj = new Object[] { _cb.length };
//rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
- rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { int.class };
Object[] paramObj = new Object[] { _int };
- rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { float.class };
Object[] paramObj = new Object[] { _float };
- rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { String.class };
Object[] paramObj = new Object[] { _string };
- rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
}
Class<?> retType = String.class;
Class<?>[] paramCls = new Class<?>[] { String[].class };
Object[] paramObj = new Object[] { newA };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
return (String)retObj;
}
Class<?> retType = int.class;
Class<?>[] paramCls = new Class<?>[] { int.class };
Object[] paramObj = new Object[] { newA };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
return (int)retObj;
}
Class<?> retType = int.class;
Class<?>[] paramCls = new Class<?>[] { String.class, int.class };
Object[] paramObj = new Object[] { newC, newA };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
return (int)retObj;
}
Class<?> retType = int.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
return (int)retObj;
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { int.class };
Object[] paramObj = new Object[] { data.length };
- rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
int methodId2 = 10;
Class<?> retType2 = void.class;
paramObj2[pos++] = data[i].year;
}
System.out.println(Arrays.toString(paramObj2));
- rmiCall.remoteCall(objectId, methodId2, retType2, null, null, paramCls2, paramObj2);
+ rmiCall.remoteCall(objectId, methodId2, retType2, null, paramCls2, paramObj2);
+ }
+
+
+ public void handleEnum(EnumJ[] en) {
+
+ // Send length info first
+ int methodId = 13;
+ Class<?> retType = void.class;
+ Class<?>[] paramCls = new Class<?>[] { int.class };
+ Object[] paramObj = new Object[] { en.length };
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+
+ int methodId2 = 12;
+ Class<?> retType2 = void.class;
+ // Calculate the size of the array
+ Class<?>[] paramCls2 = new Class<?>[en.length];
+ Object[] paramObj2 = new Object[en.length];
+ // Handle with for loop
+ for(int i = 0; i < en.length; i++) {
+ paramCls2[i] = int.class;
+ paramObj2[i] = en[i].ordinal();
+ }
+ System.out.println(Arrays.toString(paramObj2));
+ rmiCall.remoteCall(objectId, methodId2, retType2, null, paramCls2, paramObj2);
}
System.out.println("Value: " + str.value);
System.out.println("Year: " + str.year);
}
-
tcstub.handleStruct(data);
+
+ EnumJ[] en = { EnumJ.APPLE, EnumJ.ORANGE, EnumJ.APPLE, EnumJ.GRAPE };
+ tcstub.handleEnum(en);
+
}
}