IDL Complex Types
interface

TBD

Properties inside an interface are represented by set-accessors and get-accessors.

 

// CORBA IDL
interface GoodDay 
{            
   string hello_simple();           
   wstring hello_wide( in wstring msg );            
};
e.g.
GoodDay
GoodDayHelper
GoodDayOperations
GoodDayPOA
GoodDayPOATie
_GoodDayStub
// VB
						 
Namespace demo.hello
   '
   ' Interface definition : GoodDay
   ' 
   ' @author TomORB VB Native Compiler 1.0rc1
   '
   Public Interface GoodDay
      Inherits GoodDayOperations, Org.Omg.CORBA.Object, Org.Omg.CORBA.Portable.IDLEntity

   End Interface

End Namespace

Namespace demo.hello
   ' 
   ' Helper class for : GoodDay
   '  
   ' @author TomORB VB Native Compiler 1.0rc1
   ' 
   Public Class GoodDayHelper
      '
      ' Insert GoodDay into an any
      ' param name="a" an any
      ' param name="t" GoodDay value
      '
      Public Shared Sub Insert(a As Org.Omg.CORBA.Any, t As demo.hello.GoodDay)
         a.Insert_Object(t , Type())
      End Sub

      '
      ' Extract GoodDay from an any
      ' @param a an any
      ' @return the extracted GoodDay value
      '
      Public Shared Function Extract(a As Org.Omg.CORBA.Any) As demo.hello.GoodDay
         If Not(a.Type().Equal(Type())) Then
            Throw New Org.Omg.CORBA.MARSHAL()
         End If
         Try
            Return demo.hello.GoodDayHelper.Narrow(a.Extract_Object())
         Catch e As Org.Omg.CORBA.BAD_PARAM
            Throw New Org.Omg.CORBA.MARSHAL(e.Message)
         End Try
      End Function

      '
      ' Internal TypeCode value
      '
      Private Shared _tc As Org.Omg.CORBA.TypeCode = Nothing

      '
      ' Return the GoodDay 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_Interface_TC(Id(),"GoodDay")
         End If
         Return _tc
      End Function

      '
      ' Return the GoodDay IDL ID
      ' @return an ID
      '
      Public Shared Function Id() As String
         Return _id
      End Function

      Private Shared _id As String = "IDL:demo/hello/GoodDay:1.0"

      '
      ' Read GoodDay from a marshalled stream
      ' @param istream the input stream
      ' @return the readed GoodDay value
      '
      Public Shared Function Read(istream As Org.Omg.CORBA.Portable.InputStream) As demo.hello.GoodDay
         Return CType(istream.Read_Object(GetType(demo.hello._GoodDayStub)), demo.hello.GoodDay)
      End Function

      '
      ' Write GoodDay into a marshalled stream
      ' @param ostream the output stream
      ' @param value GoodDay value
      '
      Public Shared Sub Write(ostream As Org.Omg.CORBA.Portable.OutputStream, value As demo.hello.GoodDay)
         ostream.Write_Object(CType(value,Org.Omg.CORBA.Portable.ObjectImpl))
      End Sub

      '
      ' Narrow CORBA::Object to GoodDay
      ' @param obj the CORBA Object
      ' @return GoodDay Object
      '
      Public Shared Function Narrow(obj As Org.Omg.CORBA.Object) As GoodDay
         If obj Is Nothing Then
            Return Nothing
         End If
         Try
            Return CType(obj,GoodDay)
         Catch ex As System.Exception
         End Try

         If obj._Is_A(Id()) Then
            Dim stub As _GoodDayStub = New _GoodDayStub()
            stub._Set_Delegate(CType(obj,Org.Omg.CORBA.Portable.ObjectImpl)._Get_Delegate())
            Return stub
         End If

         Throw New Org.Omg.CORBA.BAD_PARAM()
      End Function

      '
      ' Unchecked Narrow CORBA::Object to GoodDay
      ' @param obj the CORBA Object
      ' @return GoodDay Object
      '
      Public Shared Function Unchecked_Narrow(obj As Org.Omg.CORBA.Object) As GoodDay
         If obj Is Nothing Then
            Return Nothing
         End If
         Try
            Return CType(obj,GoodDay)
         Catch ex As System.Exception
         End Try

         Dim stub As _GoodDayStub = New _GoodDayStub()
         stub._Set_Delegate(CType(obj,Org.Omg.CORBA.Portable.ObjectImpl)._Get_Delegate())
         Return stub

      End Function
   
   End Class

