示例#1
0
  // [helpstring("20 method GetSimpleArrayStructArray")] HRESULT GetSimpleArrayStructArray([out]
  // unsigned short* unDataSize,
  //    [out, size_is(,*unDataSize)] SimpleArrayStruct** pp);
  public void GetSimpleArrayStructArray(String[] args)
      throws JIException, InterruptedException, UnknownHostException {

    JICallBuilder callObject = new JICallBuilder(true);
    callObject.setOpnum(20); // obtained from the IDL or TypeLib. //
    Object results[];

    JIStruct simpleStruct = new JIStruct();
    simpleStruct.addMember(Integer.class);
    simpleStruct.addMember(Double.class);
    simpleStruct.addMember(Float.class);

    JIStruct simpleArrayStruct = new JIStruct();
    simpleArrayStruct.addMember(Integer.class);
    simpleArrayStruct.addMember(Double.class);
    simpleArrayStruct.addMember(JIUnsignedShort.class);
    JIArray structArray = new JIArray(simpleStruct, null, 1, true);
    simpleArrayStruct.addMember(new JIPointer(structArray)); // try no pointer next

    JIArray DataArray = new JIArray(simpleArrayStruct, null, 1, true);
    callObject.addOutParamAsType(JIUnsignedShort.class, JIFlags.FLAG_NULL);
    callObject.addOutParamAsObject(new JIPointer(DataArray), JIFlags.FLAG_NULL);

    results = comObject.call(callObject);
    System.out.println(((JIUnsignedShort) results[0]).getValue());
  }
示例#2
0
  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!");
  }
示例#3
0
  public void getSimpleStruct(String[] args)
      throws JIException, InterruptedException, UnknownHostException {

    JICallBuilder callObject = new JICallBuilder(true);
    callObject.setOpnum(12); // obtained from the IDL or TypeLib. //
    Object results[];

    JIStruct struct = new JIStruct();
    struct.addMember(Integer.class);
    struct.addMember(Double.class);
    struct.addMember(Float.class);
    callObject.addOutParamAsObject(new JIPointer(struct), JIFlags.FLAG_NULL);

    results = comObject.call(callObject);
    System.out.println(results[0]);
  }
示例#4
0
  public void getConformantStruct(String[] args)
      throws JIException, InterruptedException, UnknownHostException {

    JICallBuilder callObject = new JICallBuilder(true);
    callObject.setOpnum(14); // obtained from the IDL or TypeLib. //
    Object results[];

    JIStruct struct = new JIStruct();
    struct.addMember(Integer.class);
    struct.addMember(Double.class);
    struct.addMember(JIUnsignedShort.class);
    JIArray longArray = new JIArray(Integer.class, null, 1, true);
    struct.addMember(new JIPointer(longArray));
    callObject.addOutParamAsObject(new JIPointer(struct), JIFlags.FLAG_NULL);

    results = comObject.call(callObject);
    System.out.println(results[0]);
  }
示例#5
0
  public void GetStruct(String[] args)
      throws JIException, InterruptedException, UnknownHostException {

    JICallBuilder callObject = new JICallBuilder(true);
    callObject.setOpnum(10); // obtained from the IDL or TypeLib. //
    Object results[];

    // change the struct to have the array as the last item
    JIStruct struct = new JIStruct();
    JIArray longArray = new JIArray(Integer.class, new int[] {50}, 1, false);
    struct.addMember(Integer.class);
    struct.addMember(Float.class);
    struct.addMember(longArray);
    callObject.addOutParamAsObject(new JIPointer(struct), JIFlags.FLAG_NULL);

    results = comObject.call(callObject);
    System.out.println(results[0]);
  }
示例#6
0
  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!");
  }
示例#7
0
  // Index out of bound exception
  public void GetStaticStruct(String[] args)
      throws JIException, InterruptedException, UnknownHostException {

    JICallBuilder callObject = new JICallBuilder(true);
    callObject.setOpnum(15); // obtained from the IDL or TypeLib. //
    Object results[];

    JIStruct varStruct = new JIStruct();
    varStruct.addMember(JIUnsignedInteger.class);
    varStruct.addMember(Float.class);
    varStruct.addMember(Float.class);
    varStruct.addMember(JIUnsignedShort.class);
    varStruct.addMember(Float.class);
    varStruct.addMember(Date.class);
    varStruct.addMember(JIUnsignedInteger.class);

    JIStruct pointStruct = new JIStruct();
    pointStruct.addMember(JIUnsignedInteger.class);
    pointStruct.addMember(JIUnsignedInteger.class);
    pointStruct.addMember(Byte.class);
    JIArray structArray = new JIArray(varStruct, null, 1, true);
    pointStruct.addMember(new JIPointer(structArray));

    JIArray DataArray = new JIArray(pointStruct, null, 1, true);
    callObject.addOutParamAsType(JIUnsignedShort.class, JIFlags.FLAG_NULL);
    callObject.addOutParamAsObject(new JIPointer(DataArray, false), JIFlags.FLAG_NULL);

    results = comObject.call(callObject);
    System.out.println(((JIUnsignedShort) results[0]).getValue());
  }
示例#8
0
  FuncDesc(JIStruct filledStruct) {
    if (filledStruct == null) {
      values = null;
      memberId = -1;
      lprgscode = null;
      lprgelemdescParam = null;
      funcKind = -1;
      invokeKind = -1;
      callConv = -1;
      cParams = -1;
      cParamsOpt = -1;
      oVft = -1;
      cScodes = -1;
      elemdescFunc = null;
      wFuncFlags = -1;
      return;
    }
    values = filledStruct;
    memberId = ((Integer) values.getMember(0)).intValue();
    lprgscode = (JIPointer) values.getMember(1);
    JIPointer ptr = (JIPointer) values.getMember(2);
    JIArray arrayOfElemDesc = null;
    if (!ptr.isNull()) {
      JIArray arry = (JIArray) ptr.getReferent();
      Object[] obj = (Object[]) arry.getArrayInstance();
      //			ElemDesc[] arry2 = new ElemDesc[obj.length];
      //			for (int i = 0; i < obj.length; i++)
      //			{
      //				arry2[i] = new ElemDesc((JIStruct)obj[i]);
      //			}

      //			arrayOfElemDesc = new JIArray(arry2);
      arrayOfElemDesc = new JIArray(obj);
    }

    lprgelemdescParam = new JIPointer(arrayOfElemDesc);
    funcKind = ((Integer) values.getMember(3)).intValue();
    invokeKind = ((Integer) values.getMember(4)).intValue();
    callConv = ((Integer) values.getMember(5)).intValue();
    cParams = ((Short) values.getMember(6)).shortValue();
    cParamsOpt = ((Short) values.getMember(7)).shortValue();
    oVft = ((Short) values.getMember(8)).shortValue();
    cScodes = ((Short) values.getMember(9)).shortValue();
    elemdescFunc = new ElemDesc(((JIStruct) values.getMember(10)));
    wFuncFlags = ((Short) values.getMember(11)).shortValue();
  }