Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / src / api / gapi_priv.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 #include <ade/util/assert.hpp>
10
11 #include "api/gapi_priv.hpp"
12 #include "api/gnode_priv.hpp"
13
14 cv::GOrigin::GOrigin(GShape s,
15                     const cv::GNode& n,
16                     std::size_t p,
17                     const cv::gimpl::HostCtor c)
18     : shape(s), node(n), port(p), ctor(c)
19 {
20 }
21
22 cv::GOrigin::GOrigin(GShape s, cv::gimpl::ConstVal v)
23     : shape(s), node(cv::GNode::Const()), value(v), port(INVALID_PORT)
24 {
25 }
26
27 bool cv::detail::GOriginCmp::operator() (const cv::GOrigin &lhs,
28                                          const cv::GOrigin &rhs) const
29 {
30     const GNode::Priv* lhs_p = &lhs.node.priv();
31     const GNode::Priv* rhs_p = &rhs.node.priv();
32     if (lhs_p == rhs_p)
33     {
34         if (lhs.port == rhs.port)
35         {
36             // A data Origin is uniquely identified by {node/port} pair.
37             // The situation when there're two Origins with same {node/port}s
38             // but with different shapes (data formats) is illegal!
39             GAPI_Assert(lhs.shape == rhs.shape);
40         }
41         return lhs.port < rhs.port;
42     }
43     else return lhs_p < rhs_p;
44 }