A value task that stores a single value and doesn't require scheduling. Value tasks should be created using the make_value_task factory functions. More...
#include <transwarp.h>
Public Types | |
using | task_type = transwarp::root_type |
The task type. | |
using | result_type = ResultType |
The result type of this task. | |
![]() | |
using | result_type = ResultType |
Public Member Functions | |
template<typename T > | |
value_task (T &&value) | |
A value task is defined by a given value. Note: Don't use this constructor directly, use transwarp::make_value_task. | |
value_task (const value_task &)=delete | |
value_task & | operator= (const value_task &)=delete |
value_task (value_task &&)=delete | |
value_task & | operator= (value_task &&)=delete |
std::shared_ptr< value_task > | named (std::string name) |
Gives this task a name and returns a ptr to itself. | |
template<typename TaskType_ , typename Functor_ > | |
auto | then (TaskType_, Functor_ &&functor) |
Creates a continuation to this task. | |
std::shared_ptr< value_task > | clone_cast () const |
Clones this task and casts the result to a ptr to value_task. | |
void | finalize () override |
Nothing to be done to finalize a value task. | |
std::size_t | id () const noexceptoverride |
The task's id. | |
std::size_t | level () const noexceptoverride |
The task's level. | |
transwarp::task_type | type () const noexceptoverride |
The task's type. | |
const std::optional < std::string > & | name () const noexcept |
The optional task name. | |
std::shared_ptr < transwarp::executor > | executor () const noexceptoverride |
Value tasks don't have executors as they don't run. | |
std::int64_t | priority () const noexceptoverride |
Returns the task priority. | |
const std::any & | custom_data () const noexceptoverride |
The custom task data (may not hold a value) | |
bool | canceled () const noexceptoverride |
Value tasks cannot be canceled. | |
std::int64_t | avg_idletime_us () const noexceptoverride |
Returns -1 as value tasks don't run. | |
std::int64_t | avg_waittime_us () const noexceptoverride |
Returns -1 as value tasks don't run. | |
std::int64_t | avg_runtime_us () const noexceptoverride |
Returns -1 as value tasks don't run. | |
void | set_executor (std::shared_ptr< transwarp::executor >) override |
No-op because a value task never runs. | |
void | set_executor_all (std::shared_ptr< transwarp::executor >) override |
No-op because a value task never runs and doesn't have parents. | |
void | remove_executor () override |
No-op because a value task never runs. | |
void | remove_executor_all () override |
No-op because a value task never runs and doesn't have parents. | |
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. | |
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. | |
void | reset_priority () override |
Resets the task priority to 0. | |
void | reset_priority_all () override |
Resets the priority of all tasks to 0. | |
void | set_custom_data (std::any 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. | |
void | set_custom_data_all (std::any 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. | |
void | remove_custom_data () override |
Removes custom data from this task. | |
void | remove_custom_data_all () override |
Removes custom data from all tasks. | |
const std::shared_future < result_type > & | future () const noexceptoverride |
Returns the future associated to the underlying execution. | |
void | add_listener (std::shared_ptr< transwarp::listener >) override |
No-op because a value task doesn't raise events. | |
void | add_listener (transwarp::event_type, std::shared_ptr< transwarp::listener >) override |
No-op because a value task doesn't raise events. | |
void | add_listener_all (std::shared_ptr< transwarp::listener >) override |
No-op because a value task doesn't raise events. | |
void | add_listener_all (transwarp::event_type, std::shared_ptr< transwarp::listener >) override |
No-op because a value task doesn't raise events. | |
void | remove_listener (const std::shared_ptr< transwarp::listener > &) override |
No-op because a value task doesn't raise events. | |
void | remove_listener (transwarp::event_type, const std::shared_ptr< transwarp::listener > &) override |
No-op because a value task doesn't raise events. | |
void | remove_listener_all (const std::shared_ptr< transwarp::listener > &) override |
No-op because a value task doesn't raise events. | |
void | remove_listener_all (transwarp::event_type, const std::shared_ptr< transwarp::listener > &) override |
No-op because a value task doesn't raise events. | |
void | remove_listeners () override |
No-op because a value task doesn't raise events. | |
void | remove_listeners (transwarp::event_type) override |
No-op because a value task doesn't raise events. | |
void | remove_listeners_all () override |
No-op because a value task doesn't raise events. | |
void | remove_listeners_all (transwarp::event_type) override |
No-op because a value task doesn't raise events. | |
void | schedule () override |
No-op because a value task never runs. | |
void | schedule (transwarp::executor &) override |
No-op because a value task never runs. | |
void | schedule (bool) override |
No-op because a value task never runs. | |
void | schedule (transwarp::executor &, bool) override |
No-op because a value task never runs. | |
void | schedule_all () override |
No-op because a value task never runs and doesn't have parents. | |
void | schedule_all (transwarp::executor &) override |
No-op because a value task never runs and doesn't have parents. | |
void | schedule_all (bool) override |
No-op because a value task never runs and doesn't have parents. | |
void | schedule_all (transwarp::executor &, bool) override |
No-op because a value task never runs and doesn't have parents. | |
void | set_value (const transwarp::decay_t< result_type > &value) override |
Assigns a value to this task. | |
void | set_value (transwarp::decay_t< result_type > &&value) override |
Assigns a value to this task. | |
void | set_exception (std::exception_ptr exception) override |
Assigns an exception to this task. | |
bool | was_scheduled () const noexceptoverride |
Returns true because a value task is scheduled once on construction. | |
void | wait () const override |
No-op because a value task never runs. | |
bool | is_ready () const override |
Returns true because a value task is always ready. | |
bool | has_result () const noexceptoverride |
Returns true because a value task always contains a result. | |
transwarp::result_t< result_type > | get () const override |
Returns the result of this task. | |
void | reset () override |
No-op because a value task never runs. | |
void | reset_all () override |
No-op because a value task never runs and doesn't have parents. | |
void | cancel (bool) noexceptoverride |
No-op because a value task never runs. | |
void | cancel_all (bool) noexceptoverride |
No-op because a value task never runs and doesn't have parents. | |
std::vector< transwarp::itask * > | parents () const override |
Empty because a value task doesn't have parents. | |
const std::vector < transwarp::itask * > & | tasks () override |
Returns all tasks in the graph in breadth order. | |
std::vector< transwarp::edge > | edges () override |
Returns empty edges because a value task doesn't have parents. | |
![]() | |
std::shared_ptr< task > | clone () const |
Additional Inherited Members |
A value task that stores a single value and doesn't require scheduling. Value tasks should be created using the make_value_task factory functions.