Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / src / api / gscalar.cpp
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-2019 Intel Corporation
6
7
8 #include "precomp.hpp"
9
10 #include "opencv2/gapi/gscalar.hpp"
11 #include "opencv2/gapi/own/convert.hpp"
12 #include "api/gapi_priv.hpp" // GOrigin
13
14 // cv::GScalar public implementation ///////////////////////////////////////////
15 cv::GScalar::GScalar()
16     : m_priv(new GOrigin(GShape::GSCALAR, cv::GNode::Param()))
17 {
18 }
19
20 cv::GScalar::GScalar(const GNode &n, std::size_t out)
21     : m_priv(new GOrigin(GShape::GSCALAR, n, out))
22 {
23 }
24
25 cv::GScalar::GScalar(const cv::gapi::own::Scalar& s)
26     : m_priv(new GOrigin(GShape::GSCALAR, cv::gimpl::ConstVal(s)))
27 {
28 }
29
30 cv::GScalar::GScalar(cv::gapi::own::Scalar&& s)
31     : m_priv(new GOrigin(GShape::GSCALAR, cv::gimpl::ConstVal(std::move(s))))
32 {
33 }
34
35 cv::GScalar::GScalar(double v0)
36     : m_priv(new GOrigin(GShape::GSCALAR, cv::gimpl::ConstVal(cv::gapi::own::Scalar(v0))))
37 {
38 }
39
40 cv::GOrigin& cv::GScalar::priv()
41 {
42     return *m_priv;
43 }
44
45 const cv::GOrigin& cv::GScalar::priv() const
46 {
47     return *m_priv;
48 }
49
50 cv::GScalarDesc cv::descr_of(const cv::gapi::own::Scalar &)
51 {
52     return empty_scalar_desc();
53 }
54
55 #if !defined(GAPI_STANDALONE)
56 cv::GScalar::GScalar(const cv::Scalar& s)
57     : m_priv(new GOrigin(GShape::GSCALAR, cv::gimpl::ConstVal(to_own(s))))
58 {
59 }
60
61 cv::GScalarDesc cv::descr_of(const cv::Scalar& s)
62 {
63     return cv::descr_of(to_own(s));
64 }
65 #endif // !defined(GAPI_STANDALONE)
66
67 namespace cv {
68 std::ostream& operator<<(std::ostream& os, const cv::GScalarDesc &)
69 {
70     os << "(scalar)";
71     return os;
72 }
73 }