public void SetSimpleArrayStructArray(String[] args) throws JIException, InterruptedException, UnknownHostException { JICallBuilder callObject = new JICallBuilder(true); callObject.setOpnum(21); // obtained from the IDL or TypeLib. ModifyStaticData Object results[]; JIStruct simpleStruct = new JIStruct(); simpleStruct.addMember(new Integer(5)); simpleStruct.addMember(new Double(25)); simpleStruct.addMember(new Float(2.5)); Integer shortValue = new Integer(1); JIStruct simpleArrayStruct = new JIStruct(); simpleArrayStruct.addMember(new Integer(54)); simpleArrayStruct.addMember(new Double(5)); simpleArrayStruct.addMember( JIUnsignedFactory.getUnsigned(shortValue, JIFlags.FLAG_REPRESENTATION_UNSIGNED_SHORT)); JIStruct[] structArray = new JIStruct[1]; structArray[0] = simpleStruct; simpleArrayStruct.addMember(new JIPointer(new JIArray(structArray, true))); JIStruct[] DataArray = new JIStruct[1]; DataArray[0] = simpleArrayStruct; short size = 1; callObject.addInParamAsShort(size, JIFlags.FLAG_NULL); callObject.addInParamAsArray(new JIArray(DataArray, true), JIFlags.FLAG_NULL); results = comObject.call(callObject); System.out.println("SetSimpleArrayStructArray worked!"); }
public void setConformantIntArray() throws JIException, InterruptedException, UnknownHostException { System.gc(); JICallBuilder callObject = new JICallBuilder(true); callObject.setOpnum(9); Object results[]; int i = 4; Integer[] intAry = new Integer[i]; for (int j = 0; j < i; j++) { intAry[j] = new Integer(j); } JIArray ary = new JIArray(intAry, true); callObject.addInParamAsInt(i, JIFlags.FLAG_NULL); callObject.addInParamAsArray(ary, JIFlags.FLAG_NULL); results = comObject.call(callObject); }
public void SetStaticStruct(String[] args) throws JIException, InterruptedException, UnknownHostException { JICallBuilder callObject = new JICallBuilder(true); callObject.setOpnum(16); // obtained from the IDL or TypeLib. Object results[]; JIUnsignedShort j; Long value = new Long(10); Integer shortValue = new Integer(5); JIStruct varStruct = new JIStruct(); varStruct.addMember( JIUnsignedFactory.getUnsigned(value, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT)); varStruct.addMember(new Float(1.1)); varStruct.addMember(new Float(1.2)); varStruct.addMember( JIUnsignedFactory.getUnsigned(shortValue, JIFlags.FLAG_REPRESENTATION_UNSIGNED_SHORT)); varStruct.addMember(new Float(1.0)); varStruct.addMember(new Date()); varStruct.addMember( JIUnsignedFactory.getUnsigned(value, JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT)); JIStruct pointStruct = new JIStruct(); pointStruct.addMember( JIUnsignedFactory.getUnsigned(new Long(15), JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT)); pointStruct.addMember( JIUnsignedFactory.getUnsigned(new Long(10), JIFlags.FLAG_REPRESENTATION_UNSIGNED_INT)); pointStruct.addMember(new Byte((byte) 1)); JIStruct[] varStructArray = new JIStruct[1]; varStructArray[0] = varStruct; pointStruct.addMember( new JIPointer(new JIArray(varStructArray, true))); // since this is an embedded pointer JIStruct[] pointAry = new JIStruct[1]; pointAry[0] = pointStruct; JIArray ary = new JIArray(pointAry, true); callObject.addInParamAsShort((short) 1, JIFlags.FLAG_REPRESENTATION_UNSIGNED_SHORT); callObject.addInParamAsArray(ary, JIFlags.FLAG_NULL); results = comObject.call(callObject); System.out.println("SetStaticStruct worked!"); }