Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / inference_engine / cpp_interfaces / impl / ie_executable_network_internal.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include <vector>
8 #include <memory>
9 #include <map>
10 #include <string>
11 #include <ie_plugin_ptr.hpp>
12 #include "cpp_interfaces/interface/ie_iinfer_request_internal.hpp"
13 #include "cpp_interfaces/interface/ie_iexecutable_network_internal.hpp"
14 #include "cpp_interfaces/impl/ie_infer_request_internal.hpp"
15 #include "cpp_interfaces/impl/ie_infer_async_request_internal.hpp"
16
17 namespace InferenceEngine {
18
19 class InferencePluginInternal;
20
21 typedef std::shared_ptr<InferencePluginInternal> InferencePluginInternalPtr;
22
23 /**
24  * @brief minimum API to be implemented by plugin, which is used in ExecutableNetworkBase forwarding mechanism
25  */
26 class ExecutableNetworkInternal : public IExecutableNetworkInternal {
27 public:
28     typedef std::shared_ptr<ExecutableNetworkInternal> Ptr;
29
30     virtual void setNetworkInputs(const InferenceEngine::InputsDataMap networkInputs) {
31         _networkInputs = networkInputs;
32     }
33
34     virtual void setNetworkOutputs(const InferenceEngine::OutputsDataMap networkOutputs) {
35         _networkOutputs = networkOutputs;
36     }
37
38     ConstOutputsDataMap GetOutputsInfo() const override {
39         ConstOutputsDataMap outputMap;
40         for (const auto & output : _networkOutputs) {
41             outputMap[output.first] = output.second;
42         }
43         return outputMap;
44     }
45
46     ConstInputsDataMap GetInputsInfo() const override {
47         ConstInputsDataMap  inputMap;
48         for (const auto & input : _networkInputs) {
49             inputMap[input.first] = input.second;
50         }
51         return inputMap;
52     }
53
54     void Export(const std::string &modelFileName) override {
55         THROW_IE_EXCEPTION << NOT_IMPLEMENTED_str;
56     }
57
58     void GetMappedTopology(std::map<std::string, std::vector<PrimitiveInfo::Ptr>> &deployedTopology) override {
59         THROW_IE_EXCEPTION << NOT_IMPLEMENTED_str;
60     }
61
62     void GetExecGraphInfo(InferenceEngine::ICNNNetwork::Ptr &graphPtr) override {
63         THROW_IE_EXCEPTION << NOT_IMPLEMENTED_str;
64     }
65
66     void SetPointerToPluginInternal(InferencePluginInternalPtr plugin) {
67         _plugin = plugin;
68     }
69
70     std::vector<IMemoryStateInternal::Ptr>  QueryState() override {
71         // meaning base plugin reports as no state available - plugin owners need to create proper override of this
72         return {};
73     }
74
75
76 protected:
77     InferenceEngine::InputsDataMap _networkInputs;
78     InferenceEngine::OutputsDataMap _networkOutputs;
79
80     InferencePluginInternalPtr _plugin;
81 };
82
83 }  // namespace InferenceEngine