The OpenVX Specification  a73e458
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. Figure below shows the Graph state transition diagram [R00123]. Also see VX_GRAPH_STATE Constants.

Graph_state_transition.png

Typedefs

typedef struct _vx_graph * vx_graph
 An opaque reference to a graph. 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 [R00718]. If verification fails this function returns a status identical to what vxVerifyGraph would return [R00719]. After the graph verfies successfully then processing occurs [R00720]. If the graph was previously verified via vxVerifyGraph or vxProcessGraph then the graph is processed [R00721]. This function blocks until the graph is completed [R00722]. 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 vxRegisterAutoAging (vx_graph graph, vx_delay delay)
 Register a delay for auto-aging. 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. If the graph has not been verified, then the implementation verifies the graph immediately [R00725]. If verification fails this function returns a status identical to what vxVerifyGraph would return [R00726]. After the graph verfies successfully then processing occurs [R00727]. If the graph was previously verified via vxVerifyGraph or vxProcessGraph then the graph is processed. More...
 
vx_status VX_API_CALL vxSetGraphAttribute (vx_graph graph, vx_enum attribute, const void *ptr, vx_size size)
 Allows the attributes of the Graph to be set to the provided value. 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 [R00730]. More...
 

Typedef Documentation

◆ vx_graph

typedef struct _vx_graph* vx_graph

An opaque reference to a graph.

See also
vxCreateGraph

Definition at line 219 of file vx_types.h.

Function Documentation

◆ vxCreateGraph()

vx_graph VX_API_CALL vxCreateGraph ( vx_context  context)

Creates an empty graph.

Parameters
[in]contextThe reference to the implementation context [R00708].
Returns
A graph reference vx_graph [R00709]. Any possible errors preventing a successful creation should be checked using vxGetStatus [R00710].

◆ vxReleaseGraph()

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 [R00711].
Postcondition
After returning from this function the reference is zeroed [R00712].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSNo errors; any other value indicates failure [R00713].
VX_ERROR_INVALID_REFERENCEgraph is not a valid vx_graph reference.

◆ vxVerifyGraph()

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 [R00714].
Parameters
[in]graphThe reference to the graph to verify [R00715].
Returns
A status value.
If a graph has more than one cause of failure, the return value is implementation-dependent. Register a log callback using vxRegisterLogCallback to receive each specific error in the graph.
A The vx_status Constants value.
Return values
VX_SUCCESSNo errors; any other value indicates failure [R00716].
VX_ERROR_INVALID_REFERENCEgraph is not a valid vx_graph reference.
VX_ERROR_MULTIPLE_WRITERSIf the graph contains more than one writer to any data object [R00717].
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

◆ 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 [R00718]. If verification fails this function returns a status identical to what vxVerifyGraph would return [R00719]. After the graph verfies successfully then processing occurs [R00720]. If the graph was previously verified via vxVerifyGraph or vxProcessGraph then the graph is processed [R00721]. This function blocks until the graph is completed [R00722].

Parameters
[in]graphThe graph to execute [R00723].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSGraph has been processed; any other value indicates failure [R00724].
VX_ERROR_INVALID_REFERENCEgraph is not a valid vx_graph reference.
VX_FAILUREA catastrophic error occurred during processing.

◆ vxScheduleGraph()

vx_status VX_API_CALL vxScheduleGraph ( vx_graph  graph)

Schedules a graph for future execution. If the graph has not been verified, then the implementation verifies the graph immediately [R00725]. If verification fails this function returns a status identical to what vxVerifyGraph would return [R00726]. After the graph verfies successfully then processing occurs [R00727]. If the graph was previously verified via vxVerifyGraph or vxProcessGraph then the graph is processed.

Parameters
[in]graphThe graph to schedule [R00728].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSThe graph has been scheduled; any other value indicates failure [R00729].
VX_ERROR_INVALID_REFERENCEgraph is not a valid vx_graph reference.
VX_ERROR_NO_RESOURCESThe graph cannot be scheduled now.
VX_ERROR_NOT_SUFFICIENTThe graph is not verified and has failed forced verification.

◆ vxWaitGraph()

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

Parameters
[in]graphThe graph to wait on [R00731].
Returns
A status value.
Return values
VX_SUCCESSThe graph has successfully completed execution and its outputs are the valid results of the most recent execution; any other value indicates failure [R00732].
VX_ERROR_INVALID_REFERENCEgraph is not a valid vx_graph reference.
VX_FAILUREAn error occurred or the graph was never scheduled. Output data of the graph is implementation-dependent.
Precondition
vxScheduleGraph

◆ vxQueryGraph()

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 [R00733].
[in]attributeThe VX_GRAPH_ Attributes type needed [R00734].
[out]ptrThe location at which to store the resulting value [R00735].
[in]sizeThe size in bytes of the container to which ptr points [R00736].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSNo errors; any other value indicates failure [R00737].
VX_ERROR_INVALID_REFERENCEgraph is not a valid vx_graph reference.

◆ vxSetGraphAttribute()

vx_status VX_API_CALL vxSetGraphAttribute ( vx_graph  graph,
vx_enum  attribute,
const void *  ptr,
vx_size  size 
)

Allows the attributes of the Graph to be set to the provided value.

Parameters
[in]graphThe reference to the graph [R00738].
[in]attributeThe VX_GRAPH_ Attributes type needed [R00739].
[in]ptrThe location from which to read the value [R00740].
[in]sizeThe size in bytes of the container to which ptr points [R00741].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSNo errors; any other value indicates failure [R00742].
VX_ERROR_INVALID_REFERENCEgraph is not a valid vx_graph reference.

◆ vxIsGraphVerified()

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 [R00757].
Returns
A vx_bool value.
Return values
vx_true_eThe graph is verified [R00758].
vx_false_eThe graph is not verified [R00759]. It must be verified before execution either through vxVerifyGraph or automatically through vxProcessGraph or vxScheduleGraph.

◆ vxRegisterAutoAging()

vx_status VX_API_CALL vxRegisterAutoAging ( vx_graph  graph,
vx_delay  delay 
)

Register a delay for auto-aging.

This function registers a delay object to be auto-aged by the graph. This delay object will be automatically aged after each successful completion of this graph [R00913]. Aging of a delay object cannot be called during graph execution [R00914]. A graph abandoned due to a node callback will trigger an auto-aging [R00915].

If a delay is registered for auto-aging multiple times in a same graph, the delay will be only aged a single time at each graph completion [R00916]. If a delay is registered for auto-aging in multiple graphs, this delay will aged automatically after each successful completion of any of these graphs [R00917].

Parameters
[in]graphThe graph to which the delay is registered for auto-aging [R00918].
[in]delayThe delay to automatically age [R00919].
Returns
A The vx_status Constants value.
Return values
VX_SUCCESSNo errors; any other value indicates failure [R00920].
VX_ERROR_INVALID_REFERENCEgraph is not a valid vx_graph reference, or delay is not a valid vx_delay reference.