VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "c_NmBindingIteratorImplTie"
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: ../naming/CosNaming.idl
'Target File Name: c_NmBindingIteratorImplTie.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_NmBindingIterator
' To activate a servant via tie write following:
'  Dim oNmBindingIteratorImplTie As c_NmBindingIteratorImplTie
'  Set oNmBindingIteratorImplTie = New c_NmBindingIteratorImplTie
'  Call oNmBindingIteratorImplTie.setDelegate(oServant)
'  Call oOrb.Connect(oNmBindingIteratorImplTie)
'Using as a servant example:
' Rename class to c_NmBindingIteratorImpl and save the file as c_NmBindingIteratorImpl.cls.
' Remove delegate stuff and write your own servant operations.
' To activate a servant write following:
'  Dim oNmBindingIteratorImpl As c_NmBindingIteratorImpl
'  Set oNmBindingIteratorImpl = New c_NmBindingIteratorImpl
'  Call oOrb.Connect(oNmBindingIteratorImpl)

Implements cOrbSkeleton
Implements c_NmBindingIterator

'interface ::CosNaming::BindingIterator
Const sTypeId As String = "IDL:omg.org/CosNaming/BindingIterator:1.0"
Private oObjRef As cOrbObjRef
Private oDelegate As c_NmBindingIterator

'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_NmBindingIterator)
    Set oDelegate = Delegate
End Sub

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

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

Friend Property Get This() As c_NmBindingIterator
    Dim oObj As cOrbObject
    Set oObj = New c_NmBindingIterator
    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_NmBindingIterator
    Set oImpl_ = IIf(oDelegate Is Nothing, Me, oDelegate)
    Select Case sOperation
    Case "next_one"
        Dim a1_b As c_NmBinding
        Dim nextOne As Boolean
        nextOne = oImpl_.nextOne(a1_b)
        Call oOut.writeBoolean(nextOne)
        Call a1_b.writeMe(oOut)
    Case "next_n"
        Dim a2_how_many As Long
        a2_how_many = oIn.readUlong()
        Dim a2_bl As c_NmBindingSeq
        Dim nextN As Boolean
        nextN = oImpl_.nextN(a2_how_many, a2_bl)
        Call oOut.writeBoolean(nextN)
        Call a2_bl.writeMe(oOut, 0)
    Case "destroy"
        Call oImpl_.destroy
    Case Else
        Call VBOrb.raiseBADOPERATION(1, VBOrb.CompletedNO, sOperation)
    End Select
    cOrbSkeleton_execute = 0 'NO_EXCEPTION
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "BindingIterator.execute(" & sOperation & ")")
End Function

'Implements c_NmBindingIterator

'next_one()
Private Function c_NmBindingIterator_nextOne(ByRef b As c_NmBinding) As Boolean
    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
        c_NmBindingIterator_nextOne = oDelegate.nextOne(b)
    End If
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "nextOne")
End Function

'next_n()
Private Function c_NmBindingIterator_nextN(ByVal how_many As Long, _
    ByRef bl As c_NmBindingSeq) As Boolean
    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
        c_NmBindingIterator_nextN = oDelegate.nextN(how_many, bl)
    End If
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "nextN")
End Function

'destroy()
Private Sub c_NmBindingIterator_destroy()
    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
        Call oDelegate.destroy
    End If
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "destroy")
End Sub
