VisionWorks Toolkit Reference

December 18, 2015 | 1.2 Release

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

Detailed Description

Adds various extensions to vx_reference.

This section describes different extensions and features to the standard Object: Reference.

Reference Counter

This sections refines the description of a set of standard OpenVX functions with regards to the reference count management. For all other functions, see the OpenVX API Modules.

The following functions increment the reference counter of the returned object. The application must then explicitly release the returned reference by using the appropriate release function when it does not need this reference anymore.

Functions

vx_status nvxReleaseReferenceList (vx_reference ref_list[], vx_size num_refs)
 Releases a list of references to OpenVX objects. More...
 
vx_status nvxRetainReference (vx_reference ref)
 Increments the reference counter of an object. More...
 

Function Documentation

vx_status nvxRetainReference ( vx_reference  ref)

Increments the reference counter of an object.

Upon each call to this function for an object, an additional object release must be performed before the object is destroyed.

Note
This function is useful when a particular module of the application (a library, or a C++ class for instance) receives an object reference and must ensure that the object is not destroyed until the module doesn't need it anymore.
Example Code
class AlgImpl
{
public:
AlgImpl(vx_context context, vx_remap map) :
context_(context), map_(map)
{
// Retain input references, because they will be used later
// in other class methods.
}
~AlgImpl()
{
// Release references since they are not needed anymore.
vxReleaseContext(&context_);
}
void process(vx_image src, vx_image dst)
{
// Use context and map objects.
// We can be sure that they are not released
vxuRemap(context_, src, map_, VX_INTERPOLATION_TYPE_BILINEAR, dst);
}
private:
vx_context context_;
vx_remap map_;
};
Parameters
[in]refThe reference to retain.
Returns
A vx_status enumerator.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEIf the reference is not valid.
vx_status nvxReleaseReferenceList ( vx_reference  ref_list[],
vx_size  num_refs 
)

Releases a list of references to OpenVX objects.

All references that are released without error are zeroed. If there were errors for some of the references in the list, the function returns the error status of the last failing reference release in the list.

Note
A referenced object is not destroyed until its total reference count reaches zero
Example Code
vx_image virt_images[] = {
};
vx_node nodes[] = {
vxAddNode(graph, images[0], images[1], VX_CONVERT_POLICY_SATURATE, virt_images[0]),
vxSubtractNode(graph, images[0], images[1], VX_CONVERT_POLICY_SATURATE, virt_images[1]),
vxMultiplyNode(graph, virt_images[0], virt_images[1], scale, VX_CONVERT_POLICY_SATURATE, VX_ROUND_POLICY_TO_ZERO, images[2]),
};
Parameters
[in]ref_listA pointer to the list of references to release.
[in]num_refsThe number of references in the list.
Returns
A vx_status enumerator.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEIf the reference is not valid.