Attribute VB_Name = "m_NmContext"
'Generated by IDL2VB v120. Copyright (c) 2000 Martin.Both
'Source File Name: ../naming/CosNaming.idl

Option Explicit

'interface ::CosNaming::NamingContext
Public Const TypeId As String = "IDL:omg.org/CosNaming/NamingContext:1.0"

'Enum NotFoundReason
Public Const missing_node As Long = 0
Public Const not_context As Long = 1
Public Const not_object As Long = 2

'Enum NotFoundReason, Helper
Public Function NotFoundReason_TypeCode() As cOrbTypeCode
    On Error GoTo ErrHandler
    Dim oOrb As cOrbImpl
    Set oOrb = VBOrb.defaultOrb()
    'Describe enum members
    Dim oMemSeq As c_StringSeq
    Set oMemSeq = New c_StringSeq
    oMemSeq.Length = 3
    oMemSeq.Item(0) = "missing_node"
    oMemSeq.Item(1) = "not_context"
    oMemSeq.Item(2) = "not_object"
    Set NotFoundReason_TypeCode = oOrb.createEnumTc("IDL:CosNaming/NamingContext/NotFoundReason:1.0", "NotFoundReason", oMemSeq)
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "NotFoundReason_TypeCode")
End Function

'Helper
Public Function narrow(ByVal Obj As cOrbObject) As c_NmContext
    On Error GoTo ErrHandler
    If Obj Is Nothing Then
        Set narrow = Nothing
    Else
        Dim oObj As cOrbObject
        Set oObj = New c_NmContext
        If oObj.setObjRef(Obj.getObjRef(), True) Then
            Set narrow = Nothing
        Else
            Set narrow = oObj
        End If
    End If
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "narrow")
End Function

'Helper
Public Function uncheckedNarrow(ByVal Obj As cOrbObject) As c_NmContext
    On Error GoTo ErrHandler
    If Obj Is Nothing Then
        Set uncheckedNarrow = Nothing
    Else
        Dim oObj As cOrbObject
        Set oObj = New c_NmContext
        If oObj.setObjRef(Obj.getObjRef(), False) Then
            Set uncheckedNarrow = Nothing
        Else
            Set uncheckedNarrow = oObj
        End If
    End If
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "uncheckedNarrow")
End Function
