company logo

Binary :: toInstance - Copy binary data to instance

The function copies binary data at position passed in iPosition to the instance area of the property handle passed in rProperty. The application has to make sure, that data copied corresponds to the data structure described by the property handle. The property handle passed has to be opened in update or write mode, or must be a transient (internal) property (e.g. an OSI function variable).

When the property handle is not selected, an initialized instance is provided. After copying, the instance is marked as modified.

The function returns the size of data copied. When the property handle is not valid or cannot be accessed, the function throws an exception.

Return value:  Length ( int32  )

The length is the size allocated for an instance or area.

Implementation overview

Implementation details

  1. Copy binary data to instance
    int32 Binary  :: toInstance ( odaba::Property &rProperty, int32 iPosition )

    The function copies binary data at position passed in iPosition to the instance area of the property handle passed in rProperty with the instance length defined for the property handle.

    When the position passed is beyond the end of the binary data area, no data is transferred and the function returns 0. When the remaining part in the binary data block is less than the defined instance length, the remaining part is copied and the size of copied data is returned.

    • rProperty - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

    • iPosition - Position in collection

      The position of an element in a collection is beginning with 0 for the first element.

  2. to list
  3. Copy binary data to instance with passed length
    int32 Binary  :: toInstance ( odaba::Property &rProperty, int32 iPosition, int32 iLength )

    The function copies binary data at position passed in iPosition to the instance area of the property handle passed in rProperty with the length passed in iLength. Passing 0 or a negative value in iLength will set the length to the instance size defined for the property handle. When iLength exceeds the instance size, it is set to instance size.

    When the position passed is beyond the end of the binary data area, no data is transferred and the function returns 0. When the remaining part in the binary data block is less than iLength, the remaining part is copied and the size of copied data is returned.

    • rProperty - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

    • iPosition - Position in collection

      The position of an element in a collection is beginning with 0 for the first element.

    • iLength - Length

      The length is the size allocated for an instance or area.

  4. to list