The OpenVX Specification  dba1aa3
Object: Reference

Detailed Description

Defines the Reference Object interface.

All objects in OpenVX are derived (in the object-oriented sense) from vx_reference. All objects shall be able to be cast back to this type safely.

Macros

#define VX_MAX_REFERENCE_NAME   (64)
 Defines the length of the reference name string, including the trailing zero. More...
 

Typedefs

typedef struct _vx_reference * vx_reference
 A generic opaque reference to any object within OpenVX. More...
 

Enumerations

enum  vx_reference_attribute_e {
  VX_REFERENCE_COUNT = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_REFERENCE << 8)) + 0x0,
  VX_REFERENCE_TYPE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_REFERENCE << 8)) + 0x1,
  VX_REFERENCE_NAME = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_REFERENCE << 8)) + 0x2
}
 The reference attributes list. More...
 

Functions

vx_status VX_API_CALL vxQueryReference (vx_reference ref, vx_enum attribute, void *ptr, vx_size size)
 Queries any reference type for some basic information like count or type. More...
 
vx_status VX_API_CALL vxReleaseReference (vx_reference *ref_ptr)
 Releases a reference. The reference may potentially refer to multiple OpenVX objects of different types. This function can be used instead of calling a specific release function for each individual object type (e.g. vxRelease<object>). The object will not be destroyed until its total reference count is zero. More...
 
vx_status VX_API_CALL vxRetainReference (vx_reference ref)
 Increments the reference counter of an object This function is used to express the fact that the OpenVX object is referenced multiple times by an application. Each time this function is called for an object, the application will need to release the object one additional time before it can be destructed. More...
 
vx_status VX_API_CALL vxSetReferenceName (vx_reference ref, const vx_char *name)
 Name a referenceThis function is used to associate a name to a referenced object. This name can be used by the OpenVX implementation in log messages and any other reporting mechanisms. More...
 

Macro Definition Documentation

#define VX_MAX_REFERENCE_NAME   (64)

Defines the length of the reference name string, including the trailing zero.

See also
vxSetReferenceName

Definition at line 45 of file vx.h.

Typedef Documentation

typedef struct _vx_reference* vx_reference

A generic opaque reference to any object within OpenVX.

A user of OpenVX should not assume that this can be cast directly to anything; however, any object in OpenVX can be cast back to this for the purposes of querying attributes of the object or for passing the object as a parameter to functions that take a vx_reference type. If the API does not take that specific type but may take others, an error may be returned from the API.

Definition at line 142 of file vx_types.h.

Enumeration Type Documentation

The reference attributes list.

Enumerator
VX_REFERENCE_COUNT 

Returns the reference count of the object. Read-only. Use a vx_uint32 parameter.

VX_REFERENCE_TYPE 

Returns the vx_type_e of the reference. Read-only. Use a vx_enum parameter.

VX_REFERENCE_NAME 

Used to query the reference for its name. Read-write. Use a *vx_char parameter.

Definition at line 785 of file vx_types.h.

Function Documentation

vx_status VX_API_CALL vxQueryReference ( vx_reference  ref,
vx_enum  attribute,
void *  ptr,
vx_size  size 
)

Queries any reference type for some basic information like count or type.

Parameters
[in]refThe reference to query.
[in]attributeThe value for which to query. Use vx_reference_attribute_e.
[out]ptrThe location at which to store the resulting value.
[in]sizeThe size in bytes of the container to which ptr points.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCEref is not a valid vx_reference reference.
vx_status VX_API_CALL vxReleaseReference ( vx_reference ref_ptr)

Releases a reference. The reference may potentially refer to multiple OpenVX objects of different types. This function can be used instead of calling a specific release function for each individual object type (e.g. vxRelease<object>). The object will not be destroyed until its total reference count is zero.

Note
After returning from this function the reference is zeroed.
Parameters
[in]ref_ptrThe pointer to the reference of the object to release.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCEref_ptr is not a valid vx_reference reference.
vx_status VX_API_CALL vxRetainReference ( vx_reference  ref)

Increments the reference counter of an object This function is used to express the fact that the OpenVX object is referenced multiple times by an application. Each time this function is called for an object, the application will need to release the object one additional time before it can be destructed.

Parameters
[in]refThe reference to retain.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCEref is not a valid vx_reference reference.
vx_status VX_API_CALL vxSetReferenceName ( vx_reference  ref,
const vx_char name 
)

Name a referenceThis function is used to associate a name to a referenced object. This name can be used by the OpenVX implementation in log messages and any other reporting mechanisms.

The OpenVX implementation will not check if the name is unique in the reference scope (context or graph). Several references can then have the same name.

Parameters
[in]refThe reference to the object to be named.
[in]namePointer to the '\0' terminated string that identifies the referenced object. The string is copied by the function so that it stays the property of the caller. NULL means that the reference is not named. The length of the string shall be lower than VX_MAX_REFERENCE_NAME bytes.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors; any other value indicates failure.
VX_ERROR_INVALID_REFERENCEref is not a valid vx_reference reference.