1 // This file is part of OpenCV project. 2 // It is subject to the license terms in the LICENSE file found in the top-level directory 3 // of this distribution and at http://opencv.org/license.html. 4 5 #ifndef PARALLEL_PLUGIN_API_HPP 6 #define PARALLEL_PLUGIN_API_HPP 7 8 #include <opencv2/core/cvdef.h> 9 #include <opencv2/core/llapi/llapi.h> 10 11 #include "opencv2/core/parallel/parallel_backend.hpp" 12 13 #if !defined(BUILD_PLUGIN) 14 15 /// increased for backward-compatible changes, e.g. add new function 16 /// Caller API <= Plugin API -> plugin is fully compatible 17 /// Caller API > Plugin API -> plugin is not fully compatible, caller should use extra checks to use plugins with older API 18 #define API_VERSION 0 // preview 19 20 /// increased for incompatible changes, e.g. remove function argument 21 /// Caller ABI == Plugin ABI -> plugin is compatible 22 /// Caller ABI > Plugin ABI -> plugin is not compatible, caller should use shim code to use old ABI plugins (caller may know how lower ABI works, so it is possible) 23 /// Caller ABI < Plugin ABI -> plugin can't be used (plugin should provide interface with lower ABI to handle that) 24 #define ABI_VERSION 0 // preview 25 26 #else // !defined(BUILD_PLUGIN) 27 28 #if !defined(ABI_VERSION) || !defined(API_VERSION) 29 #error "Plugin must define ABI_VERSION and API_VERSION before including parallel_plugin_api.hpp" 30 #endif 31 32 #endif // !defined(BUILD_PLUGIN) 33 34 typedef cv::parallel::ParallelForAPI* CvPluginParallelBackendAPI; 35 36 struct OpenCV_Core_Parallel_Plugin_API_v0_0_api_entries 37 { 38 /** @brief Get parallel backend API instance 39 40 @param[out] handle pointer on backend API handle 41 42 @note API-CALL 1, API-Version == 0 43 */ 44 CvResult (CV_API_CALL *getInstance)(CV_OUT CvPluginParallelBackendAPI* handle) CV_NOEXCEPT; 45 }; // OpenCV_Core_Parallel_Plugin_API_v0_0_api_entries 46 47 typedef struct OpenCV_Core_Parallel_Plugin_API_v0 48 { 49 OpenCV_API_Header api_header; 50 struct OpenCV_Core_Parallel_Plugin_API_v0_0_api_entries v0; 51 } OpenCV_Core_Parallel_Plugin_API_v0; 52 53 #if ABI_VERSION == 0 && API_VERSION == 0 54 typedef OpenCV_Core_Parallel_Plugin_API_v0 OpenCV_Core_Parallel_Plugin_API; 55 #else 56 #error "Not supported configuration: check ABI_VERSION/API_VERSION" 57 #endif 58 59 #ifdef BUILD_PLUGIN 60 extern "C" { 61 62 CV_PLUGIN_EXPORTS 63 const OpenCV_Core_Parallel_Plugin_API* CV_API_CALL opencv_core_parallel_plugin_init_v0 64 (int requested_abi_version, int requested_api_version, void* reserved /*NULL*/) CV_NOEXCEPT; 65 66 } // extern "C" 67 #else // BUILD_PLUGIN 68 typedef const OpenCV_Core_Parallel_Plugin_API* (CV_API_CALL *FN_opencv_core_parallel_plugin_init_t) 69 (int requested_abi_version, int requested_api_version, void* reserved /*NULL*/); 70 #endif // BUILD_PLUGIN 71 72 #endif // PARALLEL_PLUGIN_API_HPP 73