![]() |
Blue Brain BioExplorer
|
#include <TaskFunctor.h>
Public Types | |
using | ProgressFunc = std::function< void(std::string, float, float)> |
Public Member Functions | |
void | setProgressFunc (const ProgressFunc &progressFunc) |
void | progress (const std::string &message, const float increment, const float amount) |
void | setCancelToken (async::cancellation_token &cancelToken) |
void | cancelCheck () const |
A base class for functors that can be used for Tasks. It provides support for progress reporting and cancellation during execution.
Definition at line 41 of file TaskFunctor.h.
using core::TaskFunctor::ProgressFunc = std::function<void(std::string, float, float)> |
message, increment, amount
Definition at line 45 of file TaskFunctor.h.
|
inline |
Checks if the execution has been cancelled. If so, this will throw an exception that is ultimately handled by the task and is stored in the tasks' result.
Definition at line 73 of file TaskFunctor.h.
|
inline |
Report progress using the provided callback from setProgressFunc() and also check if the execution has been cancelled.
message | the progress message |
increment | the fractional increment of this progress update |
amount | the absolute amount of progress at the time of this update |
Definition at line 58 of file TaskFunctor.h.
|
inline |
Set the cancel token from e.g. the task that uses this functor.
Definition at line 66 of file TaskFunctor.h.
|
inline |
Set the function when progress() is called.
Definition at line 48 of file TaskFunctor.h.