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

Option Explicit

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

'Helper
Public Function TypeCode() As cOrbTypeCode
    On Error GoTo ErrHandler
    Dim oOrb As cOrbImpl
    Set oOrb = VBOrb.defaultOrb()
    'Get previously created recursive or concrete TypeCode
    Dim oRecTC As cOrbTypeCode
    Set oRecTC = oOrb.getRecursiveTC(TypeId, 15) 'mCB.tk_struct
    If oRecTC Is Nothing Then
        'Create place holder for TypeCode to avoid endless recursion
        Set oRecTC = oOrb.createRecursiveTc(TypeId)
        On Error GoTo ErrRollback
        'Describe struct members
        Dim oMemSeq As cCBStructMemberSeq
        Set oMemSeq = New cCBStructMemberSeq
        oMemSeq.Length = 2
        Set oMemSeq.Item(0) = New cCBStructMember
        oMemSeq.Item(0).name = "id"
        Set oMemSeq.Item(0).p_type = oOrb.createStringTc(0)
        Set oMemSeq.Item(0).p_type = oOrb.createAliasTc("IDL:CosNaming/Istring:1.0", "Istring", oMemSeq.Item(0).p_type)
        Set oMemSeq.Item(1) = New cCBStructMember
        oMemSeq.Item(1).name = "kind"
        Set oMemSeq.Item(1).p_type = oOrb.createStringTc(0)
        Set oMemSeq.Item(1).p_type = oOrb.createAliasTc("IDL:CosNaming/Istring:1.0", "Istring", oMemSeq.Item(1).p_type)
        'Overwrite place holder
        Call oRecTC.setRecTc2StructTc("NameComponent", oMemSeq)
    End If
    Set TypeCode = oRecTC
    Exit Function
ErrRollback:
    Call oRecTC.destroy
ErrHandler:
    Call VBOrb.ErrReraise(Err, "TypeCode")
End Function

'Helper, oAny.writeValue() -> struct.initByRead()
Public Function extractFromAny(ByVal oAny As cOrbAny) As c_NmNameComponent
    Dim oStruct As c_NmNameComponent
    Set oStruct = New c_NmNameComponent
    Call oStruct.initByAny(oAny)
    Set extractFromAny = oStruct
End Function

'Helper, struct.writeMe() -> oAny.initByReadValue()
Public Function cloneAsAny(ByVal oStruct As c_NmNameComponent) As cOrbAny
    On Error GoTo ErrHandler
    Dim oAny As cOrbAny
    Set oAny = New cOrbAny
    Call oAny.initByDefaultValue(TypeCode())
    Call oStruct.insertIntoAny(oAny)
    Set cloneAsAny = oAny
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "cloneAsAny")
End Function
