IDL Complex Type | |
custom valuetype |
The CORBA custom valuetype (TBD) ..... It maps to C#'s class type. |
// CORBA IDL |
module demo { module obv { module _custom { custom valuetype valueExample { private long number_state; public string name_state; void print(); }; }; }; }; |
e.g. valueExample valueExampleHelper |
// C# [Serializable] public abstract class valueExample : demo.obv.custom.aValueBase , Org.Omg.CORBA.Portable.CustomValue { /// /// Private member : number_state /// protected int number_state; /// /// Public member : name_state /// public string name_state; /** * Operation print */ public abstract void Print(); // inherit valuetype operations /** * Abstract Operation Print_Base */ public abstract void Print_Base(); /** * Abstract Read accessor for number attribute * @return the attribute value */ public abstract int number { get; } public abstract void Unmarshal(Org.Omg.CORBA.DataInputStream _is); public abstract void Marshal(Org.Omg.CORBA.DataOutputStream _os); /// /// Return the truncatable ids /// static string[] _ids_list = { "IDL:demo/obv/custom/valueExample:1.0" }; public virtual string[] _Truncatable_Ids() { return _ids_list; } } public class valueExampleHelper { /// /// Insert valueExample into an any /// @param a an any /// @param t valueExample value /// public static void Insert(Org.Omg.CORBA.Any a, demo.obv.custom.valueExample t ) { a.Insert_Value(t, Type()); } /// /// Extract valueExample from an any /// @param a an any /// @return the extracted valueExample value /// public static demo.obv.custom.valueExample Extract(Org.Omg.CORBA.Any a) { if (!a.Type().Equal(Type())) throw new Org.Omg.CORBA.MARSHAL(); try { return (demo.obv.custom.valueExample)a.Extract_Value(); } catch (System.InvalidCastException e) { throw new Org.Omg.CORBA.MARSHAL(e.Message); } } /// /// Internal TypeCode value /// private static Org.Omg.CORBA.TypeCode _tc = null; private static bool _working = false; /// /// Return the valueExample TypeCode /// @return a TypeCode /// public static Org.Omg.CORBA.TypeCode Type() { if (_tc == null) { lock (typeof(Org.Omg.CORBA.TypeCode)) { if (_tc != null) return _tc; if (_working) return Org.Omg.CORBA.ORB.Init().Create_Recursive_TC(Id()); _working = true; Org.Omg.CORBA.ORB orb = Org.Omg.CORBA.ORB.Init(); Org.Omg.CORBA.ValueMember[] _members = new Org.Omg.CORBA.ValueMember[2]; _members[0] = new Org.Omg.CORBA.ValueMember(); _members[0].name = "number_state"; _members[0].type = orb.Get_Primitive_TC(Org.Omg.CORBA.TCKind.tk_long); _members[0].access = Org.Omg.CORBA.PRIVATE_MEMBER.value; _members[1] = new Org.Omg.CORBA.ValueMember(); _members[1].name = "name_state"; _members[1].type = orb.Get_Primitive_TC(Org.Omg.CORBA.TCKind.tk_string); _members[1].access = Org.Omg.CORBA.PUBLIC_MEMBER.value; Org.Omg.CORBA.TypeCode _concrete_tc = orb.Get_Primitive_TC( Org.Omg.CORBA.TCKind.tk_null); _tc = orb.Create_Value_TC(Id(),"valueExample", Org.Omg.CORBA.VM_CUSTOM.value,_concrete_tc,_members); _working = false; } } return _tc; } /// /// Return the valueExample IDL ID /// @return an ID /// public static string Id() { return _id; } private static string _id = "IDL:demo/obv/custom/valueExample:1.0"; /// /// Read valueExample from a marshalled stream /// @param istream the input stream /// @return the readed valueExample value /// public static demo.obv.custom.valueExample Read( Org.Omg.CORBA.Portable.InputStream istream) { return (demo.obv.custom.valueExample) ((Org.Omg.CORBA_2_3.Portable.InputStream) istream).Read_Value(_id); } /// /// Write valueExample into a marshalled stream /// @param ostream the output stream /// @param value valueExample value /// public static void Write(Org.Omg.CORBA.Portable.OutputStream ostream, demo.obv.custom.valueExample value) { ((Org.Omg.CORBA_2_3.Portable.OutputStream)ostream).Write_Value(value, _id); } } |