End Namespace

Namespace demo.hello
   '
   ' Interface definition : GoodDay
   ' 
   ' @author TomORB VB Native Compiler 1.0rc1
   '
   Public Interface GoodDayOperations
      ' 
      ' Operation hello_simple
      '
      Function Hello_Simple() As String

      '
      ' Operation hello_wide
      '
      Function Hello_Wide(msg As String) As String

   End Interface

End Namespace


Imports System

Namespace demo.hello
   '
   ' Interface definition : GoodDay
   ' 
   ' @author TomORB VB Native Compiler 1.0rc1
   '
   <Serializable()> _
   Public MustInherit Class GoodDayPOA
      Inherits Org.Omg.PortableServer.Servant
      Implements GoodDayOperations,  Org.Omg.CORBA.Portable.InvokeHandler

      Public Overridable Function _This() As GoodDay
         Return GoodDayHelper.Narrow(_This_Object())
      End Function

      Public Overridable Function _This(orb As Org.Omg.CORBA.ORB) As GoodDay
         Return GoodDayHelper.Narrow(_This_Object(orb))
      End Function

      Private Shared _ids_list As String() = New String(){"IDL:demo/hello/GoodDay:1.0"}

      Public Overrides Function _All_Interfaces(poa As Org.Omg.PortableServer.POA, objectId() As Byte) As String()
         Return _ids_list
      End Function

      Public Function _Invoke( opName As String, _is As Org.Omg.CORBA.Portable.InputStream, handler As Org.Omg.CORBA.Portable.ResponseHandler) As Org.Omg.CORBA.Portable.OutputStream Implements Org.Omg.CORBA.Portable.InvokeHandler._Invoke

         If opName.Equals("hello_simple") Then
            Return _Invoke_Hello_Simple(_is, handler)
         ElseIf opName.Equals("hello_wide") Then
            Return _Invoke_Hello_Wide(_is, handler)
         Else
            Throw New Org.Omg.CORBA.BAD_OPERATION(opName)
         End If
      End Function

      ' 
      '  Abstract Operation Hello_Simple
      ' 
      Public MustOverride Function Hello_Simple() As String Implements GoodDayOperations.Hello_Simple

      ' 
      '  Abstract Operation Hello_Wide
      ' 
      Public MustOverride Function Hello_Wide(msg As String) As String Implements GoodDayOperations.Hello_Wide


      ' helper methods
      Private Function _Invoke_Hello_Simple( _
         _is As Org.Omg.CORBA.Portable.InputStream, _
         handler As Org.Omg.CORBA.Portable.ResponseHandler) As Org.Omg.CORBA.Portable.OutputStream

         Dim _output As Org.Omg.CORBA.Portable.OutputStream
         Dim _arg_result As String = Hello_Simple()
         _output = handler.CreateReply()
         _output.Write_String(_arg_result)

         Return _output
      End Function

      Private Function _Invoke_Hello_Wide( _
         _is As Org.Omg.CORBA.Portable.InputStream, _
         handler As Org.Omg.CORBA.Portable.ResponseHandler) As Org.Omg.CORBA.Portable.OutputStream

         Dim _output As Org.Omg.CORBA.Portable.OutputStream
         Dim arg0_in As String = _is.Read_WString()
         Dim _arg_result As String = Hello_Wide(arg0_in)

         _output = handler.CreateReply()
         _output.Write_WString(_arg_result)

         Return _output
      End Function

   End Class

End Namespace


Imports System

