VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "c_SpInfValueExchangeImplTie"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'Generated by IDL2VB v120. Copyright (c) 1999 Martin.Both
'Source File Name: ../demos/obv/valuetype/valuetype.idl
'Target File Name: c_SpInfValueExchangeImplTie.cls

Option Explicit

'You can use this class as a tie to your servant or as a servant example.
'Using as a tie:
' Your servant has to implement c_SpInfValueExchange
' To activate a servant via tie write following:
'  Dim oSpInfValueExchangeImplTie As c_SpInfValueExchangeImplTie
'  Set oSpInfValueExchangeImplTie = New c_SpInfValueExchangeImplTie
'  Call oSpInfValueExchangeImplTie.setDelegate(oServant)
'  Call oOrb.Connect(oSpInfValueExchangeImplTie)
'Using as a servant example:
' Rename class to c_SpInfValueExchangeImpl and save the file as c_SpInfValueExchangeImpl.cls.
' Remove delegate stuff and write your own servant operations.
' To activate a servant write following:
'  Dim oSpInfValueExchangeImpl As c_SpInfValueExchangeImpl
'  Set oSpInfValueExchangeImpl = New c_SpInfValueExchangeImpl
'  Call oOrb.Connect(oSpInfValueExchangeImpl)

Implements cOrbSkeleton
Implements c_SpInfValueExchange

'interface ::obv::support_interface::ValueExchange
Const sTypeId As String = "IDL:obv/support_interface/ValueExchange:1.0"
Private oObjRef As cOrbObjRef
Private oDelegate As c_SpInfValueExchange

'Each tie contains a delegate object, to which all operations are forwarded.
'You can remove this if you use this class as an example for your servant.
Public Sub setDelegate(ByVal Delegate As c_SpInfValueExchange)
    Set oDelegate = Delegate
End Sub

Public Function getDelegate() As c_SpInfValueExchange
    Set getDelegate = oDelegate
End Function

Friend Property Get ObjRef() As cOrbObjRef
    Set ObjRef = oObjRef
End Property

Friend Property Get This() As c_SpInfValueExchange
    Dim oObj As cOrbObject
    Set oObj = New c_SpInfValueExchange
    If oObj.setObjRef(oObjRef, False) Then
        Set This = Nothing
    Else
        Set This = oObj
    End If
End Property

Private Property Get cOrbSkeleton_TypeId(ByVal Item As Integer) As String
    Select Case Item
    Case 0: cOrbSkeleton_TypeId = sTypeId
    Case 1: cOrbSkeleton_TypeId = "IDL:omg.org/CORBA/Object:1.0"
    End Select
End Property

Private Property Get cOrbSkeleton_ObjRef() As cOrbObjRef
    Set cOrbSkeleton_ObjRef = oObjRef
End Property

Private Property Set cOrbSkeleton_ObjRef(ByVal newObjRef As cOrbObjRef)
    Set oObjRef = newObjRef
End Property

'Helper
Private Function cOrbSkeleton_execute(ByVal sOperation As String, _
    ByVal oIn As cOrbStream, ByVal oOut As cOrbStream) As Long
    On Error GoTo ErrHandler
    Dim oImpl_ As c_SpInfValueExchange
    Set oImpl_ = IIf(oDelegate Is Nothing, Me, oDelegate)
    Select Case sOperation
    Case "getValueSupportedInterface"
        Dim getValueSupportedInterface As c_SpInfMessage
        Set getValueSupportedInterface = oImpl_.getValueSupportedInterface()
        Call oOut.writeObject(getValueSupportedInterface)
    Case "getValueExample"
        Dim getValueExample As c_SpInfvalueExample
        Set getValueExample = oImpl_.getValueExample()
        Call oOut.writeValue(getValueExample)
    Case Else
        Call VBOrb.raiseBADOPERATION(1, VBOrb.CompletedNO, sOperation)
    End Select
    cOrbSkeleton_execute = 0 'NO_EXCEPTION
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "ValueExchange.execute(" & sOperation & ")")
End Function

'Implements c_SpInfValueExchange

'getValueSupportedInterface()
Private Function c_SpInfValueExchange_getValueSupportedInterface() _
    As c_SpInfMessage
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Set c_SpInfValueExchange_getValueSupportedInterface = _
            oDelegate.getValueSupportedInterface()
    End If
    Exit Function
ErrHandler:
    Set c_SpInfValueExchange_getValueSupportedInterface = Nothing
    Call VBOrb.ErrReraise(Err, "getValueSupportedInterface")
End Function

'getValueExample()
Private Function c_SpInfValueExchange_getValueExample() As c_SpInfvalueExample
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Set c_SpInfValueExchange_getValueExample = oDelegate.getValueExample()
    End If
    Exit Function
ErrHandler:
    Set c_SpInfValueExchange_getValueExample = Nothing
    Call VBOrb.ErrReraise(Err, "getValueExample")
End Function
