e.g.
fixedTHelper |
// VB
Namespace demo.grid.MyServerPackage
'
' Helper class for : fixedT
'
' @author TomORB VB Native Compiler 1.0rc1
'
Public Class fixedTHelper
'
' Insert fixedT into an any
' param name="a" an any
' param name="t" fixedT value
'
Public Shared Sub Insert(a As Org.Omg.CORBA.Any, t As Org.Omg.CORBA.Fixed)
a.Type(Type())
Write(a.Create_Output_Stream(),t)
End Sub
'
' Extract fixedT from an any
' @param a an any
' @return the extracted fixedT value
'
Public Shared Function Extract(a As Org.Omg.CORBA.Any) As Org.Omg.CORBA.Fixed
If Not(a.Type().Equal(Type())) Then
Throw New Org.Omg.CORBA.MARSHAL()
End If
Return Read(a.Create_Input_Stream())
End Function
'
' Internal TypeCode value
'
Private Shared _tc As Org.Omg.CORBA.TypeCode = Nothing
'
' Return the fixedT TypeCode
' @return a TypeCode
'
Public Shared Function Type() As Org.Omg.CORBA.TypeCode
If _tc Is Nothing Then
Dim orb As Org.Omg.CORBA.ORB = Org.Omg.CORBA.ORB.Init()
_tc = orb.Create_Alias_TC(Id(),"fixedT",orb.Create_Fixed_TC(
Convert.ToUInt16(5), Convert.ToInt16(2) ))
End If
Return _tc
End Function
'
' Return the fixedT IDL ID
' @return an ID
'
Public Shared Function Id() As String
Return _id
End Function
Private Shared _id As String = "IDL:demo/grid/MyServer/fixedT:1.0"
'
' Read fixedT from a marshalled stream
' @param istream the input stream
' @return the readed fixedT value
'
Public Shared Function Read(istream As Org.Omg.CORBA.Portable.InputStream)
As Org.Omg.CORBA.Fixed
Dim _f As Org.Omg.CORBA.Fixed = istream.Read_Fixed()
Return _f.MovePointLeft(2)
End Function
'
' Write fixedT into a marshalled stream
' @param ostream the output stream
' @param value fixedT value
'
Public Shared Sub Write(ostream As Org.Omg.CORBA.Portable.OutputStream,
value As Org.Omg.CORBA.Fixed)
If value.Scale <> 2 Then
Throw New Org.Omg.CORBA.DATA_CONVERSION()
End If
ostream.Write_Fixed(value)
End Sub
End Class
End Namespace
|