3#include "Impl/AsyncSystemSchedulers.h"
4#include "Impl/cesium-async++.h"
26 void resolve(T&& value)
const { this->_pEvent->set(std::move(value)); }
33 void resolve(
const T& value)
const { this->_pEvent->set(value); }
40 template <
typename TException>
void reject(TException error)
const {
41 this->_pEvent->set_exception(std::make_exception_ptr(std::move(error)));
50 void reject(
const std::exception_ptr& error)
const {
51 this->_pEvent->set_exception(error);
63 return Future<T>(this->_pSchedulers, this->_pEvent->get_task());
68 const std::shared_ptr<CesiumImpl::AsyncSystemSchedulers>& pSchedulers,
69 const std::shared_ptr<async::event_task<T>>& pEvent) noexcept
70 : _pSchedulers(pSchedulers), _pEvent(pEvent) {}
72 std::shared_ptr<CesiumImpl::AsyncSystemSchedulers> _pSchedulers;
73 std::shared_ptr<async::event_task<T>> _pEvent;
75 friend class AsyncSystem;
86 void resolve()
const { this->_pEvent->set(); }
93 template <
typename TException>
void reject(TException error)
const {
94 this->_pEvent->set_exception(std::make_exception_ptr(std::move(error)));
103 void reject(
const std::exception_ptr& error)
const {
104 this->_pEvent->set_exception(error);
110 return Future<void>(this->_pSchedulers, this->_pEvent->get_task());
115 const std::shared_ptr<CesiumImpl::AsyncSystemSchedulers>& pSchedulers,
116 const std::shared_ptr<async::event_task<void>>& pEvent) noexcept
117 : _pSchedulers(pSchedulers), _pEvent(pEvent) {}
119 std::shared_ptr<CesiumImpl::AsyncSystemSchedulers> _pSchedulers;
120 std::shared_ptr<async::event_task<void>> _pEvent;
122 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.