23 class ICompletionCallbackWrapper {
25 virtual ~ICompletionCallbackWrapper() =
default;
31 class CompletionCallbackWrapper :
public ICompletionCallbackWrapper {
35 explicit CompletionCallbackWrapper(
const T& lambda): lambda(lambda) {}
44 class CompletionCallbackWrapper<IInferRequest::CompletionCallback> :
public ICompletionCallbackWrapper {
51 callBack(request, code);
65 std::shared_ptr<details::ICompletionCallbackWrapper> callback;
68 details::ICompletionCallbackWrapper* pWrapper =
nullptr;
70 request->GetUserData(reinterpret_cast<void**>(&pWrapper), &dsc);
71 pWrapper->call(request, code);
95 CALL_STATUS_FNC(SetBlob, name.c_str(), data);
104 CALL_STATUS_FNC(GetBlob, name.c_str(), data);
105 std::string error =
"Internal error: blob with name `" + name +
"` is not allocated!";
106 auto blobPtr = data.get();
117 CALL_STATUS_FNC_NO_ARGS(Infer);
125 std::map<std::string, InferenceEngineProfileInfo> perfMap;
126 CALL_STATUS_FNC(GetPerformanceCounts, perfMap);
137 for (
auto&& input : inputs) {
138 CALL_STATUS_FNC(SetBlob, input.first.c_str(), input.second);
149 for (
auto&& result : results) {
150 CALL_STATUS_FNC(SetBlob, result.first.c_str(), result.second);
159 CALL_STATUS_FNC(SetBatch, batch);
174 CALL_STATUS_FNC_NO_ARGS(StartAsync);
183 auto res = actual->Wait(millis_timeout, &resp);
184 if (res != OK && res != RESULT_NOT_READY && res != INFER_NOT_STARTED) {
185 InferenceEngine::details::extract_exception(res, resp.
msg);
198 callback.reset(
new details::CompletionCallbackWrapper<T>(callbackToSet));
199 CALL_STATUS_FNC(SetUserData, callback.get());
200 actual->SetCompletionCallback(callWrapper);
222 explicit operator bool() const noexcept {
229 using Ptr = std::shared_ptr<InferRequest>;
235 class CompletionCallbackWrapper<std::function<void(InferRequest, StatusCode)>> :
public ICompletionCallbackWrapper {
236 std::function<void(InferRequest, StatusCode)> lambda;
InferRequest(IInferRequest::Ptr request, InferenceEnginePluginPtr plg={})
Definition: ie_infer_request.hpp:167
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:24
void StartAsync()
Start inference of specified input(s) in asynchronous mode.
Definition: ie_infer_request.hpp:173
bool operator!() const noexcept
Checks if current InferRequest object is not initialized.
Definition: ie_infer_request.hpp:214
InferenceEngine::details::SOPointer< IInferencePlugin > InferenceEnginePluginPtr
A C++ helper to work with objects created by the plugin. Implements different interfaces.
Definition: ie_plugin_ptr.hpp:41
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:344
Inference Engine API.
Definition: ie_argmax_layer.hpp:11
Blob::Ptr GetBlob(const std::string &name)
Wraps original method IInferRequest::GetBlob.
Definition: ie_infer_request.hpp:102
StatusCode Wait(int64_t millis_timeout)
Wraps original method IInferRequest::Wait.
Definition: ie_infer_request.hpp:181
A header file that provides macros to handle no exception methods.
void SetInput(const BlobMap &inputs)
Sets input data to infer.
Definition: ie_infer_request.hpp:136
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:148
void SetBlob(const std::string &name, const Blob::Ptr &data)
Sets input/output data to infer.
Definition: ie_infer_request.hpp:94
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:62
void SetCompletionCallback(const T &callbackToSet)
Wraps original method IInferRequest::SetCompletionCallback.
Definition: ie_infer_request.hpp:197
std::shared_ptr< InferRequest > Ptr
A smart pointer to the InferRequest object.
Definition: ie_infer_request.hpp:229
Represents detailed information for an error.
Definition: ie_common.h:235
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:212
std::shared_ptr< Blob > Ptr
A smart pointer containing Blob object.
Definition: ie_blob.h:40
void(* CompletionCallback)(InferenceEngine::IInferRequest::Ptr context, InferenceEngine::StatusCode code)
Completion callback definition as pointer to a function.
Definition: ie_iinfer_request.hpp:121
std::map< std::string, InferenceEngineProfileInfo > GetPerformanceCounts() const
Wraps original method IInferRequest::GetPerformanceCounts.
Definition: ie_infer_request.hpp:124
void Infer()
Wraps original method IInferRequest::Infer.
Definition: ie_infer_request.hpp:116
char msg[256]
A character buffer that holds the detailed information for an error.
Definition: ie_common.h:239
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:158
~InferRequest()
Destructor.
Definition: ie_infer_request.hpp:83
std::shared_ptr< IInferRequest > Ptr
A shared pointer to the IInferRequest object.
Definition: ie_iinfer_request.hpp:41