1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2019 Intel Corporation
#ifndef OPENCV_GAPI_GCOMPUTATION_ASYNC_HPP
#define OPENCV_GAPI_GCOMPUTATION_ASYNC_HPP
#include <future> //for std::future
#include <exception> //for std::exception_ptr
#include <functional> //for std::function
#include <opencv2/gapi/garg.hpp> //for GRunArgs, GRunArgsP
#include <opencv2/gapi/gcommon.hpp> //for GCompileArgs
#include <opencv2/gapi/own/exports.hpp>
namespace cv {
//fwd declaration
class GComputation;
namespace gapi {
namespace wip {
class GAsyncContext;
/** In contrast to async() functions, these do call GComputation::apply() member function of the GComputation passed in.
@param gcomp Computation (graph) to run asynchronously
@param callback Callback to be called when execution of gcomp is done
@param ins Input parameters for gcomp
@param outs Output parameters for gcomp
@param args Compile arguments to pass to GComputation::apply()
@see async
*/
GAPI_EXPORTS void async_apply(GComputation& gcomp, std::function<void(std::exception_ptr)>&& callback, GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args = {});
/** @overload
@param gcomp Computation (graph) to run asynchronously
@param callback Callback to be called when execution of gcomp is done
@param ins Input parameters for gcomp
@param outs Output parameters for gcomp
@param args Compile arguments to pass to GComputation::apply()
@param ctx Context this request belongs to
@see async_apply async GAsyncContext
*/
GAPI_EXPORTS void async_apply(GComputation& gcomp, std::function<void(std::exception_ptr)>&& callback, GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args, GAsyncContext& ctx);
/** @overload
@param gcomp Computation (graph) to run asynchronously
@param ins Input parameters for gcomp
@param outs Output parameters for gcomp
@param args Compile arguments to pass to GComputation::apply()
@return std::future<void> object to wait for completion of async operation
@see async_apply async
*/
GAPI_EXPORTS std::future<void> async_apply(GComputation& gcomp, GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args = {});
/** @overload
@param gcomp Computation (graph) to run asynchronously
@param ins Input parameters for gcomp
@param outs Output parameters for gcomp
@param args Compile arguments to pass to GComputation::apply()
@param ctx Context this request belongs to
@return std::future<void> object to wait for completion of async operation
@see async_apply async GAsyncContext
*/
GAPI_EXPORTS std::future<void> async_apply(GComputation& gcomp, GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args, GAsyncContext& ctx);
} // namespace wip
} // namespace gapi
} // namespace cv
#endif //OPENCV_GAPI_GCOMPUTATION_ASYNC_HPP