ie_iinfer_async_request_internal.hpp
1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include <ie_iinfer_request.hpp>
8 #include <map>
9 #include <memory>
10 #include <string>
11 
12 #include "ie_iinfer_request_internal.hpp"
13 
14 namespace InferenceEngine {
15 
16 /**
17  * @interface IAsyncInferRequestInternal
18  * @ingroup ie_dev_api_async_infer_request_api
19  * @brief An internal API of asynchronous inference request to be implemented by plugin,
20  * which is used in InferRequestBase forwarding mechanism
21  */
23 public:
24  /**
25  * @brief A shared pointer to IAsyncInferRequestInternal interface
26  */
27  typedef std::shared_ptr<IAsyncInferRequestInternal> Ptr;
28 
29  /**
30  * @brief A virtual destructor
31  */
32  virtual ~IAsyncInferRequestInternal() = default;
33 
34  /**
35  * @brief Start inference of specified input(s) in asynchronous mode
36  * @note The method returns immediately. Inference starts also immediately.
37  */
38  virtual void StartAsync() = 0;
39 
40  /**
41  * @brief Waits for the result to become available. Blocks until specified millis_timeout has elapsed or the result
42  * becomes available, whichever comes first.
43  * @param millis_timeout - maximum duration in milliseconds to block for
44  * @note There are special cases when millis_timeout is equal some value of WaitMode enum:
45  * * STATUS_ONLY - immediately returns request status (IInferRequest::RequestStatus). It doesn't block or interrupt
46  * current thread.
47  * * RESULT_READY - waits until inference result becomes available
48  * @return A status code
49  */
50  virtual StatusCode Wait(int64_t millis_timeout) = 0;
51 
52  /**
53  * @brief Get arbitrary data for the request
54  * @param data A pointer to a pointer to arbitrary data
55  */
56  virtual void GetUserData(void** data) = 0;
57 
58  /**
59  * @brief Set arbitrary data for the request
60  * @param data A pointer to a pointer to arbitrary data
61  */
62  virtual void SetUserData(void* data) = 0;
63 
64  /**
65  * @brief Set callback function which will be called on success or failure of asynchronous request
66  * @param callback - function to be called with the following description:
67  */
69 };
70 
71 } // namespace InferenceEngine
An internal API of asynchronous inference request to be implemented by plugin, which is used in Infer...
Definition: ie_iinfer_async_request_internal.hpp:22
virtual void GetUserData(void **data)=0
Get arbitrary data for the request.
virtual void SetUserData(void *data)=0
Set arbitrary data for the request.
virtual ~IAsyncInferRequestInternal()=default
A virtual destructor.
virtual StatusCode Wait(int64_t millis_timeout)=0
Waits for the result to become available. Blocks until specified millis_timeout has elapsed or the re...
virtual void SetCompletionCallback(IInferRequest::CompletionCallback callback)=0
Set callback function which will be called on success or failure of asynchronous request.
std::shared_ptr< IAsyncInferRequestInternal > Ptr
A shared pointer to IAsyncInferRequestInternal interface.
Definition: ie_iinfer_async_request_internal.hpp:27
virtual void StartAsync()=0
Start inference of specified input(s) in asynchronous mode.
An internal API of synchronous inference request to be implemented by plugin, which is used in InferR...
Definition: ie_iinfer_request_internal.hpp:24
void(* CompletionCallback)(InferenceEngine::IInferRequest::Ptr context, InferenceEngine::StatusCode code)
Inference Engine Plugin API namespace.