ie_plugin.hpp
Go to the documentation of this file.
1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief A header file for Main Inference Engine API
7  *
8  * @file ie_plugin.hpp
9  */
10 #pragma once
11 
12 #include <ie_iextension.h>
13 
14 #include <ie_icnn_network.hpp>
15 #include <map>
16 #include <memory>
17 #include <set>
18 #include <string>
19 #include <vector>
20 
21 #include "details/ie_no_copy.hpp"
22 #include "ie_api.h"
23 #include "ie_core.hpp"
24 #include "ie_error.hpp"
26 #include "ie_version.hpp"
27 
28 namespace InferenceEngine {
29 
30 /**
31  * @deprecated Use InferenceEngine::Core instead. Will be removed in 2021.1
32  * @brief This class is a main plugin interface
33  */
34 class INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::Core instead. Will be removed in 2021.1")
35  INFERENCE_ENGINE_API_CLASS(IInferencePlugin)
36  : public details::IRelease {
37 public:
38  /**
39  * @brief Returns plugin version information
40  *
41  * @param versionInfo Pointer to version info. Is set by plugin
42  */
43  virtual void GetVersion(const Version*& versionInfo) noexcept = 0;
44 
45  /**
46  * @deprecated IErrorListener is not used anymore. StatusCode is provided in case of unexpected situations
47  * This API will be removed in 2021.1 release.
48  * @brief Sets logging callback
49  *
50  * Logging is used to track what is going on inside
51  * @param listener Logging sink
52  */
53  IE_SUPPRESS_DEPRECATED_START
54  INFERENCE_ENGINE_DEPRECATED("IErrorListener is not used anymore. StatusCode is provided in case of unexpected situations")
55  virtual void SetLogCallback(IErrorListener& listener) noexcept = 0;
56  IE_SUPPRESS_DEPRECATED_END
57 
58  /**
59  * @brief Creates an executable network from a network object. User can create as many networks as they need and use
60  * them simultaneously (up to the limitation of the hardware resources)
61  *
62  * @param ret Reference to a shared ptr of the returned network interface
63  * @param network Network object acquired from Core::ReadNetwork
64  * @param config Map of pairs: (config parameter name, config parameter value) relevant only for this load operation
65  * @param resp Pointer to the response message that holds a description of an error if any occurred
66  * @return Status code of the operation. InferenceEngine::OK if succeeded
67  */
68  virtual StatusCode LoadNetwork(IExecutableNetwork::Ptr& ret, const ICNNNetwork& network,
69  const std::map<std::string, std::string>& config, ResponseDesc* resp) noexcept = 0;
70 
71  /**
72  * @brief Creates an executable network from a previously exported network
73  *
74  * @param ret Reference to a shared ptr of the returned network interface
75  * @param modelFileName Path to the location of the exported file
76  * @param config Map of pairs: (config parameter name, config parameter value) relevant only for this load
77  * operation*
78  * @param resp Pointer to the response message that holds a description of an error if any occurred
79  * @return Status code of the operation. InferenceEngine::OK if succeeded
80  */
81  virtual StatusCode ImportNetwork(IExecutableNetwork::Ptr& ret, const std::string& modelFileName,
82  const std::map<std::string, std::string>& config, ResponseDesc* resp) noexcept = 0;
83 
84  /**
85  * @brief Registers extension within the plugin
86  *
87  * @param extension Pointer to already loaded extension
88  * @param resp Pointer to the response message that holds a description of an error if any occurred
89  * @return Status code of the operation. InferenceEngine::OK if succeeded
90  */
91  virtual StatusCode AddExtension(InferenceEngine::IExtensionPtr extension,
92  InferenceEngine::ResponseDesc* resp) noexcept = 0;
93 
94  /**
95  * @brief Sets configuration for plugin, acceptable keys can be found in ie_plugin_config.hpp
96  *
97  * @param config Map of pairs: (config parameter name, config parameter value)
98  * @param resp Pointer to the response message that holds a description of an error if any occurred
99  * @return Status code of the operation. InferenceEngine::OK if succeeded
100  */
101  virtual StatusCode SetConfig(const std::map<std::string, std::string>& config, ResponseDesc* resp) noexcept = 0;
102 
103  /**
104  * @brief Query plugin if it supports specified network with specified configuration
105  *
106  * @param network Network object to query
107  * @param config Map of pairs: (config parameter name, config parameter value)
108  * @param res Reference to query network result
109  */
110  virtual void QueryNetwork(const ICNNNetwork& network, const std::map<std::string, std::string>& config,
111  QueryNetworkResult& res) const noexcept {
112  (void)network;
113  (void)config;
114  res.rc = InferenceEngine::NOT_IMPLEMENTED;
115  }
116 
117  /**
118  * @brief A default virtual destructor
119  */
120  ~IInferencePlugin() override;
121 };
122 
123 /**
124  * @brief Creates the default instance of the interface (per plugin)
125  *
126  * @param plugin Pointer to the plugin
127  * @param resp Pointer to the response message that holds a description of an error if any occurred
128  * @return Status code of the operation. InferenceEngine::OK if succeeded
129  */
130 IE_SUPPRESS_DEPRECATED_START
131 INFERENCE_PLUGIN_API(StatusCode) CreatePluginEngine(IInferencePlugin*& plugin, ResponseDesc* resp) noexcept;
132 IE_SUPPRESS_DEPRECATED_END
133 
134 } // namespace InferenceEngine
This class represents Inference Engine Core entity.
Definition: ie_core.hpp:51
A header file that provides versioning information for the inference engine shared library...
A header file for a plugin logging mechanism.
Definition: cldnn_config.hpp:16
Represents version information that describes plugins and the inference engine runtime library...
Definition: ie_version.hpp:21
a header file for IExecutableNetwork interface
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:224
This is a header file for the ICNNNetwork class.
This is a header file for the Inference Engine Core class C++ API.
Represents detailed information for an error.
Definition: ie_common.h:247
StatusCode CreatePluginEngine(IInferencePlugin *&plugin, ResponseDesc *resp) noexcept
Creates the default instance of the interface (per plugin)
This class is a main plugin interface.
Definition: ie_plugin.hpp:34
This is the main interface to describe the NN topology.
Definition: ie_icnn_network.hpp:43
The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS...
This is a header file for Inference Engine Extension Interface.
std::shared_ptr< IExtension > IExtensionPtr
A shared pointer to a IExtension interface.
Definition: ie_iextension.h:359
This class represents a custom error listener.
Definition: ie_error.hpp:18
header file for no_copy class
virtual void QueryNetwork(const ICNNNetwork &network, const std::map< std::string, std::string > &config, QueryNetworkResult &res) const noexcept
Query plugin if it supports specified network with specified configuration.
Definition: ie_plugin.hpp:110
std::shared_ptr< IExecutableNetwork > Ptr
A smart pointer to the current IExecutableNetwork object.
Definition: ie_iexecutable_network.hpp:41
Responce structure encapsulating information about supported layer.
Definition: ie_core.hpp:27