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
10 #include "opencv2/gapi/gcall.hpp"
11 #include "api/gcall_priv.hpp"
13 // GCall private implementation ////////////////////////////////////////////////
14 cv::GCall::Priv::Priv(const cv::GKernel &k)
19 // GCall public implementation /////////////////////////////////////////////////
21 cv::GCall::GCall(const cv::GKernel &k)
24 // Here we have a reference to GNode,
25 // and GNode has a reference to us. Cycle! Now see destructor.
26 m_priv->m_node = GNode::Call(*this);
31 // FIXME: current behavior of the destructor can cause troubles in a threaded environment. GCall
32 // is not supposed to be accessed for modification within multiple threads. There should be a
33 // way to ensure somehow that no problem occurs in future. For now, this is a reminder that
34 // GCall is not supposed to be copied inside a code block that is executed in parallel.
36 // When a GCall object is destroyed (and GCall::Priv is likely still alive,
37 // as there might be other references), reset m_node to break cycle.
38 m_priv->m_node = GNode();
41 void cv::GCall::setArgs(std::vector<GArg> &&args)
43 // FIXME: Check if argument number is matching kernel prototype
44 m_priv->m_args = std::move(args);
47 cv::GMat cv::GCall::yield(int output)
49 return cv::GMat(m_priv->m_node, output);
52 cv::GScalar cv::GCall::yieldScalar(int output)
54 return cv::GScalar(m_priv->m_node, output);
57 cv::detail::GArrayU cv::GCall::yieldArray(int output)
59 return cv::detail::GArrayU(m_priv->m_node, output);
62 cv::GCall::Priv& cv::GCall::priv()
67 const cv::GCall::Priv& cv::GCall::priv() const