Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / include / opencv2 / gapi / gcall.hpp
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 #ifndef OPENCV_GAPI_GCALL_HPP
9 #define OPENCV_GAPI_GCALL_HPP
10
11 #include "opencv2/gapi/garg.hpp"      // GArg
12 #include "opencv2/gapi/gmat.hpp"      // GMat
13 #include "opencv2/gapi/gscalar.hpp"   // GScalar
14 #include "opencv2/gapi/garray.hpp"    // GArray<T>
15
16 namespace cv {
17
18 struct GKernel;
19
20 // The whole idea of this class is to represent an operation
21 // which is applied to arguments. This is part of public API,
22 // since it is what users should use to define kernel interfaces.
23
24 class GAPI_EXPORTS GCall final
25 {
26 public:
27     class Priv;
28
29     explicit GCall(const GKernel &k);
30     ~GCall();
31
32     template<typename... Ts>
33     GCall& pass(Ts&&... args)
34     {
35         setArgs({cv::GArg(std::move(args))...});
36         return *this;
37     }
38
39     // A generic yield method - obtain a link to operator's particular GMat output
40     GMat    yield      (int output = 0);
41     GScalar yieldScalar(int output = 0);
42
43     template<class T> GArray<T> yieldArray(int output = 0)
44     {
45         return GArray<T>(yieldArray(output));
46     }
47
48     // Internal use only
49     Priv& priv();
50     const Priv& priv() const;
51
52 protected:
53     std::shared_ptr<Priv> m_priv;
54
55     void setArgs(std::vector<GArg> &&args);
56
57     // Public version returns a typed array, this one is implementation detail
58     detail::GArrayU yieldArray(int output = 0);
59 };
60
61 } // namespace cv
62
63 #endif // OPENCV_GAPI_GCALL_HPP