VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "c_gridMyServer"
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_gridMyServer.cls

Option Explicit

Implements cOrbAbstractBase
Implements cOrbObject

'interface ::grid::MyServer
Const sTypeId As String = "IDL:grid/MyServer:1.0"
Private oObjRef As cOrbObjRef

'Helper to get different COM interface
Friend Function thisOrbAbstractBase() As cOrbAbstractBase
    Set thisOrbAbstractBase = Me
End Function

'Helper
Private Function cOrbAbstractBase_isObjRef() As Boolean
    cOrbAbstractBase_isObjRef = True
End Function

'Helper to get different COM interface
Friend Function thisOrbObject() As cOrbObject
    Set thisOrbObject = Me
End Function

'Helper
Private Function cOrbObject_setObjRef(ByVal ObjRef As cOrbObjRef, _
    ByVal Check As Boolean) As Boolean
    On Error GoTo ErrHandler
    If ObjRef Is Nothing Then
        cOrbObject_setObjRef = True
    Else
        cOrbObject_setObjRef = False
        Call ObjRef.narrow(sTypeId, Check, False)
    End If
    Set oObjRef = ObjRef
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "setObjRef")
End Function

'Helper
Private Function cOrbObject_getObjRef() As cOrbObjRef
    Set cOrbObject_getObjRef = oObjRef
End Function

'Helper
Private Function cOrbObject_getId() As String
    cOrbObject_getId = sTypeId
End Function

'attribute test1
Public Property Get test1() As c_IntegerArr4
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("_get_test1", False)
    Dim oIn As cOrbStream
    Call oRequest.invokeReqst(False)
    Set oIn = oRequest.OutRes
    Set test1 = New c_IntegerArr4
    Call test1.initByRead(oIn)
    Exit Property
ErrHandler:
    Set test1 = Nothing
    Call VBOrb.ErrReraise(Err, "test1.Get")
End Property

Public Property Set test1(ByVal test1New As c_IntegerArr4)
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("_set_test1", False)
    Dim oOut As cOrbStream
    Set oOut = oRequest.InArg
    Call test1New.writeMe(oOut)
    Call oRequest.invokeReqst(False)
    Exit Property
ErrHandler:
    Call VBOrb.ErrReraise(Err, "test1.Set")
End Property

'attribute test2
Public Property Get test2() As c_IntegerArr4Arr5
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("_get_test2", False)
    Dim oIn As cOrbStream
    Call oRequest.invokeReqst(False)
    Set oIn = oRequest.OutRes
    Set test2 = New c_IntegerArr4Arr5
    Call test2.initByRead(oIn)
    Exit Property
ErrHandler:
    Set test2 = Nothing
    Call VBOrb.ErrReraise(Err, "test2.Get")
End Property

Public Property Set test2(ByVal test2New As c_IntegerArr4Arr5)
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("_set_test2", False)
    Dim oOut As cOrbStream
    Set oOut = oRequest.InArg
    Call test2New.writeMe(oOut)
    Call oRequest.invokeReqst(False)
    Exit Property
ErrHandler:
    Call VBOrb.ErrReraise(Err, "test2.Set")
End Property

'readonly attribute height
Public Property Get height() As Integer
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("_get_height", False)
    Dim oIn As cOrbStream
    Call oRequest.invokeReqst(False)
    Set oIn = oRequest.OutRes
    height = oIn.readShort()
    Exit Property
ErrHandler:
    Call VBOrb.ErrReraise(Err, "height.Get")
End Property

'readonly attribute width
Public Property Get width() As Integer
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("_get_width", False)
    Dim oIn As cOrbStream
    Call oRequest.invokeReqst(False)
    Set oIn = oRequest.OutRes
    width = oIn.readShort()
    Exit Property
ErrHandler:
    Call VBOrb.ErrReraise(Err, "width.Get")
End Property

'set()
Public Sub setSub(ByVal n As Integer, ByVal m As Integer, ByVal value As Long)
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("set", False)
    Dim oOut As cOrbStream
    Set oOut = oRequest.InArg
    Call oOut.writeShort(n)
    Call oOut.writeShort(m)
    Call oOut.writeLong(value)
    Call oRequest.invokeReqst(False)
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "setSub")
End Sub

'get()
Public Function getFunc(ByVal n As Integer, ByVal m As Integer) As Long
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("get", False)
    Dim oOut As cOrbStream
    Set oOut = oRequest.InArg
    Call oOut.writeShort(n)
    Call oOut.writeShort(m)
    Dim oIn As cOrbStream
    Call oRequest.invokeReqst(False)
    Set oIn = oRequest.OutRes
    getFunc = oIn.readLong()
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "getFunc")
End Function

'opWithException() raises(c_gridMyServerMyException)
Public Function opWithException() As Integer
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("opWithException", False)
    Dim oIn As cOrbStream
    If oRequest.invokeReqst(True) Then
        Set oIn = oRequest.OutRes
        Dim sTypeId As String
        sTypeId = oIn.readString()
        Dim oUserEx As VBOrb.cOrbException
        Select Case sTypeId
        Case "IDL:grid/MyServer/MyException:1.0"
            Set oUserEx = New c_gridMyServerMyException
            Call oUserEx.initByRead(oIn)
        Case Else
            Call VBOrb.raiseUNKNOWN(1, VBOrb.CompletedMAYBE, _
                "Undefined CORBA User Exception: [" & sTypeId & "]")
        End Select
        Call VBOrb.raiseUserEx(oUserEx)
    Else
        Set oIn = oRequest.OutRes
        opWithException = oIn.readShort()
    End If
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "opWithException")
End Function

'oneway shutdownServer()
Public Sub shutdownServer()
    On Error GoTo ErrHandler
    Dim oRequest As cOrbRequest
    Set oRequest = oObjRef.request("shutdownServer", True)
    Call oRequest.invokeReqst(False)
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "shutdownServer")
End Sub
