OpenCV453
async.hpp
1// This file is part of OpenCV project.
2// It is subject to the license terms in the LICENSE file found in the top-level directory
3// of this distribution and at http://opencv.org/license.html.
4
5#ifndef OPENCV_CORE_ASYNC_HPP
6#define OPENCV_CORE_ASYNC_HPP
7
8#include <opencv2/core/mat.hpp>
9
10#ifdef CV_CXX11
11//#include <future>
12#include <chrono>
13#endif
14
15namespace cv {
16
31class CV_EXPORTS_W AsyncArray
32{
33public:
34 ~AsyncArray() CV_NOEXCEPT;
35 CV_WRAP AsyncArray() CV_NOEXCEPT;
36 AsyncArray(const AsyncArray& o) CV_NOEXCEPT;
37 AsyncArray& operator=(const AsyncArray& o) CV_NOEXCEPT;
38 CV_WRAP void release() CV_NOEXCEPT;
39
50 CV_WRAP void get(OutputArray dst) const;
51
60 bool get(OutputArray dst, int64 timeoutNs) const;
61
62 CV_WRAP inline
63 bool get(OutputArray dst, double timeoutNs) const { return get(dst, (int64)timeoutNs); }
64
65 bool wait_for(int64 timeoutNs) const;
66
67 CV_WRAP inline
68 bool wait_for(double timeoutNs) const { return wait_for((int64)timeoutNs); }
69
70 CV_WRAP bool valid() const CV_NOEXCEPT;
71
72#ifdef CV_CXX11
73 inline AsyncArray(AsyncArray&& o) { p = o.p; o.p = NULL; }
74 inline AsyncArray& operator=(AsyncArray&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; }
75
76 template<typename _Rep, typename _Period>
77 inline bool get(OutputArray dst, const std::chrono::duration<_Rep, _Period>& timeout)
78 {
79 return get(dst, (int64)(std::chrono::nanoseconds(timeout).count()));
80 }
81
82 template<typename _Rep, typename _Period>
83 inline bool wait_for(const std::chrono::duration<_Rep, _Period>& timeout)
84 {
85 return wait_for((int64)(std::chrono::nanoseconds(timeout).count()));
86 }
87
88#if 0
89 std::future<Mat> getFutureMat() const;
90 std::future<UMat> getFutureUMat() const;
91#endif
92#endif
93
94
95 // PImpl
96 struct Impl; friend struct Impl;
97 inline void* _getImpl() const CV_NOEXCEPT { return p; }
98protected:
99 Impl* p;
100};
101
102
104} // namespace
105#endif // OPENCV_CORE_ASYNC_HPP
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
Returns result of asynchronous operations
Definition: async.hpp:32
bool get(OutputArray dst, int64 timeoutNs) const
CV_EXPORTS void swap(Mat &a, Mat &b)
Swaps two matrices
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75