3#include "Impl/AsyncSystemSchedulers.h"
4#include "Impl/cesium-async++.h"
25 void resolve(T&& value)
const { this->_pEvent->set(std::move(value)); }
32 void resolve(
const T& value)
const { this->_pEvent->set(value); }
39 template <
typename TException>
void reject(TException error)
const {
40 this->_pEvent->set_exception(std::make_exception_ptr(error));
49 void reject(
const std::exception_ptr& error)
const {
50 this->_pEvent->set_exception(error);
62 return Future<T>(this->_pSchedulers, this->_pEvent->get_task());
67 const std::shared_ptr<CesiumImpl::AsyncSystemSchedulers>& pSchedulers,
68 const std::shared_ptr<async::event_task<T>>& pEvent) noexcept
69 : _pSchedulers(pSchedulers), _pEvent(pEvent) {}
71 std::shared_ptr<CesiumImpl::AsyncSystemSchedulers> _pSchedulers;
72 std::shared_ptr<async::event_task<T>> _pEvent;
74 friend class AsyncSystem;
85 void resolve()
const { this->_pEvent->set(); }
92 template <
typename TException>
void reject(TException error)
const {
93 this->_pEvent->set_exception(std::make_exception_ptr(error));
102 void reject(
const std::exception_ptr& error)
const {
103 this->_pEvent->set_exception(error);
109 return Future<void>(this->_pSchedulers, this->_pEvent->get_task());
114 const std::shared_ptr<CesiumImpl::AsyncSystemSchedulers>& pSchedulers,
115 const std::shared_ptr<async::event_task<void>>& pEvent) noexcept
116 : _pSchedulers(pSchedulers), _pEvent(pEvent) {}
118 std::shared_ptr<CesiumImpl::AsyncSystemSchedulers> _pSchedulers;
119 std::shared_ptr<async::event_task<void>> _pEvent;
121 friend class AsyncSystem;
A value that will be available in the future, as produced by AsyncSystem.
void resolve() const
Will be called when the task completed successfully.
void reject(const std::exception_ptr &error) const
Will be called when the task failed.
Future< void > getFuture() const
Gets the Future that resolves or rejects when this Promise is resolved or rejected.
void reject(TException error) const
Will be called when the task failed.
A promise that can be resolved or rejected by an asynchronous task.
void resolve(const T &value) const
Will be called when the task completed successfully.
void reject(const std::exception_ptr &error) const
Will be called when the task failed.
void resolve(T &&value) const
Will be called when the task completed successfully.
void reject(TException error) const
Will be called when the task failed.
Future< T > getFuture() const
Gets the Future that resolves or rejects when this Promise is resolved or rejected.
Classes that support asynchronous operations.