transwarp
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | List of all members
transwarp::value_task< ResultType > Class Template Reference

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>

Inheritance diagram for transwarp::value_task< ResultType >:
transwarp::task< ResultType > transwarp::itask

Public Types

using task_type = transwarp::root_type
 The task type.
 
using result_type = ResultType
 The result type of this task.
 
- Public Types inherited from transwarp::task< ResultType >
using result_type = ResultType
 

Public Member Functions

template<typename T , typename = typename std::enable_if<std::is_same<result_type, typename transwarp::decay<T>::type>::value>::type>
 value_task (std::string name, T &&value)
 A value task is defined by name and value. name is optional, see overload Note: A value task must be created using shared_ptr (because of shared_from_this)
 
template<typename T , typename = typename std::enable_if<std::is_same<result_type, typename transwarp::decay<T>::type>::value>::type>
 value_task (T &&value)
 This overload is for omitting the task name Note: A value task must be created using shared_ptr (because of shared_from_this)
 
 value_task (const value_task &)=delete
 
value_taskoperator= (const value_task &)=delete
 
 value_task (value_task &&)=delete
 
value_taskoperator= (value_task &&)=delete
 
template<typename TaskType_ , typename Functor_ >
auto then (TaskType_, std::string name, Functor_ &&functor) const -> decltype(std::make_shared< transwarp::task_impl< TaskType_, typename std::decay< Functor_ >::type, result_type >>(std::move(name), std::forward< Functor_ >(functor), std::dynamic_pointer_cast< transwarp::task< result_type >>(const_cast< value_task * >(this) ->shared_from_this())))
 Creates a continuation to this task.
 
template<typename TaskType_ , typename Functor_ >
auto then (TaskType_, Functor_ &&functor) const -> decltype(std::make_shared< transwarp::task_impl< TaskType_, typename std::decay< Functor_ >::type, result_type >>(std::forward< Functor_ >(functor), std::dynamic_pointer_cast< transwarp::task< result_type >>(const_cast< value_task * >(this) ->shared_from_this())))
 Creates a continuation to this task. Overload for omitting for task name.
 
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::size_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::size_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::shared_ptr< void > 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::shared_ptr< void > 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 > & 
get_future () const noexceptoverride
 Returns the future associated to the underlying execution.
 
const std::shared_ptr
< transwarp::node > & 
get_node () const noexceptoverride
 Returns the associated node.
 
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 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_listeners (transwarp::event_type) 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 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 schedule_all (transwarp::schedule_type) override
 No-op because a value task never runs and doesn't have parents.
 
void schedule_all (transwarp::executor &, transwarp::schedule_type) override
 No-op because a value task never runs and doesn't have parents.
 
void schedule_all (transwarp::schedule_type, bool) override
 No-op because a value task never runs and doesn't have parents.
 
void schedule_all (transwarp::executor &, transwarp::schedule_type, bool) override
 No-op because a value task never runs and doesn't have parents.
 
void set_value (const typename transwarp::decay< result_type >::type &value) override
 Assigns a value to this task.
 
void set_value (typename transwarp::decay< result_type >::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_info
< result_type >::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::edgeget_graph () const override
 Returns an empty graph because a value task doesn't have parents.
 

Additional Inherited Members

Detailed Description

template<typename ResultType>
class transwarp::value_task< ResultType >

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.


The documentation for this class was generated from the following file: