Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / src / compiler / gcompiled_priv.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_GCOMPILED_PRIV_HPP
9 #define OPENCV_GAPI_GCOMPILED_PRIV_HPP
10
11 #include <memory> // unique_ptr
12
13 #include "opencv2/gapi/util/optional.hpp"
14 #include "compiler/gmodel.hpp"
15 #include "executor/gexecutor.hpp"
16
17 // NB: BTW, GCompiled is the only "public API" class which
18 // private part (implementaion) is hosted in the "compiler/" module.
19 //
20 // This file is here just to keep ADE hidden from the top-level APIs.
21 //
22 // As the thing becomes more complex, appropriate API and implementation
23 // part will be placed to api/ and compiler/ modules respectively.
24
25 namespace cv {
26
27 namespace gimpl
28 {
29     struct GRuntimeArgs;
30 };
31
32 // FIXME: GAPI_EXPORTS is here only due to tests and Windows linker issues
33 class GAPI_EXPORTS GCompiled::Priv
34 {
35     // NB: For now, a GCompiled keeps the original ade::Graph alive.
36     // If we want to go autonomous, we might to do something with this.
37     GMetaArgs  m_metas;    // passed by user
38     GMetaArgs  m_outMetas; // inferred by compiler
39     std::unique_ptr<cv::gimpl::GExecutor> m_exec;
40
41     void checkArgs(const cv::gimpl::GRuntimeArgs &args) const;
42
43 public:
44     void setup(const GMetaArgs &metaArgs,
45                const GMetaArgs &outMetas,
46                std::unique_ptr<cv::gimpl::GExecutor> &&pE);
47     bool isEmpty() const;
48
49     bool canReshape() const;
50     void reshape(const GMetaArgs& inMetas, const GCompileArgs &args);
51
52     void run(cv::gimpl::GRuntimeArgs &&args);
53     const GMetaArgs& metas() const;
54     const GMetaArgs& outMetas() const;
55
56     const cv::gimpl::GModel::Graph& model() const;
57 };
58
59 }
60
61 #endif // OPENCV_GAPI_GCOMPILED_PRIV_HPP