hc
2023-05-26 a23f51ed7a39e452c1037343a84d7db1ca2c5bd7
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
70
71
// 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.
 
#ifndef OPENCV_CORE_ASYNC_PROMISE_HPP
#define OPENCV_CORE_ASYNC_PROMISE_HPP
 
#include "../async.hpp"
 
#include "exception_ptr.hpp"
 
namespace cv {
 
/** @addtogroup core_async
@{
*/
 
 
/** @brief Provides result of asynchronous operations
 
*/
class CV_EXPORTS AsyncPromise
{
public:
    ~AsyncPromise() CV_NOEXCEPT;
    AsyncPromise() CV_NOEXCEPT;
    explicit AsyncPromise(const AsyncPromise& o) CV_NOEXCEPT;
    AsyncPromise& operator=(const AsyncPromise& o) CV_NOEXCEPT;
    void release() CV_NOEXCEPT;
 
    /** Returns associated AsyncArray
    @note Can be called once
    */
    AsyncArray getArrayResult();
 
    /** Stores asynchronous result.
    @param[in] value result
    */
    void setValue(InputArray value);
 
    // TODO "move" setters
 
#if CV__EXCEPTION_PTR
    /** Stores exception.
    @param[in] exception exception to be raised in AsyncArray
    */
    void setException(std::exception_ptr exception);
#endif
 
    /** Stores exception.
    @param[in] exception exception to be raised in AsyncArray
    */
    void setException(const cv::Exception& exception);
 
#ifdef CV_CXX11
    explicit AsyncPromise(AsyncPromise&& o) { p = o.p; o.p = NULL; }
    AsyncPromise& operator=(AsyncPromise&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; }
#endif
 
 
    // PImpl
    typedef struct AsyncArray::Impl Impl; friend struct AsyncArray::Impl;
    inline void* _getImpl() const CV_NOEXCEPT { return p; }
protected:
    Impl* p;
};
 
 
//! @}
} // namespace
#endif // OPENCV_CORE_ASYNC_PROMISE_HPP