The OpenVX Specification  a73e458
Object: Scalar

Detailed Description

Defines the Scalar Object interface.

Modules

 The Scalar Attributes Constants
 The scalar attributes list.
 

Typedefs

typedef struct _vx_scalar * vx_scalar
 An opaque reference to a scalar [R01409]. 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 [R00843]. More...
 
vx_scalar VX_API_CALL vxCreateScalar (vx_context context, vx_enum data_type, const void *ptr)
 Creates a reference to a scalar object [R00828]. 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 [R00837]. More...
 
vx_status VX_API_CALL vxReleaseScalar (vx_scalar *scalar)
 Releases a reference to a scalar object [R00833]. The object may not be garbage collected until its total reference count is zero. More...
 

Typedef Documentation

◆ vx_scalar

typedef struct _vx_scalar* vx_scalar

An opaque reference to a scalar [R01409].

A scalar can be up to 64 bits wide [R01410].

See also
vxCreateScalar

Definition at line 183 of file vx_types.h.

Function Documentation

◆ vxCreateScalar()

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

Creates a reference to a scalar object [R00828]. Also see Node Parameters.

Parameters
[in]contextThe reference to the system context [R00829].
[in]data_typeThe type of the scalar. Must be greater than VX_TYPE_INVALID and less than VX_TYPE_SCALAR_MAX [R00830].
[in]ptrThe pointer to the initial value of the scalar [R00831].
Returns
A scalar reference vx_scalar [R00832]. Any possible errors preventing a successful creation should be checked using vxGetStatus.

◆ vxReleaseScalar()

vx_status VX_API_CALL vxReleaseScalar ( vx_scalar scalar)

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

Parameters
[in]scalarThe pointer to the scalar to release [R00834].
Postcondition
After returning from this function the reference is zeroed [R00835].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSNo errors; any other value indicates failure [R00836].
VX_ERROR_INVALID_REFERENCEscalar is not a valid vx_scalar reference.

◆ vxQueryScalar()

vx_status VX_API_CALL vxQueryScalar ( vx_scalar  scalar,
vx_enum  attribute,
void *  ptr,
vx_size  size 
)

Queries attributes from a scalar [R00837].

Parameters
[in]scalarThe scalar object [R00838].
[in]attributeThe attribute to query, use a The Scalar Attributes Constants value. [R00839].
[out]ptrThe location at which to store the resulting value [R00840].
[in]sizeThe size of the container to which ptr points [R00841].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSNo errors; any other value indicates failure [R00842].
VX_ERROR_INVALID_REFERENCEscalar is not a valid vx_scalar reference.

◆ vxCopyScalar()

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 [R00843].

Parameters
[in]scalarThe reference to the scalar object that is the source or the destination of the copy [R00844].
[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 [R00845]. 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 [R00846]. using the The memory accessor hint flags. value. Only VX_READ_ONLY and VX_WRITE_ONLY are supported [R00847]:
  • VX_READ_ONLY means that data are copied from the scalar object into the user memory [R00848].
  • VX_WRITE_ONLY means that data are copied into the scalar object from the user memory [R00849].
[in]user_mem_typeA Memory import type constants. value that specifies the memory type of the memory referenced by the user_addr [R00850].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSNo errors; any other value indicates failure [R00851].
VX_ERROR_INVALID_REFERENCEscalar is not a valid vx_scalar reference.
VX_ERROR_INVALID_PARAMETERSAn other parameter is incorrect.