class
#include <src/taskflow/core/task.hpp>
Task handle to a node in a task dependency graph
Contents
A Task is handle to manipulate a node in a taskflow graph. It provides a set of methods for users to access and modify the attributes of the associated graph node without directly touching internal node data.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const Task&) -> Task&
- replaces the contents with a copy of the other task
- auto operator=(std::nullptr_t) -> Task&
- replaces the contents with a null pointer
- auto operator==(const Task& rhs) const -> bool
- compares if two tasks are associated with the same graph node
- auto operator!=(const Task& rhs) const -> bool
- compares if two tasks are not associated with the same graph node
- auto name() const -> const std::string&
- queries the name of the task
- auto num_successors() const -> size_t
- queries the number of successors of the task
- auto num_dependents() const -> size_t
- queries the number of predecessors of the task
- auto num_strong_dependents() const -> size_t
- queries the number of strong dependents of the task
- auto num_weak_dependents() const -> size_t
- queries the number of weak dependents of the task
- auto name(const std::string& name) -> Task&
- assigns a name to the task
-
template<typename C>auto work(C&& callable) -> Task&
- assigns a callable
- auto composed_of(Taskflow& taskflow) -> Task&
- creates a module task from a taskflow
-
template<typename... Ts>auto precede(Ts && ... tasks) -> Task&
- adds precedence links from this to other tasks
-
template<typename... Ts>auto succeed(Ts && ... tasks) -> Task&
- adds precedence links from other tasks to this
- auto release(Semaphore& semaphore) -> Task&
- makes the task release this semaphore
- auto acquire(Semaphore& semaphore) -> Task&
- makes the task acquire this semaphore
- void reset()
- resets the task handle to null
- void reset_work()
- resets the associated work to a placeholder
- auto empty() const -> bool
- queries if the task handle points to a task node
- auto has_work() const -> bool
- queries if the task has a work assigned
-
template<typename V>void for_each_successor(V&& visitor) const
- applies an visitor callable to each successor of the task
-
template<typename V>void for_each_dependent(V&& visitor) const
- applies an visitor callable to each dependents of the task
- auto hash_value() const -> size_t
- obtains a hash value of the underlying node
- auto type() const -> TaskType
- returns the task type
- void dump(std::ostream& ostream) const
- dumps the task through an output stream
Function documentation
Task& tf:: Task:: composed_of(Taskflow& taskflow)
creates a module task from a taskflow
Parameters | |
---|---|
taskflow | a taskflow object for the module |
Returns | *this |