|
void | set_value (const typename transwarp::decay< result_type >::type &value) override |
| Assigns a value to this task. Scheduling will have no effect after a value has been set. Calling reset() will remove the value and re-enable scheduling.
|
|
void | set_value (typename transwarp::decay< result_type >::type &&value) override |
| Assigns a value to this task. Scheduling will have no effect after a value has been set. Calling reset() will remove the value and re-enable scheduling.
|
|
transwarp::result< result_type >::type | get () const override |
| Returns the result of this task. Throws any exceptions that the underlying functor throws. Should only be called if was_scheduled() is true, throws transwarp::control_error otherwise.
|
|
void | finalize () override |
| Can be called to explicitly finalize this task making this task the terminal task in the graph. This is also done implicitly when calling, e.g., any of the *_all methods. It should normally not be necessary to call this method directly.
|
|
std::size_t | level () const noexcept override |
| The task's level.
|
|
transwarp::task_type | type () const noexcept override |
| The task's type.
|
|
std::shared_ptr< transwarp::executor > | executor () const noexcept override |
| The task's executor (may be null)
|
|
bool | canceled () const noexcept override |
| Returns whether the associated task is canceled.
|
|
std::int64_t | avg_idletime_us () const noexcept override |
| Returns the average idletime in microseconds (-1 if never set)
|
|
std::int64_t | avg_waittime_us () const noexcept override |
| Returns the average waittime in microseconds (-1 if never set)
|
|
std::int64_t | avg_runtime_us () const noexcept override |
| Returns the average runtime in microseconds (-1 if never set)
|
|
void | set_executor (std::shared_ptr< transwarp::executor > executor) override |
| Assigns an executor to this task which takes precedence over the executor provided in schedule() or schedule_all()
|
|
void | set_executor_all (std::shared_ptr< transwarp::executor > executor) override |
| Assigns an executor to all tasks which takes precedence over the executor provided in schedule() or schedule_all()
|
|
void | remove_executor () override |
| Removes the executor from this task.
|
|
void | remove_executor_all () override |
| Removes the executor from all tasks.
|
|
void | schedule () override |
| Schedules this task for execution on the caller thread. The task-specific executor gets precedence if it exists. This overload will reset the underlying future.
|
|
void | schedule (bool reset) override |
| Schedules this task for execution on the caller thread. The task-specific executor gets precedence if it exists. reset denotes whether schedule should reset the underlying future and schedule even if the future is already valid.
|
|
void | schedule (transwarp::executor &executor) override |
| Schedules this task for execution using the provided executor. The task-specific executor gets precedence if it exists. This overload will reset the underlying future.
|
|
void | schedule (transwarp::executor &executor, bool reset) override |
| Schedules this task for execution using the provided executor. The task-specific executor gets precedence if it exists. reset denotes whether schedule should reset the underlying future and schedule even if the future is already valid.
|
|
void | schedule_all () override |
| Schedules all tasks in the graph for execution on the caller thread. The task-specific executors get precedence if they exist. This overload will reset the underlying futures.
|
|
void | schedule_all (transwarp::executor &executor) override |
| Schedules all tasks in the graph for execution using the provided executor. The task-specific executors get precedence if they exist. This overload will reset the underlying futures.
|
|
void | schedule_all (bool reset_all) override |
| Schedules all tasks in the graph for execution on the caller thread. The task-specific executors get precedence if they exist. reset_all denotes whether schedule_all should reset the underlying futures and schedule even if the futures are already present.
|
|
void | schedule_all (transwarp::executor &executor, bool reset_all) override |
| Schedules all tasks in the graph for execution using the provided executor. The task-specific executors get precedence if they exist. reset_all denotes whether schedule_all should reset the underlying futures and schedule even if the futures are already present.
|
|
void | set_exception (std::exception_ptr exception) override |
| Assigns an exception to this task. Scheduling will have no effect after an exception has been set. Calling reset() will remove the exception and re-enable scheduling.
|
|
bool | was_scheduled () const noexcept override |
| Returns whether the task was scheduled and not reset afterwards. This means that the underlying future is valid.
|
|
void | wait () const override |
| Waits for the task to complete. Should only be called if was_scheduled() is true, throws transwarp::control_error otherwise.
|
|
bool | is_ready () const override |
| Returns whether the task has finished processing. Should only be called if was_scheduled() is true, throws transwarp::control_error otherwise.
|
|
bool | has_result () const noexcept override |
| Returns whether this task contains a result.
|
|
void | reset () override |
| Resets this task.
|
|
void | reset_all () override |
| Resets all tasks in the graph.
|
|
void | cancel (bool enabled) noexcept override |
| If enabled then this task is canceled which will throw transwarp::task_canceled when retrieving the task result. Passing false is equivalent to resume.
|
|
void | cancel_all (bool enabled) noexcept override |
| If enabled then all pending tasks in the graph are canceled which will throw transwarp::task_canceled when retrieving the task result. Passing false is equivalent to resume.
|
|
void | set_priority_all (std::int64_t priority) override |
| Sets a priority to all tasks (defaults to 0). transwarp will not directly use this. This is only useful if something else is using the priority (e.g. a custom executor)
|
|
void | reset_priority_all () override |
| Resets the priority of all tasks to 0.
|
|
void | set_custom_data_all (transwarp::any_data custom_data) override |
| Assigns custom data to all tasks. transwarp will not directly use this. This is only useful if something else is using this custom data (e.g. a custom executor)
|
|
void | remove_custom_data_all () override |
| Removes custom data from all tasks.
|
|
void | add_listener_all (std::shared_ptr< transwarp::listener > listener) override |
| Adds a new listener for all event types and for all parents.
|
|
void | add_listener_all (transwarp::event_type event, std::shared_ptr< transwarp::listener > listener) override |
| Adds a new listener for the given event type only and for all parents.
|
|
void | remove_listener_all (const std::shared_ptr< transwarp::listener > &listener) override |
| Removes the listener for all event types and for all parents.
|
|
void | remove_listener_all (transwarp::event_type event, const std::shared_ptr< transwarp::listener > &listener) override |
| Removes the listener for the given event type only and for all parents.
|
|
void | remove_listeners_all () override |
| Removes all listeners and for all parents.
|
|
void | remove_listeners_all (transwarp::event_type event) override |
| Removes all listeners for the given event type and for all parents.
|
|
std::vector< transwarp::itask * > | parents () const override |
| Returns the task's parents (may be empty)
|
|
const std::vector< transwarp::itask * > & | tasks () override |
| Returns all tasks in the graph in breadth order.
|
|
std::vector< transwarp::edge > | edges () override |
| Returns all edges in the graph. This is mainly for visualizing the tasks and their interdependencies. Pass the result into transwarp::to_string to retrieve a dot-style graph representation for easy viewing.
|
|
std::size_t | id () const noexcept override |
| The task's id.
|
|
const transwarp::option_str & | name () const noexcept override |
| The optional task name.
|
|
std::int64_t | priority () const noexcept override |
| The task priority (defaults to 0)
|
|
const transwarp::any_data & | custom_data () const noexcept override |
| The custom task data (may not hold a value)
|
|
void | set_priority (std::int64_t priority) override |
| Sets a task priority (defaults to 0). transwarp will not directly use this. This is only useful if something else is using the priority (e.g. a custom executor)
|
|
void | reset_priority () override |
| Resets the task priority to 0.
|
|
void | set_custom_data (transwarp::any_data custom_data) override |
| Assigns custom data to this task. transwarp will not directly use this. This is only useful if something else is using this custom data (e.g. a custom executor)
|
|
void | remove_custom_data () override |
| Removes custom data from this task.
|
|
std::shared_future< result_type > | future () const noexcept override |
| Returns the future associated to the underlying execution.
|
|
void | add_listener (std::shared_ptr< transwarp::listener > listener) override |
| Adds a new listener for all event types.
|
|
void | add_listener (transwarp::event_type event, std::shared_ptr< transwarp::listener > listener) override |
| Adds a new listener for the given event type only.
|
|
void | remove_listener (const std::shared_ptr< transwarp::listener > &listener) override |
| Removes the listener for all event types.
|
|
void | remove_listener (transwarp::event_type event, const std::shared_ptr< transwarp::listener > &listener) override |
| Removes the listener for the given event type only.
|
|
void | remove_listeners () override |
| Removes all listeners.
|
|
void | remove_listeners (transwarp::event_type event) override |
| Removes all listeners for the given event type.
|
|
std::shared_ptr< task > | clone () const |
|
virtual std::size_t | level () const noexcept=0 |
|
virtual transwarp::task_type | type () const noexcept=0 |
|
virtual std::shared_ptr< transwarp::executor > | executor () const noexcept=0 |
|
virtual bool | canceled () const noexcept=0 |
|
virtual std::int64_t | avg_idletime_us () const noexcept=0 |
|
virtual std::int64_t | avg_waittime_us () const noexcept=0 |
|
virtual std::int64_t | avg_runtime_us () const noexcept=0 |
|
virtual bool | was_scheduled () const noexcept=0 |
|
virtual void | wait () const =0 |
|
virtual bool | is_ready () const =0 |
|
virtual bool | has_result () const =0 |
|
virtual std::vector< itask * > | parents () const =0 |
|