IDL Complex Type | |
abstract valuetype |
The CORBA abstact valuetype (TBD) ...... It maps to C#'s class type. |
// CORBA IDL |
module demo { module obv { module abstract_valuetype { abstract valuetype aValueBase { readonly attribute long number; void print_base(); }; }; }; }; |
e.g. aValueBase aValueBaseHelper |
// C# public interface aValueBase : Org.Omg.CORBA.Portable.ValueBase { /** * Read accessor for number attribute * @return the attribute value */ int number { get; } /** * Operation print_base */ void Print_Base(); } public class aValueBaseHelper { /// /// Insert aValueBase into an any /// @param a an any /// @param t aValueBase value /// public static void Insert(Org.Omg.CORBA.Any a, demo.obv.abstract_valuetype.aValueBase t ) { a.Insert_Value(t, Type()); } /// /// Extract aValueBase from an any /// @param a an any /// @return the extracted aValueBase value /// public static demo.obv.abstract_valuetype.aValueBase Extract(Org.Omg.CORBA.Any a) { if (!a.Type().Equal(Type())) throw new Org.Omg.CORBA.MARSHAL(); try { return (demo.obv.abstract_valuetype.aValueBase)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 aValueBase 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[0]; Org.Omg.CORBA.TypeCode _concrete_tc = orb.Get_Primitive_TC( Org.Omg.CORBA.TCKind.tk_null); _tc = orb.Create_Value_TC(Id(),"aValueBase",Org.Omg.CORBA.VM_ABSTRACT.value, _concrete_tc,_members); _working = false; } } return _tc; } /// /// Return the aValueBase IDL ID /// @return an ID /// public static string Id() { return _id; } private static string _id = "IDL:demo/obv/abstract_valuetype/aValueBase:1.0"; /// /// Read aValueBase from a marshalled stream /// @param istream the input stream /// @return the readed aValueBase value /// public static demo.obv.abstract_valuetype.aValueBase Read(Org.Omg.CORBA.Portable.InputStream istream) { return (demo.obv.abstract_valuetype.aValueBase) ((Org.Omg.CORBA_2_3.Portable.InputStream) istream).Read_Value(_id); } /// /// Write aValueBase into a marshalled stream /// @param ostream the output stream /// @param value aValueBase value /// public static void Write(Org.Omg.CORBA.Portable.OutputStream ostream, demo.obv.abstract_valuetype.aValueBase value) { ((Org.Omg.CORBA_2_3.Portable.OutputStream)ostream).Write_Value(value, _id); } } |