e.g.
MyStringSeqHelper |
// VB
Namespace demo.any
'
' Helper class for : MyStringSeq
'
' @author TomORB VB Native Compiler 1.0rc1
'
Public Class MyStringSeqHelper
'
' Insert MyStringSeq into an any
' param name="a" an any
' param name="t" MyStringSeq value
'
Public Shared Sub Insert(a As Org.Omg.CORBA.Any, t As String())
a.Type(Type())
Write(a.Create_Output_Stream(),t)
End Sub
'
' Extract MyStringSeq from an any
' @param a an any
' @return the extracted MyStringSeq value
'
Public Shared Function Extract(a As Org.Omg.CORBA.Any) As String()
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 MyStringSeq 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(),"MyStringSeq",orb.Create_Sequence_TC(
Convert.ToUInt32(0) ,orb.Get_Primitive_TC(Org.Omg.CORBA.TCKind.tk_string)))
End If
Return _tc
End Function
'
' Return the MyStringSeq IDL ID
' @return an ID
'
Public Shared Function Id() As String
Return _id
End Function
Private Shared _id As String = "IDL:demo/any/MyStringSeq:1.0"
'
' Read MyStringSeq from a marshalled stream
' @param istream the input stream
' @return the readed MyStringSeq value
'
Public Shared Function Read(istream As Org.Omg.CORBA.Portable.InputStream) As String()
Dim new_one As String()
Dim size2 As Integer = Convert.ToInt32(istream.Read_ULong())-1
Dim tmp As String() = New String(size2){}
Dim i2 As Integer
For i2 = 0 To tmp.Length-1
tmp(i2) = istream.Read_String()
Next
new_one = tmp
Return new_one
End Function
'
' Write MyStringSeq into a marshalled stream
' @param ostream the output stream
' @param value MyStringSeq value
'
Public Shared Sub Write(ostream As Org.Omg.CORBA.Portable.OutputStream,
value As String())
ostream.Write_ULong( Convert.ToUInt32(value.Length))
Dim i2 As Integer
For i2= 0 To value.Length-1
ostream.Write_String(value(i2))
Next
End Sub
End Class
End Namespace
|