Namespace demo.hello
   '
   ' Interface definition : GoodDay
   ' 
   ' @author TomORB VB Native Compiler 1.0rc1
   '
   <Serializable()> _
   Public Class GoodDayPOATie
      Inherits GoodDayPOA

      '
      ' Private reference to implementation object
      '
      Private _tie As GoodDayOperations

      '
      ' Private reference to POA
      '
      Private Shadows _poa As Org.Omg.PortableServer.POA

      '
      ' Constructor
      '
      Public Sub New(tieObject As GoodDayOperations)
         _tie = tieObject
      End Sub

      '
      ' Constructor
      '
      Public Sub New(tieObject As GoodDayOperations, poa As Org.Omg.PortableServer.POA)
         _tie = tieObject
         _poa = poa
      End Sub

      Public Overrides Overloads Function _This() As GoodDay
         Return GoodDayHelper.Narrow( _This_Object())
      End Function

      Public Overrides Overloads Function _This(orb As Org.Omg.CORBA.ORB) As GoodDay
         Return GoodDayHelper.Narrow( _This_Object(orb))
      End Function

      Public Property _delegate() As GoodDayOperations
         Get
            Return _tie
         End Get
         Set(ByVal value As GoodDayOperations)
            _tie = value
         End Set
      End Property

      '
      ' _Default_POA method
      '
      Public Overrides Function _Default_POA() As Org.Omg.PortableServer.POA
         If Not(_poa Is Nothing) Then
            Return _poa
         Else
            Return MyBase._Default_POA()
         End If
      End Function

      ' 
      ' Operation Hello_Simple
      ' 
      Public Overrides Function Hello_Simple() As String
         Return _tie.Hello_Simple()
      End Function

      ' 
      ' Operation Hello_Wide
      ' 
      Public Overrides Function Hello_Wide(msg As String) As String
         Return _tie.Hello_Wide( msg)
      End Function
   
   End Class

End Namespace


Imports System

Namespace demo.hello
   '
   ' Interface definition : GoodDay
   '  
   ' @author TomORB VB Native Compiler 1.0rc1
   '
   <Serializable()> _
   Public Class _GoodDayStub
      Inherits Org.Omg.CORBA.Portable.ObjectImpl
      Implements GoodDay

      Shared _ids_list As String() = New String(){"IDL:demo/hello/GoodDay:1.0"}
	
      Public Overrides Function _Ids() As String()
         Return _ids_list
      End Function

      Private Shared _opsType As System.Type = GetType(demo.hello.GoodDayOperations)

      ' 
      ' Operation hello_simple
      ' 
      Public Function Hello_Simple() As String Implements demo.hello.GoodDayOperations.Hello_Simple
         While True
            If Not(Me._Is_Local()) Then
               Dim _input As Org.Omg.CORBA.Portable.InputStream = Nothing
               Try
                  Dim _output As Org.Omg.CORBA.Portable.OutputStream = Me._Request("hello_simple",true)
                  _input = Me._Invoke(_output)
                  Dim _arg_ret As String = _input.Read_String()
                  Return _arg_ret
               Catch _exception As Org.Omg.CORBA.Portable.RemarshalException

               Catch _exception As Org.Omg.CORBA.Portable.ApplicationException
                  Dim _exception_id As String = _exception.GetId()
                  Throw New Org.Omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id)
               Finally
                  Me._ReleaseReply(_input)
               End Try
            Else
               Dim _so As Org.Omg.CORBA.Portable.ServantObject = _Servant_PreInvoke("hello_simple",_opsType)
               If Not(_so Is Nothing) Then
                  Dim _self As demo.hello.GoodDayOperations = CType(_so.servant,demo.hello.GoodDayOperations)
                  Try
                     Return _self.Hello_Simple()
                  Finally
                     _Servant_PostInvoke(_so)
                  End Try
               End If
            End If
         End While
      End Function

      ' 
      ' Operation hello_wide
      ' 
      Public Function Hello_Wide(msg As String) As String Implements demo.hello.GoodDayOperations.Hello_Wide
         While True
            If Not(Me._Is_Local()) Then
               Dim _input As Org.Omg.CORBA.Portable.InputStream = Nothing
               Try
                  Dim _output As Org.Omg.CORBA.Portable.OutputStream = Me._Request("hello_wide",true)
                  _output.Write_WString(msg)
                  _input = Me._Invoke(_output)
                  Dim _arg_ret As String = _input.Read_WString()
                  Return _arg_ret
               Catch _exception As Org.Omg.CORBA.Portable.RemarshalException

               Catch _exception As Org.Omg.CORBA.Portable.ApplicationException
                  Dim _exception_id As String = _exception.GetId()
                  Throw New Org.Omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id)
               Finally
                  Me._ReleaseReply(_input)
               End Try
            Else
               Dim _so As Org.Omg.CORBA.Portable.ServantObject = _Servant_PreInvoke("hello_wide",_opsType)
               If Not(_so Is Nothing) Then
                  Dim _self As demo.hello.GoodDayOperations = CType(_so.servant,demo.hello.GoodDayOperations)
                  Try
                     Return _self.Hello_Wide( msg)
                  Finally
                     _Servant_PostInvoke(_so)
                  End Try
               End If
            End If
         End While
      End Function

   End Class

End Namespace