transwarp
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
transwarp::detail::task_common< ResultType > Class Template Reference

Common task functionality shared across task_impl and value_task More...

#include <transwarp.h>

Inheritance diagram for transwarp::detail::task_common< ResultType >:
Inheritance graph
[legend]
Collaboration diagram for transwarp::detail::task_common< ResultType >:
Collaboration graph
[legend]

Public Types

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

Public Member Functions

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_typefuture () 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.
 
- Public Member Functions inherited from transwarp::task< ResultType >
std::shared_ptr< taskclone () const
 
virtual void set_value (const typename transwarp::decay< result_type >::type &value)=0
 
virtual void set_value (typename transwarp::decay< result_type >::type &&value)=0
 
virtual transwarp::result< result_type >::type get () const =0
 
- Public Member Functions inherited from transwarp::itask
virtual void finalize ()=0
 
virtual std::size_t level () const noexcept=0
 
virtual transwarp::task_type type () const noexcept=0
 
virtual std::shared_ptr< transwarp::executorexecutor () 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 void set_executor (std::shared_ptr< transwarp::executor > executor)=0
 
virtual void set_executor_all (std::shared_ptr< transwarp::executor > executor)=0
 
virtual void remove_executor ()=0
 
virtual void remove_executor_all ()=0
 
virtual void set_priority_all (std::int64_t priority)=0
 
virtual void reset_priority_all ()=0
 
virtual void set_custom_data_all (transwarp::any_data custom_data)=0
 
virtual void remove_custom_data_all ()=0
 
virtual void add_listener_all (std::shared_ptr< transwarp::listener > listener)=0
 
virtual void add_listener_all (transwarp::event_type event, std::shared_ptr< transwarp::listener > listener)=0
 
virtual void remove_listener_all (const std::shared_ptr< transwarp::listener > &listener)=0
 
virtual void remove_listener_all (transwarp::event_type event, const std::shared_ptr< transwarp::listener > &listener)=0
 
virtual void remove_listeners_all ()=0
 
virtual void remove_listeners_all (transwarp::event_type event)=0
 
virtual void schedule ()=0
 
virtual void schedule (transwarp::executor &executor)=0
 
virtual void schedule (bool reset)=0
 
virtual void schedule (transwarp::executor &executor, bool reset)=0
 
virtual void schedule_all ()=0
 
virtual void schedule_all (transwarp::executor &executor)=0
 
virtual void schedule_all (bool reset_all)=0
 
virtual void schedule_all (transwarp::executor &executor, bool reset_all)=0
 
virtual void set_exception (std::exception_ptr exception)=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 void reset ()=0
 
virtual void reset_all ()=0
 
virtual void cancel (bool enabled) noexcept=0
 
virtual void cancel_all (bool enabled) noexcept=0
 
virtual std::vector< itask * > parents () const =0
 
virtual const std::vector< itask * > & tasks ()=0
 
virtual std::vector< transwarp::edgeedges ()=0
 

Protected Types

using listeners_t = std::map< transwarp::event_type, std::vector< std::shared_ptr< transwarp::listener > >>
 
using tasks_t = std::vector< transwarp::itask * >
 

Protected Member Functions

void ensure_task_not_running () const
 Checks if the task is currently running and throws transwarp::control_error if it is.
 
void raise_event (transwarp::event_type event)
 Raises the given event to all listeners.
 
void check_listener (const std::shared_ptr< transwarp::listener > &listener) const
 Check for non-null listener pointer.
 
void ensure_listeners_object ()
 
void set_id (std::size_t id) noexcept override
 Assigns the given id.
 
void set_name (transwarp::option_str name) noexcept override
 Assigns the given name.
 
void copy_from (const task_common &task)
 
- Protected Member Functions inherited from transwarp::itask
virtual void schedule_impl (bool reset, transwarp::executor *executor=nullptr)=0
 

Protected Attributes

std::size_t id_ = 0
 
transwarp::option_str name_
 
std::int64_t priority_ = 0
 
transwarp::any_data custom_data_
 
std::shared_future< result_typefuture_
 
bool visited_ = false
 
std::unique_ptr< listeners_t > listeners_
 
std::unique_ptr< tasks_t > tasks_
 

Detailed Description

template<typename ResultType>
class transwarp::detail::task_common< ResultType >

Common task functionality shared across task_impl and value_task


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