abstract valuetype |
The CORBA abstact valuetype (TBD) ...... It maps to VB's class type. |
// CORBA IDL |
abstract valuetype aValueBase { readonly attribute long number; void print_base(); }; |
// VB Imports System Namespace demo.obv.abstract_valuetype ' ' Value Type definition : aValueBase ' ' @author TomORB VB Native Compiler 1.0rc1 ' Public Interface aValueBase Inherits Org.Omg.CORBA.Portable.ValueBase ' ' Read accessor for number1 attribute ' @return the attribute value ' ReadOnly Property number1 As Integer ' ' Operation print_base1 ' Sub Print_Base1() End Interface End Namespace Namespace demo.obv.abstract_valuetype ' ' Helper class for : aValueBase ' ' @author TomORB VB Native Compiler 1.0rc1 ' Public Class aValueBaseHelper ' ' Insert aValueBase into an any ' param name="a" an any ' param name="t" aValueBase value ' Public Shared Sub Insert(a As Org.Omg.CORBA.Any, t As demo.obv.abstract_valuetype.aValueBase) a.Insert_Value(t, Type()) End Sub ' ' Extract aValueBase from an any ' @param a an any ' @return the extracted aValueBase value ' Public Shared Function Extract(a As Org.Omg.CORBA.Any) As demo.obv.abstract_valuetype.aValueBase If Not(a.Type().Equal(Type())) Then Throw New Org.Omg.CORBA.MARSHAL() End If Try Return CType(a.Extract_Value(),demo.obv.abstract_valuetype.aValueBase) Catch e As System.InvalidCastException Throw New Org.Omg.CORBA.MARSHAL(e.Message) End Try End Function ' ' Internal TypeCode value ' Private Shared _tc As Org.Omg.CORBA.TypeCode = Nothing Private Shared _working As Boolean = false ' ' Return the aValueBase TypeCode ' @return a TypeCode ' Public Shared Function Type() As Org.Omg.CORBA.TypeCode If _tc Is Nothing Then SyncLock (GetType(Org.Omg.CORBA.TypeCode)) If Not(_tc Is Nothing) Then Return _tc End If If _working Then Return Org.Omg.CORBA.ORB.Init().Create_Recursive_TC(Id()) End If _working = True Dim orb As Org.Omg.CORBA.ORB = Org.Omg.CORBA.ORB.Init() Dim _members() As Org.Omg.CORBA.ValueMember = New Org.Omg.CORBA.ValueMember(-1){} Dim _concrete_tc As Org.Omg.CORBA.TypeCode = 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 End SyncLock End If Return _tc End Function ' ' Return the aValueBase IDL ID ' @return an ID ' Public Shared Function Id() As String Return _id End Function Private Shared _id As String = "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 Shared Function Read(istream As Org.Omg.CORBA.Portable.InputStream) As demo.obv.abstract_valuetype.aValueBase Return CType(CType(istream, Org.Omg.CORBA_2_3.Portable.InputStream).Read_Value(_id), demo.obv.abstract_valuetype.aValueBase) End Function ' ' Write aValueBase into a marshalled stream ' @param ostream the output stream ' @param value aValueBase value ' Public Shared Sub Write(ostream As Org.Omg.CORBA.Portable.OutputStream, value As demo.obv.abstract_valuetype.aValueBase) CType(ostream, Org.Omg.CORBA_2_3.Portable.OutputStream).Write_Value(value, _id) End Sub End Class End Namespace |