91 template <
typename... Ts>
121 template <
typename... Ts>
151 template <
typename... Ts>
194 Node* _node {
nullptr};
196 template <
typename S>
199 template <
typename S>
202 template <
typename S>
207 inline Task::Task(Node& node) : _node {&node} {
211 inline Task::Task(Node* node) : _node {node} {
219 template <
typename... Ts>
221 (_node->precede(*(tgts._node)), ...);
238 template <
typename S>
239 void Task::_precede(S& tgts) {
240 for(
auto& to : tgts) {
241 _node->precede(*(to._node));
246 template <
typename... Bs>
248 (tgts._node->precede(*_node), ...);
253 template <
typename S>
254 void Task::_gather(S& tgts) {
255 for(
auto& from : tgts) {
256 from._node->precede(*_node);
273 template <
typename... Bs>
275 (tgts._node->precede(*_node), ...);
280 template <
typename S>
281 void Task::_succeed(S& tgts) {
282 for(
auto& from : tgts) {
283 from._node->precede(*_node);
312 template <
typename C>
316 TF_THROW(Error::TASKFLOW,
"can't assign work to a module task");
319 _node->_work = std::forward<C>(c);
343 return _node->num_dependents();
348 return _node->num_successors();
353 return _node ==
nullptr;
358 return _node ? _node->_work.index() != 0 :
false;
436 Node* _node {
nullptr};
480 return _node->num_dependents();
485 return _node->num_successors();
495 return _node ==
nullptr;
size_t num_dependents() const
queries the number of predecessors of the task
Definition: task.hpp:342
Task & reset()
resets the task handle to null
Definition: task.hpp:331
TaskView()=default
constructs an empty task view
Task & gather(Ts &&... tasks)
adds precedence links from other tasks to this (same as succeed)
Definition: task.hpp:247
size_t num_successors() const
queries the number of successors of the task
Definition: task.hpp:484
Definition: taskflow.hpp:5
Task & succeed(Ts &&... tasks)
adds precedence links from other tasks to this
Definition: task.hpp:274
bool empty() const
queries if the task view is empty
Definition: task.hpp:494
Task & operator=(const Task &)
replaces the contents with a copy of the other task
Definition: task.hpp:300
the class to create a task dependency graph
Definition: core/taskflow.hpp:15
const std::string & name() const
queries the name of the task
Definition: task.hpp:337
A constant wrapper class to a task node, mainly used in the tf::ExecutorObserver interface.
Definition: task.hpp:370
bool empty() const
queries if the task handle points to a task node
Definition: task.hpp:352
void reset()
resets to an empty view
Definition: task.hpp:489
Building blocks of a task dependency graph.
Definition: flow_builder.hpp:13
size_t num_successors() const
queries the number of successors of the task
Definition: task.hpp:347
Handle to modify and access a task.
Definition: task.hpp:18
Task & precede(Ts &&... tasks)
adds precedence links from this to other tasks
Definition: task.hpp:220
Task()=default
constructs an empty task
The executor class to run a taskflow graph.
Definition: executor.hpp:88
TaskView & operator=(const TaskView &other)
replaces the contents with a copy of the other task
Definition: task.hpp:456
size_t num_dependents() const
queries the number of predecessors of the task
Definition: task.hpp:479
Task & work(C &&callable)
assigns a new callable object to the task
Definition: task.hpp:313
bool has_work() const
queries if the task has a work assigned
Definition: task.hpp:357
const std::string & name() const
queries the name of the task
Definition: task.hpp:474