The OpenVX Specification  r31169
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Object: Graph

Detailed Description

Defines the Graph Object interface.

A set of nodes connected in a directed (only goes one-way) acyclic (does not loop back) fashion. A Graph may have sets of Nodes that are unconnected to other sets of Nodes within the same Graph. See Graph Formalisms.

Typedefs

typedef struct _vx_graph * vx_graph
 An opaque reference to a graph. More...
 

Enumerations

enum  vx_graph_attribute_e {
  VX_GRAPH_ATTRIBUTE_NUMNODES = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_GRAPH << 8)) + 0x0,
  VX_GRAPH_ATTRIBUTE_STATUS = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_GRAPH << 8)) + 0x1,
  VX_GRAPH_ATTRIBUTE_PERFORMANCE = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_GRAPH << 8)) + 0x2,
  VX_GRAPH_ATTRIBUTE_NUMPARAMETERS = ((( VX_ID_KHRONOS ) << 20) | ( VX_TYPE_GRAPH << 8)) + 0x3
}
 The graph attributes list. More...
 

Functions

vx_graph VX_API_CALL vxCreateGraph (vx_context context)
 Creates an empty graph. More...
 
vx_bool VX_API_CALL vxIsGraphVerified (vx_graph graph)
 Returns a Boolean to indicate the state of graph verification. More...
 
vx_status VX_API_CALL vxProcessGraph (vx_graph graph)
 This function causes the synchronous processing of a graph. If the graph has not been verified, then the implementation verifies the graph immediately. If verification fails this function returns a status identical to what vxVerifyGraph would return. After the graph verfies successfully then processing occurs. If the graph was previously verified via vxVerifyGraph or vxProcessGraph then the graph is processed. This function blocks until the graph is completed. More...
 
vx_status VX_API_CALL vxQueryGraph (vx_graph graph, vx_enum attribute, void *ptr, vx_size size)
 Allows the user to query attributes of the Graph. More...
 
vx_status VX_API_CALL vxReleaseGraph (vx_graph *graph)
 Releases a reference to a graph. The object may not be garbage collected until its total reference count is zero. Once the reference count is zero, all node references in the graph are automatically released as well. Data referenced by those nodes may not be released as the user may have external references to the data. More...
 
vx_status VX_API_CALL vxScheduleGraph (vx_graph graph)
 Schedules a graph for future execution. More...
 
vx_status VX_API_CALL vxSetGraphAttribute (vx_graph graph, vx_enum attribute, const void *ptr, vx_size size)
 Allows the set to attributes on the Graph. More...
 
vx_status VX_API_CALL vxVerifyGraph (vx_graph graph)
 Verifies the state of the graph before it is executed. This is useful to catch programmer errors and contract errors. If not verified, the graph verifies before being processed. More...
 
vx_status VX_API_CALL vxWaitGraph (vx_graph graph)
 Waits for a specific graph to complete. If the graph has been scheduled multiple times since the last call to vxWaitGraph, then vxWaitGraph returns only when the last scheduled execution completes. More...
 

Typedef Documentation

typedef struct _vx_graph* vx_graph

An opaque reference to a graph.

See also
vxCreateGraph

Definition at line 195 of file vx_types.h.

Enumeration Type Documentation

The graph attributes list.

Enumerator
VX_GRAPH_ATTRIBUTE_NUMNODES 

Returns the number of nodes in a graph. Use a vx_uint32 parameter.

VX_GRAPH_ATTRIBUTE_STATUS 

Returns the overall status of the graph. Use a vx_status parameter.

VX_GRAPH_ATTRIBUTE_PERFORMANCE 

Returns the overall performance of the graph. Use a vx_perf_t parameter.

VX_GRAPH_ATTRIBUTE_NUMPARAMETERS 

Returns the number of explicitly declared parameters on the graph. Use a vx_uint32 parameter.

Definition at line 828 of file vx_types.h.

Function Documentation

vx_graph VX_API_CALL vxCreateGraph ( vx_context  context)

Creates an empty graph.

Parameters
[in]contextThe reference to the implementation context.
Returns
A graph reference vx_graph. Any possible errors preventing a successful creation should be checked using vxGetStatus.
vx_status VX_API_CALL vxReleaseGraph ( vx_graph graph)

Releases a reference to a graph. The object may not be garbage collected until its total reference count is zero. Once the reference count is zero, all node references in the graph are automatically released as well. Data referenced by those nodes may not be released as the user may have external references to the data.

