TIOVX User Guide
vx_reference.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2016 The Khronos Group Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 
19 #ifndef VX_REFERENCE_H_
20 #define VX_REFERENCE_H_
21 
22 
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
40 typedef enum _tivx_reftype_e {
41  VX_INTERNAL = 1,
42  VX_EXTERNAL = 2,
43  VX_BOTH = 3,
45 
51 
56 typedef vx_status (* VX_API_CALL tivx_reference_release_callback_f)(vx_reference *ref);
57 
63 typedef struct _vx_reference {
64 
66  uint32_t magic;
67 
70 
75 
82 
85 
91 
96 
100 
105 
108  tivx_reference_release_callback_f release_callback;
109 
112 
113  /* \brief This indicates if the object belongs to a delay */
114  vx_delay delay;
115  /* \brief This indicates the original delay slot index when the object belongs to a delay */
116  vx_int32 delay_slot_index;
117 
120 
125 
129 
136 
139 
141 
152 vx_reference ownCreateReference(vx_context context, vx_enum ref_type, vx_enum reftype, vx_reference scope);
153 
162  vx_enum ref_type,
163  vx_enum reftype,
164  tivx_reference_callback_f destructor);
165 
172 
178 
184 
191 
198 
204 vx_bool ownIsValidType(vx_enum ref_type);
205 
217 
218 
227 
235 
240 
245 
246 
251 
252 
258 
267 
276 
277 #ifdef __cplusplus
278 }
279 #endif
280 
281 #endif
struct _vx_delay * vx_delay
vx_bool
Object descriptor.
void ownInitReferenceForDelay(vx_reference ref, vx_delay d, vx_int32 idx)
Used to initialize any vx_reference as a delay element.
struct tivx_vx_mutex_t * tivx_mutex
Typedef for a mutex.
Definition: tivx_mutex.h:82
#define VX_MAX_REFERENCE_NAME
vx_status ownReferenceUnlock(vx_reference ref)
Unlock the reference.
size_t vx_size
int32_t vx_enum
The most basic type in the OpenVX system. Any type that inherits from tivx_reference_t must have a vx...
Definition: vx_reference.h:63
tivx_obj_desc_t * obj_desc
object descriptor
Definition: vx_reference.h:138
int32_t vx_int32
vx_context context
Pointer to the top level context. If this reference is the context, this will be NULL.
Definition: vx_reference.h:74
uint32_t magic
Magic code which confirms this is a reference.
Definition: vx_reference.h:66
tivx_reftype_e
An internal enum for notating which sort of reference type we need.
Definition: vx_reference.h:40
vx_enum type
Set to an enum value in vx_type_e.
Definition: vx_reference.h:69
vx_enum vx_status
struct _vx_context * vx_context
vx_status ownReferenceAllocMem(vx_reference ref)
Alloc memory associated with this reference, typically data reference.
struct _vx_reference * vx_reference
vx_bool is_array_element
Indicates that the object is an element of a pyramid or object array.
Definition: vx_reference.h:128
tivx_mutex lock
Lock to take for the reference.
Definition: vx_reference.h:111
vx_bool ownIsValidReference(vx_reference ref)
Check if reference is valid.
vx_reference scope
The pointer to the object's scope parent. When virtual objects are scoped within a graph...
Definition: vx_reference.h:81
void ownReferenceSetScope(vx_reference ref, vx_reference scope)
Set scope of a reference.
vx_reference ownReferenceGetHandleFromObjDescId(uint16_t obj_desc_id)
Return reference given a obj desc ID This API must only be called on the host.
vx_reference ownCreateReference(vx_context context, vx_enum ref_type, vx_enum reftype, vx_reference scope)
Create a reference object.
vx_bool ownIsValidType(vx_enum ref_type)
This returns true if the type is within the definition of types in OpenVX.
vx_status ownAllocReferenceBufferGeneric(vx_reference ref)
There are several reference types that are allocated in the same way This API generalizes this in ord...
vx_status ownInitReference(vx_reference ref, vx_context context, vx_enum ref_type, vx_reference scope)
Init a reference object.
vx_status ownReleaseReferenceInt(vx_reference *ref, vx_enum ref_type, vx_enum reftype, tivx_reference_callback_f destructor)
Used to destroy a reference.
tivx_reference_callback_f destructor_callback
Object specific function that is called to destroy an object when reference count reaches zero...
Definition: vx_reference.h:104
vx_bool is_accessible
Can this reference be accessed by user application Used for virtual reference's only.
Definition: vx_reference.h:124
vx_bool ownIsValidSpecificReference(vx_reference ref, vx_enum ref_type)
Used to validate everything but vx_context, vx_image.
tivx_reference_release_callback_f release_callback
Object specific function that is called to release an object.
Definition: vx_reference.h:108
vx_size ownSizeOfEnumType(vx_enum item_type)
Get the size of the Type enum.
vx_uint32 ownIncrementReference(vx_reference ref, vx_enum reftype)
Increments the ref count.
vx_bool is_virtual
This indicates if the object is virtual or not.
Definition: vx_reference.h:119
vx_status ownReferenceLock(vx_reference ref)
Lock the reference.
uint32_t vx_uint32
vx_status ownDestructReferenceGeneric(vx_reference ref)
There are several reference types that are destructed in the same way This API generalizes this in or...
vx_uint32 external_count
The count of the number of users with this reference. When greater than 0, this can not be freed...
Definition: vx_reference.h:90
vx_uint32 ownDecrementReference(vx_reference ref, vx_enum reftype)
Decrements the ref count.
vx_uint32 internal_count
The count of the number of framework references. When greater than 0, this can not be freed...
Definition: vx_reference.h:95
vx_status(* tivx_reference_callback_f)(vx_reference ref)
Callback type used to register different callbacks from object derived from references.
Definition: vx_reference.h:50
tivx_reference_callback_f mem_alloc_callback
Object specific function that is called to allocate object memory.
Definition: vx_reference.h:99
vx_status(* VX_API_CALL)(vx_reference *ref)
Callback type used to register release callbacks from object derived from references.
Definition: vx_reference.h:56
vx_bool is_allocated
Is the buffer corresponding to this reference allocated This is only relevant to the data objects and...
Definition: vx_reference.h:135