in inc/sf_c_util/fabric_async_op_wrapper.h [255:294]
static void MU_C4(interface_name, _, operation_name, wrapper_cb)(void* context, IFabricAsyncOperationContext* fabric_async_operation_context) \
{ \
if (context == NULL) \
{ \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_018: [ If context is NULL, _wrapper_cb shall return. ]*/ \
LogError("Invalid arguments: void* context=%p, IFabricAsyncOperationContext* fabric_async_operation_context=%p", context, fabric_async_operation_context); \
} \
else \
{ \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_019: [ Otherwise, _wrapper_cb shall check whether the async operation has completed synchronously. ]*/ \
if (fabric_async_operation_context->lpVtbl->CompletedSynchronously(fabric_async_operation_context)) \
{ \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_020: [ If the async operation has completed synchronously, _wrapper_cb shall return. ]*/ \
} \
else \
{ \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_021: [ If the async operation has not completed synchronously: ]*/ \
BS2SF_ASYNC_OP_EXTRACT_VARS_FOR_END_ARGS(__VA_ARGS__) \
MU_C4(interface_name, _, operation_name, _CONTEXT)* fabric_async_operation_wrapper_context = (MU_C4(interface_name, _, operation_name, _CONTEXT)*)context; \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_022: [ _wrapper_cb shall call End{operation_name} on the com_object passed to _execute_async. ]*/ \
HRESULT hr = fabric_async_operation_wrapper_context->com_object->lpVtbl->MU_C2(End, operation_name)(fabric_async_operation_wrapper_context->com_object, fabric_async_operation_context BS2SF_ASYNC_OP_EXTRACT_ADDRESS_END_ARG_VALUES(__VA_ARGS__)); \
if (FAILED(hr)) \
{ \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_024: [ If the End{operation_name} fails, _wrapper_cb shall call the on_complete and pass as arguments on_complete_context and the result of the End{operation_name} call. ]*/ \
LogHRESULTError(hr, MU_TOSTRING(MU_C2(End, operation_name)) " failed"); \
/* return result as is */ \
} \
else \
{ \
hr = S_OK; \
} \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_023: [ _wrapper_cb shall call the on_complete and pass as arguments on_complete_context, S_OK and the end argument values obtained from End{operation_name}. ]*/ \
fabric_async_operation_wrapper_context->on_complete(fabric_async_operation_wrapper_context->on_complete_context, hr BS2SF_ASYNC_OP_EXTRACT_END_ARG_VALUES(__VA_ARGS__)); \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_030: [ _wrapper_cb shall release the com object passed as argument to _execute_async. ]*/ \
(void)fabric_async_operation_wrapper_context->com_object->lpVtbl->Release(fabric_async_operation_wrapper_context->com_object); \
/* Codes_SRS_FABRIC_ASYNC_OP_WRAPPER_01_031: [ _wrapper_cb shall free the context created in _execute_async. ]*/ \
free(context); \
} \
} \
} \