Parameters
[in]graphThe pointer to the graph 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 graph is not a vx_graph.
vx_status VX_API_CALL vxVerifyGraph ( vx_graph  graph)

Verifies the state of the graph before it is executed. This is useful to catch programmer errors and contract errors. If not verified, the graph verifies before being processed.

Precondition
Memory for data objects is not guarenteed to exist before this call.
Postcondition
After this call data objects exist unless the implementation optimized them out.
Parameters
[in]graphThe reference to the graph to verify.
Returns
A status code for graphs with more than one error; it is undefined which error will be returned. Register a log callback using vxRegisterLogCallback to receive each specific error in the graph.
A vx_status_e enumeration.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEIf graph is not a vx_graph.
VX_ERROR_MULTIPLE_WRITERSIf the graph contains more than one writer to any data object.
VX_ERROR_INVALID_NODEIf a node in the graph is invalid or failed be created.
VX_ERROR_INVALID_GRAPHIf the graph contains cycles or some other invalid topology.
VX_ERROR_INVALID_TYPEIf any parameter on a node is given the wrong type.
VX_ERROR_INVALID_VALUEIf any value of any parameter is out of bounds of specification.
VX_ERROR_INVALID_FORMATIf the image format is not compatible.
See also
vxProcessGraph
vx_status VX_API_CALL vxProcessGraph ( vx_graph  graph)

This function causes the synchronous processing of a graph. If the graph has not been verified, then the implementation verifies the graph immediately. If verification fails this function returns a status identical to what vxVerifyGraph would return. After the graph verfies successfully then processing occurs. If the graph was previously verified via vxVerifyGraph or vxProcessGraph then the graph is processed. This function blocks until the graph is completed.

Parameters
[in]graphThe graph to execute.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSGraph has been processed.
VX_FAILUREA catastrophic error occurred during processing.
*See vxVerifyGraph.
Precondition
vxVerifyGraph must return VX_SUCCESS before this function will pass.
See also
vxVerifyGraph
vx_status VX_API_CALL vxScheduleGraph ( vx_graph  graph)

Schedules a graph for future execution.

Parameters
[in]graphThe graph to schedule.
Returns
A vx_status_e enumeration.
Return values
VX_ERROR_NO_RESOURCESThe graph cannot be scheduled now.
VX_ERROR_NOT_SUFFICIENTThe graph is not verified and has failed forced verification.
VX_SUCCESSThe graph has been scheduled.
Precondition
vxVerifyGraph must return VX_SUCCESS before this function will pass.
vx_status VX_API_CALL vxWaitGraph ( vx_graph  graph)

Waits for a specific graph to complete. If the graph has been scheduled multiple times since the last call to vxWaitGraph, then vxWaitGraph returns only when the last scheduled execution completes.

Parameters
[in]graphThe graph to wait on.
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSThe graph has successfully completed execution and its outputs are the valid results of the most recent execution.
VX_FAILUREAn error occurred or the graph was never scheduled. Use vxQueryGraph for the VX_GRAPH_ATTRIBUTE_STATUS attribute to determine the details. Output data of the graph is undefined.
Precondition
vxScheduleGraph
vx_status VX_API_CALL vxQueryGraph ( vx_graph  graph,
vx_enum  attribute,
void *  ptr,
vx_size  size 
)

Allows the user to query attributes of the Graph.

Parameters
[in]graphThe reference to the created graph.
[in]attributeThe vx_graph_attribute_e type needed.
[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.
vx_status VX_API_CALL vxSetGraphAttribute ( vx_graph  graph,
vx_enum  attribute,
const void *  ptr,
vx_size  size 
)

Allows the set to attributes on the Graph.

Parameters
[in]graphThe reference to the graph.
[in]attributeThe vx_graph_attribute_e type needed.
[in]ptrThe location from which to read the value.
[in]sizeThe size in bytes of the container to which ptr points.
Returns
A vx_status_e enumeration.
vx_bool VX_API_CALL vxIsGraphVerified ( vx_graph  graph)

Returns a Boolean to indicate the state of graph verification.

Parameters
[in]graphThe reference to the graph to check.
Returns
A vx_bool value.
Return values
vx_true_eThe graph is verified.
vx_false_eThe graph is not verified. It must be verified before execution either through vxVerifyGraph or automatically through vxProcessGraph or vxScheduleGraph.