//This file is automatically generated. DO NOT EDIT!
package com.robotraconteur.testing.TestService1;
import java.util.*;
import com.robotraconteur.*;
public class com__robotraconteur__testing__TestService1Factory extends ServiceFactory
{
    public String defString()
{
    String out="#This is the standard test service for RobotRaconteur\n#It is not meant to be exhaustive, rather it tests the\n#most common operations.\n\n#Each of the members defined has a specified behavior.\n#Refer to the reference implementation for details\n#on these behaviors.  New implementations of\n#Robot Raconteur should test against the reference\n#client and server to determine compatibility.\n\nservice com.robotraconteur.testing.TestService1\n\noption version 0.8\n\nimport com.robotraconteur.testing.TestService2\n\nexception testexception1\nexception testexception2\n\nstruct teststruct1\nfield double[] dat1\nfield string str2\nfield string{int32} vec3\nfield string{string} dict4\nfield string{list} list5\nfield teststruct2 struct1\nfield teststruct2{string} dstruct2\nfield teststruct2{list} lstruct3\nfield double[*] multidimarray\n\nfield varvalue var3\n\nend struct\n\nstruct teststruct2\nfield double[] mydat\n\nend struct\n\nobject testroot\nimplements com.robotraconteur.testing.TestService2.baseobj\n\noption constant double[] doubleconst {3.4, 4.8, 14372.8}\noption constant string strconst \"This is a constant\"\n\n#Properties to test the serialization of different data types\n\n#numbers\n\nproperty double d1\nproperty double[] d2\nproperty double[16] d3\nproperty double[16-] d4\nproperty double[*] d5\nproperty double[3,3] d6\n\nproperty single s1\nproperty single[] s2\n\nproperty int8 i8_1\nproperty int8[] i8_2\n\nproperty uint8 u8_1\nproperty uint8[] u8_2\nproperty uint8[*] u8_3\n\nproperty int16 i16_1\nproperty int16[] i16_2\n\nproperty uint16 u16_1\nproperty uint16[] u16_2\n\nproperty int32 i32_1\nproperty int32[] i32_2\nproperty int32[] i32_huge\n\nproperty uint32 u32_1\nproperty uint32[] u32_2\n\nproperty int64 i64_1\nproperty int64[] i64_2\n\nproperty uint64 u64_1\nproperty uint64[] u64_2\n\n#strings\nproperty string str1\n\n#structs\nproperty teststruct1 struct1\nproperty teststruct2 struct2\n\n#indexed sets\nproperty double{int32} is_d1\nproperty double{string} is_d2\nproperty double[]{int32} is_d3\nproperty double[]{string} is_d4\nproperty double[*]{int32} is_d5\nproperty double[*]{string} is_d6\n\nproperty string{int32} is_str1\nproperty string{string} is_str2\n\nproperty teststruct2{int32} is_struct1\nproperty teststruct2{string} is_struct2\nproperty com.robotraconteur.testing.TestService2.ostruct2 struct3\n\n#lists\nproperty double{list} list_d1\nproperty double[]{list} list_d3\nproperty double[*]{list} list_d5\n\nproperty string{list} list_str1\nproperty teststruct2{list} list_struct1\n\n#varvalue\nproperty varvalue var1\nproperty varvalue{int32} var2\nproperty varvalue var_num\nproperty varvalue var_str\nproperty varvalue var_struct\nproperty varvalue var_vector\nproperty varvalue var_dictionary\nproperty varvalue var_list\nproperty varvalue var_multidimarray\n\n#Throw an error to test error transmission\nproperty double errtest\nproperty teststruct1 nulltest\n\n#functions\nfunction void func1()\nfunction void func2(double d1, double d2)\nfunction double func3(double d1, double d2)\nfunction int32 meaning_of_life()\nfunction void func_errtest()\nfunction void func_errtest1()\nfunction void func_errtest2()\nfunction void func_errtest3()\n\n#events\n\nevent ev1()\nevent ev2(double d1, teststruct2 s2 )\n\n#objrefs\n\nobjref sub1 o1\nobjref sub1[] o2\nobjref sub1{int32} o3\nobjref sub1{string} o4\nobjref com.robotraconteur.testing.TestService2.subobj o5\n\nobjref varobject o6\n\nfunction void o6_op(int32 op)\n\n#pipes\n\npipe double[] p1\n\n#option pipe p2 unreliable\npipe teststruct2 p2\nfunction void pipe_check_error()\n\npipe double broadcastpipe\n\n#callbacks\ncallback void cb1()\ncallback void cb2(double d1, double d2)\ncallback double cb3(double d1, double d2)\ncallback int32 cb_meaning_of_life()\ncallback void cb_errtest()\n\nfunction void test_callbacks()\n\n#wires\n\nwire double[] w1\nwire teststruct2 w2\nwire int32[*] w3\n\nwire double broadcastwire\n\n#memory\n\nmemory double[] m1\nmemory double[*] m2\nmemory uint8[*] m3\n\nend object\n\nobject sub1\nproperty double[] d1\nproperty double[*] d2\n\nobjref sub2 o2_1\nobjref sub2{int32} o2_2\nobjref sub2{string} o2_3\n\nproperty string s_ind\nproperty int32 i_ind\n\nend object\n\nobject sub2\n\nproperty string s_ind\nproperty int32 i_ind\n\nproperty string data\nobjref sub3{string} o3_1\nend object\n\nobject sub3\nproperty string ind\nproperty string data2\nproperty double data3\nfunction double add(double d)\nend object\n\n";
    return out;    }
    public String getServiceName() {return "com.robotraconteur.testing.TestService1";}
    public teststruct1_stub teststruct1_stubentry;
    public teststruct2_stub teststruct2_stubentry;
    public com__robotraconteur__testing__TestService1Factory()
{
    teststruct1_stubentry=new teststruct1_stub(this);
    teststruct2_stubentry=new teststruct2_stub(this);
    }
    public IStructureStub findStructureStub(String objecttype)
    {
    if (objecttype.equals("teststruct1"))    return teststruct1_stubentry;
    if (objecttype.equals("teststruct2"))    return teststruct2_stubentry;
    throw new DataTypeException("Cannot find appropriate structure stub");
    }
    public IPodStub findPodStub(String objecttype)
    {
    throw new DataTypeException("Cannot find appropriate structure stub");
    }
    public INamedArrayStub findNamedArrayStub(String objecttype)
    {
    throw new DataTypeException("Cannot find appropriate structure stub");
    }
    public ServiceStub createStub(WrappedServiceStub innerstub) {
    String objecttype=innerstub.getRR_objecttype().getServiceDefinition().getName() + "." + innerstub.getRR_objecttype().getName();
    if (RobotRaconteurNode.splitQualifiedName(objecttype)[0].equals( "com.robotraconteur.testing.TestService1")) {
    String objshort=removePath(objecttype);
    if(objshort.equals( "testroot"))
    return new testroot_stub(innerstub);
    if(objshort.equals( "sub1"))
    return new sub1_stub(innerstub);
    if(objshort.equals( "sub2"))
    return new sub2_stub(innerstub);
    if(objshort.equals( "sub3"))
    return new sub3_stub(innerstub);
    } else {
    String ext_service_type=(RobotRaconteurNode.splitQualifiedName(objecttype)[0]);
    return RobotRaconteurNode.s().getServiceType(ext_service_type).createStub(innerstub);
    }
    throw new ServiceException("Could not create stub");
    }
    public ServiceSkel createSkel(Object obj) {
    String objtype=ServiceSkelUtil.findParentInterface(obj.getClass()).getName().toString();
    if ((RobotRaconteurNode.splitQualifiedName(objtype.toString())[0]).equals( "com.robotraconteur.testing.TestService1")) {
    String sobjtype=removePath(objtype);
    if(sobjtype.equals( "testroot"))
    return new testroot_skel((testroot)obj);
    if(sobjtype.equals( "sub1"))
    return new sub1_skel((sub1)obj);
    if(sobjtype.equals( "sub2"))
    return new sub2_skel((sub2)obj);
    if(sobjtype.equals( "sub3"))
    return new sub3_skel((sub3)obj);
    } else {
    String ext_service_type=(RobotRaconteurNode.splitQualifiedName(objtype.toString())[0]);
    return RobotRaconteurNode.s().getServiceType(ext_service_type).createSkel(obj);
    }
    throw new ServiceException("Could not create skel");
    }
    public RobotRaconteurException downCastException(RobotRaconteurException rr_exp){
    if (rr_exp==null) return rr_exp;
    String rr_type=rr_exp.error;
    if (!rr_type.contains(".")) return rr_exp;
    String[] rr_stype = RobotRaconteurNode.splitQualifiedName(rr_type);
    if (!rr_stype[0].equals("com.robotraconteur.testing.TestService1")) return RobotRaconteurNode.s().downCastException(rr_exp);
    if (rr_stype[1].equals("testexception1")) return new testexception1(rr_exp.getMessage(),rr_exp.errorSubName,rr_exp.errorParam);
    if (rr_stype[1].equals("testexception2")) return new testexception2(rr_exp.getMessage(),rr_exp.errorSubName,rr_exp.errorParam);
    return rr_exp;
    }
}
