|
|
|
@ -228,6 +228,20 @@ public: |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
namespace detail { |
|
|
|
|
// This tiny class eliminates the semantic difference between
|
|
|
|
|
// GKernelType and GKernelTypeM.
|
|
|
|
|
template<typename, typename> class KernelTypeMedium; |
|
|
|
|
|
|
|
|
|
template<typename K, typename... R, typename... Args> |
|
|
|
|
class KernelTypeMedium<K, std::function<std::tuple<R...>(Args...)>> : |
|
|
|
|
public cv::GKernelTypeM<K, std::function<std::tuple<R...>(Args...)>> {}; |
|
|
|
|
|
|
|
|
|
template<typename K, typename R, typename... Args> |
|
|
|
|
class KernelTypeMedium<K, std::function<R(Args...)>> : |
|
|
|
|
public cv::GKernelType<K, std::function<R(Args...)>> {}; |
|
|
|
|
} // namespace detail
|
|
|
|
|
|
|
|
|
|
} // namespace cv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -256,12 +270,12 @@ public: |
|
|
|
|
* |
|
|
|
|
* @param Class type name for this operation. |
|
|
|
|
* @param API an `std::function<>`-like signature for the operation; |
|
|
|
|
* return type is a single value. |
|
|
|
|
* return type is a single value or a tuple of multiple values. |
|
|
|
|
* @param Id string identifier for the operation. Must be unique. |
|
|
|
|
*/ |
|
|
|
|
#define G_TYPED_KERNEL_HELPER(Class, API, Id) \ |
|
|
|
|
G_ID_HELPER_BODY(Class, Id) \
|
|
|
|
|
struct Class final: public cv::GKernelType<Class, std::function API >, \
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER(Class, API, Id) \ |
|
|
|
|
G_ID_HELPER_BODY(Class, Id) \
|
|
|
|
|
struct Class final: public cv::detail::KernelTypeMedium<Class, std::function API >, \
|
|
|
|
|
public G_ID_HELPER_CLASS(Class) |
|
|
|
|
// {body} is to be defined by user
|
|
|
|
|
|
|
|
|
@ -319,10 +333,7 @@ G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4, _5, _6, _7, _8, _ |
|
|
|
|
* return type is a tuple of multiple values. |
|
|
|
|
* @param Id string identifier for the operation. Must be unique. |
|
|
|
|
*/ |
|
|
|
|
#define G_TYPED_KERNEL_M_HELPER(Class, API, Id) \ |
|
|
|
|
G_ID_HELPER_BODY(Class, Id) \
|
|
|
|
|
struct Class final: public cv::GKernelTypeM<Class, std::function API >, \
|
|
|
|
|
public G_ID_HELPER_CLASS(Class) |
|
|
|
|
#define G_TYPED_KERNEL_M_HELPER G_TYPED_KERNEL_HELPER |
|
|
|
|
// {body} is to be defined by user
|
|
|
|
|
|
|
|
|
|
#define G_TYPED_KERNEL_M_HELPER_2(Class, _1, _2, Id) \ |
|
|
|
@ -358,21 +369,10 @@ G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4, _5, _6, _7, _8, _ |
|
|
|
|
* |
|
|
|
|
* @param Class type name for this operation. |
|
|
|
|
*/ |
|
|
|
|
#define G_TYPED_KERNEL_M(Class, ...) __WRAP_VAARGS(GET_G_TYPED_KERNEL(__VA_ARGS__, \ |
|
|
|
|
G_TYPED_KERNEL_M_HELPER_10, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER_9, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER_8, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER_7, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER_6, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER_5, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER_4, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER_3, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER_2, \
|
|
|
|
|
G_TYPED_KERNEL_M_HELPER)(Class, __VA_ARGS__)) \
|
|
|
|
|
// {body} is to be defined by user
|
|
|
|
|
#define G_TYPED_KERNEL_M G_TYPED_KERNEL |
|
|
|
|
|
|
|
|
|
#define G_API_OP G_TYPED_KERNEL |
|
|
|
|
#define G_API_OP_M G_TYPED_KERNEL_M |
|
|
|
|
#define G_API_OP_M G_API_OP |
|
|
|
|
|
|
|
|
|
namespace cv |
|
|
|
|
{ |
|
|
|
|