HikoGUI
Select Version: ⚠️ This documents the main development branch of HikoGUI. It might differ from release versions.
A low latency retained GUI
|
#include <hikogui/dispatch/task_controller.hpp>
Public Types | |
using | result_type = ResultType |
The result type returned by a hi::task or function. | |
using | callback_type = notifier<>::callback_type |
Public Member Functions | |
task_controller (task_controller const &)=delete | |
task_controller (task_controller &&)=delete | |
task_controller & | operator= (task_controller const &)=delete |
task_controller & | operator= (task_controller &&)=delete |
task_controller () noexcept | |
Create a new task_controller. | |
template<typename Func , typename... Args> requires compatible_cancelable_async_callable<ResultType, Func, Args...> | |
task_controller (Func &&func, Args &&... args) | |
Create a new task_controller with a assigned coroutine or function and its arguments. | |
template<typename Func , typename... Args> requires compatible_cancelable_async_callable<ResultType, Func, Args...> | |
void | set_function (Func &&func, Args &&... args) |
Set the coroutine or function and its arguments. | |
void | unset_function () |
Remove the task, so that it can no longer be run. | |
cancel_features_type | features () const noexcept |
The features of the coroutine or function that was assigned. | |
bool | runnable () const noexcept |
Check if a function is assigned. | |
bool | started () const noexcept |
Check if the function was started. | |
bool | running () const noexcept |
Check if the function is currently running. | |
bool | done () const noexcept |
Check if the function has completed. | |
void | reset () |
Reset the state of the function to not-started. | |
void | run () |
Run the assigned coroutine or function with the previous given arguments. | |
bool | request_stop () noexcept |
Request stop. | |
float_t | progress () const noexcept |
Get progress of a function. | |
result_type | value () const |
Get the return value from the coroutine or function. | |
template<typename Callback > | |
hi::notifier ::callback_type | subscribe (Callback &&callback, callback_flags flags=callback_flags::synchronous) |
Register a callback to be called when a coroutine or function reports progress. | |
A task controller.
ResultType | The type of the result of a hi::task or function. |
using hi::v1::task_controller< ResultType >::result_type = ResultType |
The result type returned by a hi::task or function.
|
inlinenoexcept |
Create a new task_controller.
|
inline |
Create a new task_controller with a assigned coroutine or function and its arguments.
|
inlinenoexcept |
Check if the function has completed.
|
inlinenoexcept |
The features of the coroutine or function that was assigned.
|
inlinenoexcept |
Get progress of a function.
|
inlinenoexcept |
Request stop.
|
inline |
Reset the state of the function to not-started.
hi::task_running_error | when the function is currently running. |
|
inline |
Run the assigned coroutine or function with the previous given arguments.
|
inlinenoexcept |
Check if a function is assigned.
|
inlinenoexcept |
Check if the function is currently running.
|
inline |
Set the coroutine or function and its arguments.
func | The coroutine or function to execute when run() is called. |
args | The arguments passed to the function when run() is called. |
hi::task_running_error | when the task is currently running. |
|
inlinenoexcept |
Check if the function was started.
|
inline |
Register a callback to be called when a coroutine or function reports progress.
|
inline |
Remove the task, so that it can no longer be run.
hi::task_running_error | when the task is currently running. |
|
inline |
Get the return value from the coroutine or function.
return
or co_return
.