Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / gna_plugin / gna_plugin_internal.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include <memory>
8 #include <string>
9 #include <map>
10 #include <cpp_interfaces/impl/ie_plugin_internal.hpp>
11 #include <cpp_interfaces/impl/ie_executable_network_internal.hpp>
12 #include "gna_executable_network.hpp"
13
14 namespace GNAPluginNS {
15
16 class GNAPluginInternal  : public InferenceEngine::InferencePluginInternal {
17  public:
18     InferenceEngine::ExecutableNetworkInternal::Ptr LoadExeNetworkImpl(
19                                                 InferenceEngine::ICNNNetwork &network,
20                                                 const std::map<std::string, std::string> &config) override {
21         return std::make_shared<GNAExecutableNetwork>(network, config);
22     }
23     void SetConfig(const std::map<std::string, std::string> &config) override {
24         auto plg = std::make_shared<GNAPlugin>();
25         plg->SetConfig(config);
26     }
27     InferenceEngine::IExecutableNetwork::Ptr  ImportNetwork(
28                                                 const std::string &modelFileName,
29                                                 const std::map<std::string, std::string> &config) override {
30         return make_executable_network(std::make_shared<GNAExecutableNetwork>(modelFileName, config));
31     }
32
33     /**
34      * @depricated Use the version with config parameter
35      */
36     void QueryNetwork(const InferenceEngine::ICNNNetwork& network,
37                       InferenceEngine::QueryNetworkResult& res) const override {
38         auto plg = std::make_shared<GNAPlugin>();
39         plg->QueryNetwork(network, {}, res);
40     }
41     void QueryNetwork(const InferenceEngine::ICNNNetwork& network,
42                       const std::map<std::string, std::string>& config,
43                       InferenceEngine::QueryNetworkResult& res) const override {
44         auto plg = std::make_shared<GNAPlugin>();
45         try {
46             plg->SetConfig(config);
47         } catch (InferenceEngine::details::InferenceEngineException& e) {}
48         plg->QueryNetwork(network, config, res);
49     }
50 };
51
52 }  // namespace GNAPluginNS