VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "c_CsvalueExample"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'Generated by IDL2VB v096. Copyright (c) 1999 Martin.Both
'Source File Name: ../demos/obv/valuetype/valuetype.idl

Option Explicit

'You can use this class as a value example:
' Rename class to c_CsvalueExample and save the file as c_CsvalueExample.cls.
' Finally write your own local value operations.

Implements cOrbAbstractBase
Implements cOrbValueBase

'valuetype ::obv::custom::valueExample
Const sTypeId As String = "IDL:obv/custom/valueExample:1.0"

Public number_state As Long
Public name_state As String

'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 = False
End Function

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

Private Function cOrbValueBase_UniqueId() As Long
    cOrbValueBase_UniqueId = VBOrb.getNextUniqueID()
End Function

'Helper
Private Sub cOrbValueBase_initByRead(ByVal oIn As cOrbStream)
    On Error GoTo ErrHandler
    number_state = oIn.readLong()
    name_state = oIn.readString()
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "valueExample.read")
End Sub

'Helper
Private Sub cOrbValueBase_writeMe(ByVal oOut As cOrbStream)
    On Error GoTo ErrHandler
    Call oOut.writeLong(number_state)
    Call oOut.writeString(name_state)
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "valueExample.write")
End Sub

Private Function cOrbValueBase_getIds(ByVal Item As Integer) As String
    Select Case Item
    Case 0: cOrbValueBase_getIds = sTypeId
    End Select
End Function

Private Function cOrbValueBase_isCustom() As Boolean
    cOrbValueBase_isCustom = True
End Function

'readonly attribute number
Public Property Get number() As Long
    On Error GoTo ErrHandler
    number = number_state
    Exit Property
ErrHandler:
    Call VBOrb.ErrReraise(Err, "number.Get")
End Property

'print()
Public Sub printSub()
    On Error GoTo ErrHandler
    Call frmValType.printLine("Here is the 'print' operation")
    Call frmValType.printLine("It's a local operation")
    Call frmValType.printLine("")
    Call frmValType.printLine("Private member value = " & CStr(number_state))
    Call frmValType.printLine("Public member value = " & CStr(name_state))
    Call frmValType.printLine("")
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "printSub")
End Sub
