transwarp
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Protected Member Functions | List of all members
transwarp::detail::task_impl_proxy< ResultType, TaskType, Functor, ParentResults > Class Template Reference

A task proxy. More...

#include <transwarp.h>

Inheritance diagram for transwarp::detail::task_impl_proxy< ResultType, TaskType, Functor, ParentResults >:
transwarp::detail::task_impl_base< ResultType, TaskType, Functor, ParentResults...> transwarp::task< ResultType > transwarp::itask

Public Types

using task_type = TaskType
 The task type.
 
using result_type = ResultType
 The result type of this task.
 
- Public Types inherited from transwarp::detail::task_impl_base< ResultType, TaskType, Functor, ParentResults...>
using task_type = TaskType
 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

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.
 
- Public Member Functions inherited from transwarp::detail::task_impl_base< ResultType, TaskType, Functor, ParentResults...>
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 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 (e.g. a custom executor)
 
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 (e.g. a custom executor)
 
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 (e.g. a custom executor)
 
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 (e.g. a custom executor)
 
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 > 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 (transwarp::event_type event) override
 Removes all listeners for the given event type.
 
void remove_listeners () override
 Removes all listeners.
 
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 schedule_all (transwarp::schedule_type type) 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, transwarp::schedule_type type) 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 (transwarp::schedule_type type, 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, transwarp::schedule_type type, 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 noexceptoverride
 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 noexceptoverride
 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) noexceptoverride
 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) noexceptoverride
 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.
 
std::vector< transwarp::edgeget_graph () const override
 Returns the graph of the task structure. 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.
 

Protected Member Functions

template<typename F >
 task_impl_proxy (bool has_name, std::string name, F &&functor, std::shared_ptr< transwarp::task< ParentResults >>...parents)
 
template<typename F , typename P >
 task_impl_proxy (bool has_name, std::string name, F &&functor, std::vector< std::shared_ptr< transwarp::task< P >>> parents)
 
- Protected Member Functions inherited from transwarp::detail::task_impl_base< ResultType, TaskType, Functor, ParentResults...>
 task_impl_base (bool has_name, std::string name, F &&functor, std::shared_ptr< transwarp::task< ParentResults >>...parents)
 
 task_impl_base (bool has_name, std::string name, F &&functor, std::vector< std::shared_ptr< transwarp::task< P >>> parents)
 
void init (bool has_name, std::string name)
 
void ensure_task_not_running () const
 Checks if the task is currently running and throws transwarp::control_error if it is.
 
void ensure_task_was_scheduled () const
 Checks if the task was scheduled and throws transwarp::control_error if it's not.
 

Additional Inherited Members

- Protected Attributes inherited from transwarp::detail::task_impl_base< ResultType, TaskType, Functor, ParentResults...>
bool schedule_mode_
 
std::shared_future< result_typefuture_
 

Detailed Description

template<typename ResultType, typename TaskType, typename Functor, typename... ParentResults>
class transwarp::detail::task_impl_proxy< ResultType, TaskType, Functor, ParentResults >

A task proxy.


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