22 class ICompletionCallbackWrapper {
24 virtual ~ICompletionCallbackWrapper() =
default;
30 class CompletionCallbackWrapper :
public ICompletionCallbackWrapper {
33 explicit CompletionCallbackWrapper(
const T &lambda) : lambda(lambda) {}
42 class CompletionCallbackWrapper<IInferRequest::CompletionCallback> :
public ICompletionCallbackWrapper {
48 callBack(request, code);
62 std::shared_ptr<details::ICompletionCallbackWrapper> callback;
65 details::ICompletionCallbackWrapper *pWrapper =
nullptr;
67 request->GetUserData(reinterpret_cast<void**>(&pWrapper), &dsc);
68 pWrapper->call(request, code);
91 CALL_STATUS_FNC(SetBlob, name.c_str(), data);
100 CALL_STATUS_FNC(GetBlob, name.c_str(), data);
101 std::string error =
"Internal error: blob with name `" + name +
"` is not allocated!";
102 auto blobPtr = data.get();
113 CALL_STATUS_FNC_NO_ARGS(Infer);
121 std::map<std::string, InferenceEngineProfileInfo> perfMap;
122 CALL_STATUS_FNC(GetPerformanceCounts, perfMap);
133 for (
auto &&input : inputs) {
134 CALL_STATUS_FNC(SetBlob, input.first.c_str(), input.second);
145 for (
auto &&result : results) {
146 CALL_STATUS_FNC(SetBlob, result.first.c_str(), result.second);
155 CALL_STATUS_FNC(SetBatch, batch);
164 : actual(request), plg(plg) {}
171 CALL_STATUS_FNC_NO_ARGS(StartAsync);
179 return actual->Wait(millis_timeout,
nullptr);
190 callback.reset(
new details::CompletionCallbackWrapper<T>(callbackToSet));
191 CALL_STATUS_FNC(SetUserData, callback.get());
192 actual->SetCompletionCallback(callWrapper);
214 explicit operator bool() const noexcept {
221 using Ptr = std::shared_ptr<InferRequest>;
227 class CompletionCallbackWrapper<std::function<void(InferRequest, StatusCode)>>
228 :
public ICompletionCallbackWrapper {
229 std::function<void(InferRequest, StatusCode)> lambda;
InferRequest(IInferRequest::Ptr request, InferenceEnginePluginPtr plg={})
Definition: ie_infer_request.hpp:163
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:22
InferenceEngine::details::SOPointer< IInferencePlugin > InferenceEnginePluginPtr
A C++ helper to work with objects created by the plugin. Implements different interfaces.
Definition: ie_plugin_ptr.hpp:52
void StartAsync()
Start inference of specified input(s) in asynchronous mode.
Definition: ie_infer_request.hpp:170
bool operator!() const noexcept
Checks if current InferRequest object is not initialized.
Definition: ie_infer_request.hpp:206
Definition: ie_argmax_layer.hpp:11
Blob::Ptr GetBlob(const std::string &name)
Wraps original method IInferRequest::GetBlob.
Definition: ie_infer_request.hpp:98
StatusCode Wait(int64_t millis_timeout)
Wraps original method IInferRequest::Wait.
Definition: ie_infer_request.hpp:178
A header file that provides macros to handle no exception methods.
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:205
void SetInput(const BlobMap &inputs)
Sets input data to infer.
Definition: ie_infer_request.hpp:132
A header file contains a wrapper class for handling plugin instantiation and releasing resources...
void SetOutput(const BlobMap &results)
Sets data that will contain result of the inference.
Definition: ie_infer_request.hpp:144
void SetBlob(const std::string &name, const Blob::Ptr &data)
Sets input/output data to infer.
Definition: ie_infer_request.hpp:90
a header file for IInferRequest interface
This class is a wrapper of IInferRequest to provide setters/getters of input/output which operates wi...
Definition: ie_infer_request.hpp:59
void SetCompletionCallback(const T &callbackToSet)
Wraps original method IInferRequest::SetCompletionCallback.
Definition: ie_infer_request.hpp:189
std::shared_ptr< InferRequest > Ptr
A smart pointer to the InferRequest object.
Definition: ie_infer_request.hpp:221
Represents detailed information for an error.
Definition: ie_common.h:228
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:40
std::map< std::string, Blob::Ptr > BlobMap
This is a convenient type for working with a map containing pairs(string, pointer to a Blob instance)...
Definition: ie_blob.h:478
void(* CompletionCallback)(InferenceEngine::IInferRequest::Ptr context, InferenceEngine::StatusCode code)
Completion callback definition as pointer to a function.
Definition: ie_iinfer_request.hpp:114
std::map< std::string, InferenceEngineProfileInfo > GetPerformanceCounts() const
Wraps original method IInferRequest::GetPerformanceCounts.
Definition: ie_infer_request.hpp:120
void Infer()
Wraps original method IInferRequest::Infer.
Definition: ie_infer_request.hpp:112
void SetBatch(const int batch)
Sets new batch size when dynamic batching is enabled in executable network that created this request...
Definition: ie_infer_request.hpp:154
~InferRequest()
Destructor.
Definition: ie_infer_request.hpp:80
std::shared_ptr< IInferRequest > Ptr
A shared pointer to the IInferRequest object.
Definition: ie_iinfer_request.hpp:39