The OpenVX Specification  2b213f9
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Object: Scalar

Detailed Description

Defines the Scalar Object interface.

Typedefs

typedef struct _vx_scalar * vx_scalar
 An opaque reference to a scalar. More...
 

Enumerations

enum  vx_scalar_attribute_e { VX_SCALAR_TYPE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_SCALAR << 8)) + 0x0 }
 The scalar attributes list. More...
 

Functions

vx_status VX_API_CALL vxCopyScalar (vx_scalar scalar, void *user_ptr, vx_enum usage, vx_enum user_mem_type)
 Allows the application to copy from/into a scalar object. More...
 
vx_scalar VX_API_CALL vxCreateScalar (vx_context context, vx_enum data_type, const void *ptr)
 Creates a reference to a scalar object. Also see Node Parameters. More...
 
vx_status VX_API_CALL vxQueryScalar (vx_scalar scalar, vx_enum attribute, void *ptr, vx_size size)
 Queries attributes from a scalar. More...
 
vx_status VX_API_CALL vxReleaseScalar (vx_scalar *scalar)
 Releases a reference to a scalar object. The object may not be garbage collected until its total reference count is zero. More...
 

Typedef Documentation

typedef struct _vx_scalar* vx_scalar

An opaque reference to a scalar.

A scalar can be up to 64 bits wide.

See Also
vxCreateScalar

Definition at line 183 of file vx_types.h.

Enumeration Type Documentation

The scalar attributes list.

Enumerator
VX_SCALAR_TYPE 

Queries the type of atomic that is contained in the scalar. Read-only. Use a vx_enum parameter.

Definition at line 937 of file vx_types.h.

Function Documentation

vx_scalar VX_API_CALL vxCreateScalar ( vx_context  context,
vx_enum  data_type,
const void *  ptr 
)

Creates a reference to a scalar object. Also see Node Parameters.

Parameters
[in]contextThe reference to the system context.
[in]data_typeThe vx_type_e of the scalar. Must be greater than VX_TYPE_INVALID and less than VX_TYPE_SCALAR_MAX.
[in]ptrThe pointer to the initial value of the scalar.
Returns
A scalar reference vx_scalar. Any possible errors preventing a successful creation should be checked using vxGetStatus.
vx_status VX_API_CALL vxReleaseScalar ( vx_scalar scalar)

Releases a reference to a scalar object. The object may not be garbage collected until its total reference count is zero.

Parameters
[in]scalarThe pointer to the scalar to release.
Postcondition
After returning from this function the reference is zeroed.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEIf scalar is not a vx_scalar.
vx_status VX_API_CALL vxQueryScalar ( vx_scalar  scalar,
vx_enum  attribute,
void *  ptr,
vx_size  size 
)

Queries attributes from a scalar.

Parameters
[in]scalarThe scalar object.
[in]attributeThe enumeration to query. Use a vx_scalar_attribute_e enumeration.
[out]ptrThe location at which to store the resulting value.
[in]sizeThe size of the container to which ptr points.
Returns
A vx_status_e enumeration.
vx_status VX_API_CALL vxCopyScalar ( vx_scalar  scalar,
void *  user_ptr,
vx_enum  usage,
vx_enum  user_mem_type 
)

Allows the application to copy from/into a scalar object.

Parameters
[in]scalarThe reference to the scalar object that is the source or the destination of the copy.
[in]user_ptrThe address of the memory location where to store the requested data if the copy was requested in read mode, or from where to get the data to store into the scalar object if the copy was requested in write mode. In the user memory, the scalar is a variable of the type corresponding to VX_SCALAR_TYPE. The accessible memory must be large enough to contain this variable.
[in]usageThis declares the effect of the copy with regard to the scalar object using the vx_accessor_e enumeration. Only VX_READ_ONLY and VX_WRITE_ONLY are supported:
  • VX_READ_ONLY means that data are copied from the scalar object into the user memory.
  • VX_WRITE_ONLY means that data are copied into the scalar object from the user memory.
[in]user_mem_typeA vx_memory_type_e enumeration that specifies the memory type of the memory referenced by the user_addr.
Returns
A vx_status_e enumeration.
Return values
VX_ERROR_INVALID_REFERENCEThe scalar reference is not actually a scalar reference.
VX_ERROR_INVALID_PARAMETERSAn other parameter is incorrect.