The OpenVX Specification  r31169
 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_ATTRIBUTE_TYPE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_SCALAR << 8)) + 0x0 }
 The scalar attributes list. More...
 

Functions

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 vxReadScalarValue (vx_scalar ref, void *ptr)
 Gets the scalar value out of a reference. 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...
 
vx_status VX_API_CALL vxWriteScalarValue (vx_scalar ref, const void *ptr)
 Sets the scalar value in a reference. 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 159 of file vx_types.h.

Enumeration Type Documentation

The scalar attributes list.

Enumerator
VX_SCALAR_ATTRIBUTE_TYPE 

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

Definition at line 820 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 scaler 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 vxReadScalarValue ( vx_scalar  ref,
void *  ptr 
)

Gets the scalar value out of a reference.

Note
Use this in conjunction with Query APIs that return references which should be converted into values.
Parameters
[in]refThe reference from which to get the scalar value.
[out]ptrAn appropriate typed pointer that points to a location to which to copy the scalar value.
Returns
A vx_status_e enumeration.
Return values
VX_ERROR_INVALID_REFERENCEIf the ref is not a valid reference.
VX_ERROR_INVALID_PARAMETERSIf ptr is NULL.
VX_ERROR_INVALID_TYPEIf the type does not match the type in the reference or is a bad value.
vx_status VX_API_CALL vxWriteScalarValue ( vx_scalar  ref,
const void *  ptr 
)

Sets the scalar value in a reference.

Note
Use this in conjunction with Parameter APIs that return references to parameters that need to be altered.
Parameters
[in]refThe reference from which to get the scalar value.
[in]ptrAn appropriately typed pointer that points to a location to which to copy the scalar value.
Returns
A vx_status_e enumeration.
Return values
VX_ERROR_INVALID_REFERENCEIf the ref is not a valid reference.
VX_ERROR_INVALID_PARAMETERSIf ptr is NULL.
VX_ERROR_INVALID_TYPEIf the type does not match the type in the reference or is a bad value.