VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "c_IntegerArr4"
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/grid/grid.idl
'Target File Name: c_IntegerArr4.cls

Option Explicit

'IDL Name: short [4]
Const arrLen As Long = 4&
Private arrArr(0 To arrLen - 1) As Integer

Public Property Get Length() As Long
    Length = arrLen
End Property

'index must be in the range of 0 to Length - 1
Public Property Get Item(ByVal index As Long) As Integer
    On Error GoTo ErrHandler
    Item = arrArr(index)
    Exit Property
ErrHandler:
    Call VBOrb.ErrReraise(Err, "IntegerArr4.Item.Get")
End Property

'index must be in the range of 0 to Length - 1
Public Property Let Item(ByVal index As Long, ByVal Item As Integer)
    On Error GoTo ErrHandler
    arrArr(index) = Item
    Exit Property
ErrHandler:
    Call VBOrb.ErrReraise(Err, "IntegerArr4.Item.Let")
End Property

Public Function getItems(ByRef Arr() As Integer) As Long
    On Error GoTo ErrHandler
    getItems = arrLen
    Dim arrCnt As Long
    For arrCnt = 0 To arrLen - 1
        Arr(LBound(Arr) + arrCnt) = arrArr(arrCnt)
    Next arrCnt
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "getItems")
End Function

Public Sub setItems(ByRef Arr() As Integer)
    On Error GoTo ErrHandler
    Dim arrCnt As Long
    For arrCnt = 0 To arrLen - 1
        arrArr(arrCnt) = Arr(LBound(Arr) + arrCnt)
    Next arrCnt
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "setItems")
End Sub

'Helper
Public Sub initByRead(ByVal oIn As cOrbStream)
    On Error GoTo ErrHandler
    Dim arrCnt As Long
    For arrCnt = 0 To arrLen - 1
        arrArr(arrCnt) = oIn.readShort()
    Next arrCnt
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "IntegerArr4.read")
End Sub

'Helper
Public Sub writeMe(ByVal oOut As cOrbStream)
    On Error GoTo ErrHandler
    Dim arrCnt As Long
    For arrCnt = 0 To arrLen - 1
        Call oOut.writeShort(arrArr(arrCnt))
    Next arrCnt
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "IntegerArr4.write")
End Sub

'Helper
Public Sub initByAny(ByVal oAny As cOrbAny)
    On Error GoTo ErrHandler
    Dim arrCnt As Long
    For arrCnt = 0 To arrLen - 1
        arrArr(arrCnt) = oAny.getShort()
        Call oAny.nextPos
    Next arrCnt
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "initByAny")
End Sub

'Helper
Public Sub insertIntoAny(ByVal oAny As cOrbAny)
    On Error GoTo ErrHandler
    Dim arrCnt As Long
    For arrCnt = 0 To arrLen - 1
        Call oAny.insertShort(arrArr(arrCnt))
        Call oAny.nextPos
    Next arrCnt
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "insertIntoAny")
End Sub
