![]() |
VisionWorks Toolkit ReferenceDecember 18, 2015 | 1.2 Release |
This section illustrates the implementation of the kernel processing callback function.
The processing callback associated to a kernel is automatically called each time a node instantiated from this kernel is executed. The processing callback takes as parameter the reference to the node object as well as the set of references to data objects that correspond to the node parameters.
1.1. Comparison functions for the qsort
algorithm
These functions are utility functions needed by the processing callback to implement the qsort
algorithm.
1.2. Processing callback prototype
All kernel processing callbacks have the same prototype:
Usually, the first thing to do in the kernel processing function is to retrieve the reference to node parameters (input and outputs data objects). Since the prototype of the callback is generic, these parameters are given as generic references with type vx_reference. They must be cast explicitly to the right data object reference type. From this point, node parameter objects can be queried and manipulated.
1.3. Copy the data from the source array to the destination array
The qsort
algorithm operates in-place and then, since the input array must not be modified, it must initially be copied to the destination array.
1.4. Sort the output array
The output array object can be sorted due to the comparison utility functions seen previously.