Path: blob/master/modules/gapi/src/api/gapi_priv.hpp
16338 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.3//4// Copyright (C) 2018 Intel Corporation567#ifndef OPENCV_GAPI_PRIV_HPP8#define OPENCV_GAPI_PRIV_HPP910#include <set> // set11#include <map> // map12#include <limits>1314#include "opencv2/gapi/util/variant.hpp" // variant15#include "opencv2/gapi/garray.hpp" // ConstructVec16#include "opencv2/gapi/gscalar.hpp"17#include "opencv2/gapi/gcommon.hpp"1819#include "opencv2/gapi/opencv_includes.hpp"2021#include "api/gnode.hpp"2223namespace cv24{2526namespace gimpl27{28// Union type for various user-defined type constructors (GArray<T>, etc)29// FIXME: Replace construct-only API with a more generic one30// (probably with bits of introspection)31// Not required for non-user-defined types (GMat, GScalar, etc)32using HostCtor = util::variant33< util::monostate34, detail::ConstructVec35>;3637using ConstVal = util::variant38< util::monostate39, cv::gapi::own::Scalar40>;41}4243// TODO namespace gimpl?4445struct GOrigin46{47static constexpr const std::size_t INVALID_PORT = std::numeric_limits<std::size_t>::max();4849GOrigin(GShape s,50const GNode& n,51std::size_t p = INVALID_PORT,52const gimpl::HostCtor h = {});53GOrigin(GShape s, gimpl::ConstVal value);5455const GShape shape; // Shape of a produced object56const GNode node; // a GNode which produces an object57const gimpl::ConstVal value; // Node can have initial constant value, now only scalar is supported58const std::size_t port; // GNode's output number; FIXME: "= max_size" in C++1459gimpl::HostCtor ctor; // FIXME: replace with an interface?60};6162namespace detail63{64struct GOriginCmp65{66bool operator() (const GOrigin &lhs, const GOrigin &rhs) const;67};68} // namespace cv::details6970// TODO introduce a hash on GOrigin and define this via unordered_ ?71using GOriginSet = std::set<GOrigin, detail::GOriginCmp>;72template<typename T> using GOriginMap = std::map<GOrigin, T, detail::GOriginCmp>;7374} // namespace cv7576#endif // OPENCV_GAPI_PRIV_HPP777879