// This file is part of OpenCV project. // It is subject to the license terms in the LICENSE file found in the top-level directory // of this distribution and at http://opencv.org/license.html. // // Copyright (C) 2018 Intel Corporation #ifndef OPENCV_GAPI_GBACKEND_HPP #define OPENCV_GAPI_GBACKEND_HPP #include #include #include #include "opencv2/gapi/garg.hpp" #include "opencv2/gapi/own/mat.hpp" #include "opencv2/gapi/util/optional.hpp" #include "opencv2/gapi/own/scalar.hpp" #include "compiler/gmodel.hpp" namespace cv { namespace gimpl { // Forward declarations struct Data; struct RcDesc; namespace magazine { template struct Class { template using MapT = std::unordered_map; template MapT& slot() { return std::get::value>(slots); } template const MapT& slot() const { return std::get::value>(slots); } private: std::tuple...> slots; }; } // namespace magazine #if !defined(GAPI_STANDALONE) using Mag = magazine::Class; #else using Mag = magazine::Class; #endif namespace magazine { void GAPI_EXPORTS bindInArg (Mag& mag, const RcDesc &rc, const GRunArg &arg, bool is_umat = false); void GAPI_EXPORTS bindOutArg(Mag& mag, const RcDesc &rc, const GRunArgP &arg, bool is_umat = false); void resetInternalData(Mag& mag, const Data &d); cv::GRunArg getArg (const Mag& mag, const RcDesc &ref); cv::GRunArgP getObjPtr ( Mag& mag, const RcDesc &rc, bool is_umat = false); void writeBack (const Mag& mag, const RcDesc &rc, GRunArgP &g_arg, bool is_umat = false); } // namespace magazine namespace detail { template struct magazine { template using MapT = std::unordered_map; template MapT& slot() { return std::get::value>(slots); } template const MapT& slot() const { return std::get::value>(slots); } private: std::tuple...> slots; }; } // namespace detail struct GRuntimeArgs { GRunArgs inObjs; GRunArgsP outObjs; }; template inline cv::util::optional getCompileArg(const cv::GCompileArgs &args) { for (auto &compile_arg : args) { if (compile_arg.tag == cv::detail::CompileArgTag::tag()) { return cv::util::optional(compile_arg.get()); } } return cv::util::optional(); } void createMat(const cv::GMatDesc& desc, cv::gapi::own::Mat& mat); #if !defined(GAPI_STANDALONE) void createMat(const cv::GMatDesc& desc, cv::Mat& mat); #endif }} // cv::gimpl #endif // OPENCV_GAPI_GBACKEND_HPP