dksdk_ffi_c/cls_capnp_retval.h

Defines

DK_IIDSTR_CAPN_RET

The interface identifier for the Cap 'n Proto GenericReturn dk_cls_capnp_retval.

The Cap 'n Proto Return is responsible for providing the return value as Cap'n Proto segments.

Typedefs

typedef size_t DK_CLS_CAPNP_SET_SEGMENT(uint32_t idx, char **dataRef)

Callback function that sets the data that should be held by a segment.

Param idx:

The segment index, starting at zero.

Param dataRef:

[out] On output the dereferenced address (*dataRef) should be set to the pointer to the segment data which MUST be aligned to at least an 8 byte alignment.

Return:

The size of the segment

Functions

DKSDK_FFI_C_EXPORT int dk_cls_capnp_retval_new(struct dksdk_ffi *ffi, struct dk_cls_capnp_retval **ppObject)

Allocates a dk_cls_capnp_retval return value from a method call.

Parameters:
  • ffi -- [in] The FFI pointer from dksdk_ffi_host_create

  • ppObject -- [inout] The address of the pointer to an object initialized with zero bytes. On success the object will be populated. The object must be released when the caller is finished with it. On failure the de-referenced address *ppObject will be NULL.

Returns:

  • DKSDK_FFI_OK on success

  • DKSDK_FFI_ERR_INVALID_STATE when there is no memory

  • DKSDK_FFI_ERR_INVALID_ARGUMENT when ffi or ppObject is NULL

Variables

const dksdk_ffi_uuid DK_IID_CAPN_RETVAL
struct dk_cls_capnp_retval_vtable
#include <cls_capnp_retval.h>

Virtual methods for the Cap 'n Proto Return Value class.

Public Members

dksdk_ffi_i_com_vtable com_vtable

The C++ style virtual table containing the Cap 'n Proto Return Value methods.

void (*fpSetOneSegment)(size_t dataSz, char *segmentData)

Set the return value as a single Cap n' Proto segment.

Only for simple cases where it is known there will only be one segment.

void (*fpSetMultipleSegments)(uint32_t numSegments, DK_CLS_CAPNP_SET_SEGMENT *fpSetSegmentCallback)

Set the zero or more segments that represent the return value.

Param numSegments:

The number of segments belonging to the return value.

Param fpSetSegmentCallback:

The function that will be called each segment, ascending in order from the first segment.

struct dk_cls_capnp_retval
#include <cls_capnp_retval.h>

The struct dk_cls_capnp_retval wraps the GenericReturn received from a COM method call into a reference-counted COM object.

The GenericReturn represents either a new COM object or a Cap 'n Proto message.

When the last reference to struct dk_cls_capnp_retval is released, the underlying Cap 'n Proto segments are freed. However, it is your responsibility to release the "newObject" when you are finished with the new object, if the GenericReturn represents a new COM object.

struct dk_cls_capnp_retval methods are dk_cls_capnp_retval_vtable.

Public Members

struct dksdk_ffi_i_com com

The always-valid DkSDK FFI COM superclass.

Use this superclass to access private fields of the DkSDK FFI COM superclass.

dk_cls_capnp_retval_vtable *vtable_capnp_retval

The always-valid virtual table for the Cap 'n Proto GenericReturn class.

Use this virtual table to access virtual methods.

union dk_cls_capnp_retval

The DkSDK FFI COM object superclass, with the virtual method table extended to conform to dk_cls_capnp_retval_vtable.

struct capn *generic_return

The Cap n' Proto message for the GenericReturn value.