transwarp
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | 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 >:
transwarp::task< ResultType > transwarp::itask transwarp::detail::task_impl_base< ResultType, TaskType, Functor, ParentResults...> transwarp::detail::task_impl_base< ResultType, TaskType, Functor, ParentResults > transwarp::value_task< ResultType > transwarp::detail::task_impl_proxy< ResultType, TaskType, Functor, ParentResults >

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 noexceptoverride
 The task's id.
 
const std::optional
< std::string > & 
name () const noexceptoverride
 The optional task name.
 
std::int64_t priority () const noexceptoverride
 The task priority (defaults to 0)
 
const std::any & custom_data () const noexceptoverride
 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 (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 (e.g. a custom executor)
 
void remove_custom_data () override
 Removes custom data from this task.
 
std::shared_future< result_typefuture () const noexceptoverride
 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 transwarp::decay_t< result_type > &value)=0
 
virtual void set_value (transwarp::decay_t< result_type > &&value)=0
 
virtual transwarp::result_t
< result_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::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 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 (std::any 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::edge
edges ()=0
 

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 set_id (std::size_t id) noexceptoverride
 Assigns the given id.
 
void set_name (std::optional< std::string > name) noexceptoverride
 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
 
std::optional< std::string > name_
 
std::int64_t priority_ = 0
 
std::any custom_data_
 
std::shared_future< result_typefuture_
 
bool visited_ = false
 
std::map
< transwarp::event_type,
std::vector< std::shared_ptr
< transwarp::listener > > > 
listeners_
 
std::vector< transwarp::itask * > 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: