// 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#include "precomp.hpp"8#include <cassert>9#include "opencv2/gapi/gcall.hpp"10#include "api/gcall_priv.hpp"1112// GCall private implementation ////////////////////////////////////////////////13cv::GCall::Priv::Priv(const cv::GKernel &k)14: m_k(k)15{16}1718// GCall public implementation /////////////////////////////////////////////////1920cv::GCall::GCall(const cv::GKernel &k)21: m_priv(new Priv(k))22{23// Here we have a reference to GNode,24// and GNode has a reference to us. Cycle! Now see destructor.25m_priv->m_node = GNode::Call(*this);26}2728cv::GCall::~GCall()29{30// When a GCall object is destroyed (and GCall::Priv is likely still alive,31// as there might be other references), reset m_node to break cycle.32m_priv->m_node = GNode();33}3435void cv::GCall::setArgs(std::vector<GArg> &&args)36{37// FIXME: Check if argument number is matching kernel prototype38m_priv->m_args = std::move(args);39}4041cv::GMat cv::GCall::yield(int output)42{43return cv::GMat(m_priv->m_node, output);44}4546cv::GScalar cv::GCall::yieldScalar(int output)47{48return cv::GScalar(m_priv->m_node, output);49}5051cv::detail::GArrayU cv::GCall::yieldArray(int output)52{53return cv::detail::GArrayU(m_priv->m_node, output);54}5556cv::GCall::Priv& cv::GCall::priv()57{58return *m_priv;59}6061const cv::GCall::Priv& cv::GCall::priv() const62{63return *m_priv;64}656667