From bf0765fc7f92b59b7993e642d2382aacbd017e1c Mon Sep 17 00:00:00 2001 From: Andrey Golubev Date: Tue, 13 Aug 2019 13:57:27 +0300 Subject: [PATCH] Merge pull request #15282 from andrey-golubev:rename_argkind_opaque * G-API: rename ArgKind OPAQUE to GOPAQUE Rename ArgKind value to GOPAQUE to fix conflict in the user code when wingdi.h is included: it defines OPAQUE macro that (for some reason) is chosen instead of ArgKind value * Add compatibility with existing API * Renamed GOPAQUE to OPAQUE_VAL --- modules/gapi/include/opencv2/gapi/garg.hpp | 2 +- .../gapi/include/opencv2/gapi/gtype_traits.hpp | 8 ++++++-- .../gapi/test/internal/gapi_int_garg_test.cpp | 16 ++++++++-------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/modules/gapi/include/opencv2/gapi/garg.hpp b/modules/gapi/include/opencv2/gapi/garg.hpp index 8f912aadd9..c8463ea305 100644 --- a/modules/gapi/include/opencv2/gapi/garg.hpp +++ b/modules/gapi/include/opencv2/gapi/garg.hpp @@ -76,7 +76,7 @@ public: return util::unsafe_any_cast::type>(value); } - detail::ArgKind kind = detail::ArgKind::OPAQUE; + detail::ArgKind kind = detail::ArgKind::OPAQUE_VAL; protected: util::any value; diff --git a/modules/gapi/include/opencv2/gapi/gtype_traits.hpp b/modules/gapi/include/opencv2/gapi/gtype_traits.hpp index b11a044663..694c032d4e 100644 --- a/modules/gapi/include/opencv2/gapi/gtype_traits.hpp +++ b/modules/gapi/include/opencv2/gapi/gtype_traits.hpp @@ -26,7 +26,11 @@ namespace detail // a double dispatch enum class ArgKind: int { - OPAQUE, // Unknown, generic, opaque-to-GAPI data type - STATIC + OPAQUE_VAL, // Unknown, generic, opaque-to-GAPI data type - STATIC + // Note: OPAQUE is sometimes defined in Win sys headers +#if !defined(OPAQUE) && !defined(CV_DOXYGEN) + OPAQUE = OPAQUE_VAL, // deprecated value used for compatibility, use OPAQUE_VAL instead +#endif GOBJREF, // reference to object GMAT, // a cv::GMat GMATP, // a cv::GMatP @@ -41,7 +45,7 @@ namespace detail template struct GTypeTraits; template struct GTypeTraits { - static constexpr const ArgKind kind = ArgKind::OPAQUE; + static constexpr const ArgKind kind = ArgKind::OPAQUE_VAL; }; template<> struct GTypeTraits { diff --git a/modules/gapi/test/internal/gapi_int_garg_test.cpp b/modules/gapi/test/internal/gapi_int_garg_test.cpp index 550d12a6cf..c7da788ee3 100644 --- a/modules/gapi/test/internal/gapi_int_garg_test.cpp +++ b/modules/gapi/test/internal/gapi_int_garg_test.cpp @@ -39,14 +39,14 @@ using GArg_Test_Types = ::testing::Types , Expected, cv::detail::ArgKind::GARRAY> // Built-in types - , Expected - , Expected - , Expected - , Expected - , Expected - , Expected - , Expected, cv::detail::ArgKind::OPAQUE> - , Expected, cv::detail::ArgKind::OPAQUE> + , Expected + , Expected + , Expected + , Expected + , Expected + , Expected + , Expected, cv::detail::ArgKind::OPAQUE_VAL> + , Expected, cv::detail::ArgKind::OPAQUE_VAL> >; TYPED_TEST_CASE(GArgKind, GArg_Test_Types);