10#include <sigc++/connection.h>
11#include <sigc++/signal.h>
17#include <sigc++/scoped_connection.h>
27template<
typename... T>
33template<
typename R,
typename... T>
44template<
typename R,
typename... T>
52template<
typename R,
typename... T>
60template<
typename R,
typename... T>
62 return !!std::get_if<OperationFinished>(&
msg);
68template<
typename R,
typename... T>
70 using duration = std::chrono::steady_clock::duration;
80 .work = std::move(work),
83 .throttle_time = throttle_interval,
void emit(Msg::Message< R, T... > msg)
sigc::connection subscribe(std::function< void(const Msg::Message< R, T... > &)> fn)
std::unique_ptr< BackgroundTask< R, T... > > _task
void start(std::function< R(Progress< T... > &)> work, duration throttle_interval=duration::zero())
sigc::signal< void(const Msg::Message< R, T... > &)> _signal
std::chrono::steady_clock::duration duration
An interface for tasks to report progress and check for cancellation.
const R * get_result(const Msg::Message< R, T... > &msg)
bool is_finished(const Msg::Message< R, T... > &msg)
std::variant< OperationStarted, OperationProgress< T... >, OperationResult< R >, OperationCancelled, OperationException, OperationFinished > Message
const std::tuple< T... > * get_progress(const Msg::Message< R, T... > &msg)
Helper class to stream background task notifications as a series of messages.
std::exception_ptr exception
std::tuple< T... > progress