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.
5 // Copyright (C) 2018-2019 Intel Corporation
8 #ifndef OPENCV_GAPI_PRIV_HPP
9 #define OPENCV_GAPI_PRIV_HPP
15 #include "opencv2/gapi/util/variant.hpp" // variant
16 #include "opencv2/gapi/garray.hpp" // ConstructVec
17 #include "opencv2/gapi/gscalar.hpp"
18 #include "opencv2/gapi/gcommon.hpp"
20 #include "opencv2/gapi/opencv_includes.hpp"
22 #include "api/gnode.hpp"
29 // Union type for various user-defined type constructors (GArray<T>, etc)
30 // FIXME: Replace construct-only API with a more generic one
31 // (probably with bits of introspection)
32 // Not required for non-user-defined types (GMat, GScalar, etc)
33 using HostCtor = util::variant
35 , detail::ConstructVec
38 using ConstVal = util::variant
40 , cv::gapi::own::Scalar
44 // TODO namespace gimpl?
48 static constexpr const std::size_t INVALID_PORT = std::numeric_limits<std::size_t>::max();
52 std::size_t p = INVALID_PORT,
53 const gimpl::HostCtor h = {});
54 GOrigin(GShape s, gimpl::ConstVal value);
56 const GShape shape; // Shape of a produced object
57 const GNode node; // a GNode which produces an object
58 const gimpl::ConstVal value; // Node can have initial constant value, now only scalar is supported
59 const std::size_t port; // GNode's output number; FIXME: "= max_size" in C++14
60 gimpl::HostCtor ctor; // FIXME: replace with an interface?
67 bool operator() (const GOrigin &lhs, const GOrigin &rhs) const;
69 } // namespace cv::details
71 // TODO introduce a hash on GOrigin and define this via unordered_ ?
72 using GOriginSet = std::set<GOrigin, detail::GOriginCmp>;
73 template<typename T> using GOriginMap = std::map<GOrigin, T, detail::GOriginCmp>;
77 #endif // OPENCV_GAPI_PRIV_HPP