File size: 2,698 Bytes
be94e5d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2020 Intel Corporation
#include "precomp.hpp"
#include <opencv2/gapi/garg.hpp>
cv::GRunArg::GRunArg() {
}
cv::GRunArg::GRunArg(const cv::GRunArg &arg)
: cv::GRunArgBase(static_cast<const cv::GRunArgBase&>(arg))
, meta(arg.meta) {
}
cv::GRunArg::GRunArg(cv::GRunArg &&arg)
: cv::GRunArgBase(std::move(static_cast<const cv::GRunArgBase&>(arg)))
, meta(std::move(arg.meta)) {
}
cv::GRunArg& cv::GRunArg::operator= (const cv::GRunArg &arg) {
cv::GRunArgBase::operator=(static_cast<const cv::GRunArgBase&>(arg));
meta = arg.meta;
return *this;
}
cv::GRunArg& cv::GRunArg::operator= (cv::GRunArg &&arg) {
cv::GRunArgBase::operator=(std::move(static_cast<const cv::GRunArgBase&>(arg)));
meta = std::move(arg.meta);
return *this;
}
// NB: Construct GRunArgsP based on passed info and store the memory in passed cv::GRunArgs.
// Needed for python bridge, because in case python user doesn't pass output arguments to apply.
void cv::detail::constructGraphOutputs(const cv::GTypesInfo &out_info,
cv::GRunArgs &args,
cv::GRunArgsP &outs)
{
for (auto&& info : out_info)
{
switch (info.shape)
{
case cv::GShape::GMAT:
{
args.emplace_back(cv::Mat{});
outs.emplace_back(&cv::util::get<cv::Mat>(args.back()));
break;
}
case cv::GShape::GSCALAR:
{
args.emplace_back(cv::Scalar{});
outs.emplace_back(&cv::util::get<cv::Scalar>(args.back()));
break;
}
case cv::GShape::GARRAY:
{
cv::detail::VectorRef ref;
util::get<cv::detail::ConstructVec>(info.ctor)(ref);
args.emplace_back(ref);
outs.emplace_back(cv::util::get<cv::detail::VectorRef>(args.back()));
break;
}
case cv::GShape::GOPAQUE:
{
cv::detail::OpaqueRef ref;
util::get<cv::detail::ConstructOpaque>(info.ctor)(ref);
args.emplace_back(ref);
outs.emplace_back(ref);
break;
}
default:
util::throw_error(std::logic_error("Unsupported output shape for python"));
}
}
}
|