Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/gapi/src/api/gcall.cpp
16339 views
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.
4
//
5
// Copyright (C) 2018 Intel Corporation
6
7
8
#include "precomp.hpp"
9
#include <cassert>
10
#include "opencv2/gapi/gcall.hpp"
11
#include "api/gcall_priv.hpp"
12
13
// GCall private implementation ////////////////////////////////////////////////
14
cv::GCall::Priv::Priv(const cv::GKernel &k)
15
: m_k(k)
16
{
17
}
18
19
// GCall public implementation /////////////////////////////////////////////////
20
21
cv::GCall::GCall(const cv::GKernel &k)
22
: m_priv(new Priv(k))
23
{
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);
27
}
28
29
cv::GCall::~GCall()
30
{
31
// When a GCall object is destroyed (and GCall::Priv is likely still alive,
32
// as there might be other references), reset m_node to break cycle.
33
m_priv->m_node = GNode();
34
}
35
36
void cv::GCall::setArgs(std::vector<GArg> &&args)
37
{
38
// FIXME: Check if argument number is matching kernel prototype
39
m_priv->m_args = std::move(args);
40
}
41
42
cv::GMat cv::GCall::yield(int output)
43
{
44
return cv::GMat(m_priv->m_node, output);
45
}
46
47
cv::GScalar cv::GCall::yieldScalar(int output)
48
{
49
return cv::GScalar(m_priv->m_node, output);
50
}
51
52
cv::detail::GArrayU cv::GCall::yieldArray(int output)
53
{
54
return cv::detail::GArrayU(m_priv->m_node, output);
55
}
56
57
cv::GCall::Priv& cv::GCall::priv()
58
{
59
return *m_priv;
60
}
61
62
const cv::GCall::Priv& cv::GCall::priv() const
63
{
64
return *m_priv;
65
}
66
67