VisionWorks Toolkit Reference

April 8, 2016 | 1.4 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

This tutorial demonstrates the VisionWorks error checking mechanism.

VisionWorks provides vx_status enumeration for error codes. VX_SUCCESS constant is used for successful status code.

if (status != VX_SUCCESS)
{
printf("Failed to set performance directive\n");
fflush(stdout);
exit(1);
}

vxGetStatus call is used to check the status of object creation methods (vxCreate<Object>). The vxGetStatus method is applied to the created object. If it returns an error status code, the object cannot be used.

{
printf("Failed to create VisionWorks context\n");
fflush(stdout);
exit(1);
}

A good practice is to register a callback facility to receive error logs. It allows you to get more information about errors during VisionWorks API usage.

vxRegisterLogCallback(context, &logCallback, vx_false_e);

The logging callback must be defined as follows:

void VX_CALLBACK logCallback(vx_context context, vx_reference ref, vx_status status,
const vx_char message[])
{
printf("[NVX LOG] context=" VX_FMT_REF ",ref=" VX_FMT_REF ",status=%d : %s \n",
context, ref, status, message);
fflush(stdout);
}