EstervQrCode 1.1.1
Library for qr code manipulation
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 //#include <future>
11 #include <chrono>
12 
13 namespace cv {
14 
30 {
31 public:
35  AsyncArray& operator=(const AsyncArray& o) CV_NOEXCEPT;
36  CV_WRAP void release() CV_NOEXCEPT;
37 
48  CV_WRAP void get(OutputArray dst) const;
49 
58  bool get(OutputArray dst, int64 timeoutNs) const;
59 
60  CV_WRAP inline
61  bool get(OutputArray dst, double timeoutNs) const { return get(dst, (int64)timeoutNs); }
62 
63  bool wait_for(int64 timeoutNs) const;
64 
65  CV_WRAP inline
66  bool wait_for(double timeoutNs) const { return wait_for((int64)timeoutNs); }
67 
68  CV_WRAP bool valid() const CV_NOEXCEPT;
69 
70  inline AsyncArray(AsyncArray&& o) { p = o.p; o.p = NULL; }
71  inline AsyncArray& operator=(AsyncArray&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; }
72 
73  template<typename _Rep, typename _Period>
75  {
76  return get(dst, (int64)(std::chrono::nanoseconds(timeout).count()));
77  }
78 
79  template<typename _Rep, typename _Period>
80  inline bool wait_for(const std::chrono::duration<_Rep, _Period>& timeout)
81  {
82  return wait_for((int64)(std::chrono::nanoseconds(timeout).count()));
83  }
84 
85 #if 0
86  std::future<Mat> getFutureMat() const;
87  std::future<UMat> getFutureUMat() const;
88 #endif
89 
90 
91  // PImpl
92  struct Impl; friend struct Impl;
93  inline void* _getImpl() const CV_NOEXCEPT { return p; }
94 protected:
95  Impl* p;
96 };
97 
98 
100 } // namespace
101 #endif // OPENCV_CORE_ASYNC_HPP
Returns result of asynchronous operations.
Definition: async.hpp:30
CV_WRAP bool wait_for(double timeoutNs) const
Definition: async.hpp:66
AsyncArray & operator=(AsyncArray &&o) CV_NOEXCEPT
Definition: async.hpp:71
void * _getImpl() const CV_NOEXCEPT
Definition: async.hpp:93
Impl * p
Definition: async.hpp:95
bool wait_for(int64 timeoutNs) const
~AsyncArray() CV_NOEXCEPT
bool wait_for(const std::chrono::duration< _Rep, _Period > &timeout)
Definition: async.hpp:80
CV_WRAP bool valid() const CV_NOEXCEPT
bool get(OutputArray dst, const std::chrono::duration< _Rep, _Period > &timeout)
Definition: async.hpp:74
CV_WRAP bool get(OutputArray dst, double timeoutNs) const
Definition: async.hpp:61
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:296
int count
Definition: core_c.h:1413
int64_t int64
Definition: interface.h:61
#define CV_EXPORTS_W
Definition: cvdef.h:472
#define CV_NOEXCEPT
Definition: cvdef.h:800
#define CV_WRAP
Definition: cvdef.h:481
OutputArray dst
Definition: imgproc.hpp:3564
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441
T swap(T... args)