//This file is automatically generated. DO NOT EDIT!
package com.robotraconteur.testing.TestService3;
import java.util.*;
import com.robotraconteur.*;
public class testpod1_stub extends PodStub<testpod1> {
    public testpod1_stub(com__robotraconteur__testing__TestService3Factory d) {def=d;}
    private com__robotraconteur__testing__TestService3Factory def;
    public MessageElementNestedElementList packPod(RRPod s1) {
    vectorptr_messageelement m=new vectorptr_messageelement();
    try {
    testpod1 s = (testpod1)s1;
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<double[]>packArray("d1",new double[] {s.d1}));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<double[]>packArray("d2",DataTypeUtil.verifyArrayLength(s.d2, 6, false)));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<double[]>packArray("d3",DataTypeUtil.verifyArrayLength(s.d3, 6, true)));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<double[]>packArray("d4",DataTypeUtil.verifyArrayLength(s.d4, 9, false)));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<testpod2>packPodToArray("s1",s.s1));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<testpod2>packPodArray("s2",DataTypeUtil.verifyArrayLength(s.s2, 8, false)));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<testpod2>packPodArray("s3",DataTypeUtil.verifyArrayLength(s.s3, 9, true)));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<testpod2>packPodArray("s4",DataTypeUtil.verifyArrayLength(s.s4, 8, false)));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<transform>packNamedArrayToArray("t1",s.t1));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<transform>packNamedArray("t2",DataTypeUtil.verifyArrayLength(s.t2, 4, false)));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<transform>packNamedArray("t3",DataTypeUtil.verifyArrayLength(s.t3, 15, true)));
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<transform>packNamedArray("t4",DataTypeUtil.verifyArrayLength(s.t4, 8, false)));
    return new MessageElementNestedElementList(DataTypes.DataTypes_pod_t,"",m);
    }
    finally {
    m.delete();
    }
    }
    public testpod1 unpackPod(MessageElementNestedElementList m) {
    if (m == null ) throw new NullPointerException("Pod must not be null");
    vectorptr_messageelement mm=m.getElements();
    try {
    testpod1 s = new testpod1();
    s.d1 =(MessageElementUtil.<double[]>castDataAndDispose(MessageElement.findElement(mm,"d1")))[0];
    s.d2 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<double[]>unpackArray(MessageElement.findElement(mm,"d2")), 6, false);
    s.d3 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<double[]>unpackArray(MessageElement.findElement(mm,"d3")), 6, true);
    s.d4 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<double[]>unpackArray(MessageElement.findElement(mm,"d4")), 9, false);
    s.s1 =MessageElementUtil.<testpod2>unpackPodFromArray(MessageElement.findElement(mm,"s1"));
    s.s2 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<testpod2>unpackPodArray(MessageElement.findElement(mm,"s2")), 8, false);
    s.s3 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<testpod2>unpackPodArray(MessageElement.findElement(mm,"s3")), 9, true);
    s.s4 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<testpod2>unpackPodArray(MessageElement.findElement(mm,"s4")), 8, false);
    s.t1 =MessageElementUtil.<transform>unpackNamedArrayFromArray(MessageElement.findElement(mm,"t1"));
    s.t2 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<transform>unpackNamedArray(MessageElement.findElement(mm,"t2")), 4, false);
    s.t3 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<transform>unpackNamedArray(MessageElement.findElement(mm,"t3")), 15, true);
    s.t4 =DataTypeUtil.verifyArrayLength(MessageElementUtil.<transform>unpackNamedArray(MessageElement.findElement(mm,"t4")), 8, false);
    return s;
    }
    finally {
    mm.delete();
    }
    }
    public String getTypeName() {return "com.robotraconteur.testing.TestService3.testpod1";}
    protected testpod1[] createArray(int count) { return new testpod1[count]; }
}
