Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / inference_engine / cpp_interfaces / interface / ie_iinfer_async_request_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 <map>
9 #include <string>
10 #include <ie_iinfer_request.hpp>
11 #include "ie_iinfer_request_internal.hpp"
12
13 namespace InferenceEngine {
14
15 /**
16  * @brief minimum API to be implemented by plugin, which is used in InferRequestBase forwarding mechanism
17  */
18 class IAsyncInferRequestInternal : virtual public IInferRequestInternal {
19 public:
20     typedef std::shared_ptr<IAsyncInferRequestInternal> Ptr;
21
22     virtual ~IAsyncInferRequestInternal() = default;
23
24     /**
25      * @brief Start inference of specified input(s) in asynchronous mode
26      * @note: It returns immediately. Inference starts also immediately.
27      */
28     virtual void StartAsync() = 0;
29
30     /**
31      * @brief Waits for the result to become available. Blocks until specified millis_timeout has elapsed or the result becomes available, whichever comes first.
32      * @param millis_timeout - maximum duration in milliseconds to block for
33      * @note There are special cases when millis_timeout is equal some value of WaitMode enum:
34      * * STATUS_ONLY - immediately returns request status (IInferRequest::RequestStatus). It doesn't block or interrupt current thread.
35      * * RESULT_READY - waits until inference result becomes available
36      */
37     virtual StatusCode Wait(int64_t millis_timeout) = 0;
38
39     /**
40      * @brief Get arbitrary data for the request
41      * @param data - pointer to a pointer to arbitrary data
42      */
43     virtual void GetUserData(void **data) = 0;
44
45     /**
46      * @brief Set arbitrary data for the request
47      * @param data - pointer to a pointer to arbitrary data
48      */
49     virtual void SetUserData(void *data) = 0;
50
51     /**
52      * @brief Set callback function which will be called on success or failure of asynchronous request
53      * @param callback - function to be called with the following description:
54      * * @param context - pointer to request for providing context inside callback
55      * * @param resp - Optional: a pointer to an already allocated object to contain extra information of a failure (if occurred)
56      * * @return Enumeration of the resulted action: OK (0) for success.
57      */
58     virtual void SetCompletionCallback(IInferRequest::CompletionCallback callback) = 0;
59 };
60
61 }  // namespace InferenceEngine