//This file is automatically generated. DO NOT EDIT!
package com.robotraconteur.testing.TestService2;
import java.util.*;
import com.robotraconteur.*;
public class ostruct2_stub implements IStructureStub {
    public ostruct2_stub(com__robotraconteur__testing__TestService2Factory d) {def=d;}
    private com__robotraconteur__testing__TestService2Factory def;
    public MessageElementNestedElementList packStructure(Object s1) {
    vectorptr_messageelement m=new vectorptr_messageelement();
    try {
    if (s1 ==null) return null;
    ostruct2 s = (ostruct2)s1;
    MessageElementUtil.addMessageElementDispose(m,MessageElementUtil.<double[]>packArray("a1",s.a1));
    return new MessageElementNestedElementList(DataTypes.DataTypes_structure_t,"com.robotraconteur.testing.TestService2.ostruct2",m);
    }
    finally {
    m.delete();
    }
    }
    public <T> T unpackStructure(MessageElementData m) {
    if (m == null ) return null;
    MessageElementNestedElementList m2 = (MessageElementNestedElementList)m;
    vectorptr_messageelement mm=m2.getElements();
    try {
    ostruct2 s=new ostruct2();
    s.a1 =MessageElementUtil.<double[]>unpackArray(MessageElement.findElement(mm,"a1"));
    T st; try {st=(T)s;} catch (Exception e) {throw new RuntimeException(new DataTypeMismatchException("Wrong structuretype"));}
    return st;
    }
    finally {
    if (mm!=null) mm.delete();
    }
    }
}
