Peano
Loading...
Searching...
No Matches
tbb::dynamic_task_graph_node Class Reference

Represents one node in task graph. More...

#include <dynamic_task_graph_node.h>

Collaboration diagram for tbb::dynamic_task_graph_node:

Public Member Functions

 dynamic_task_graph_node (std::function< void()> functor)
 Create new task graph node.
 
 dynamic_task_graph_node (std::function< void()> functor, const std::string &task_description)
 Second parameter will be ignored if you work without debugg info.
 
 dynamic_task_graph_node (const dynamic_task_graph_node &node)
 You can copy a task graph node after it has been submitted.
 
void add_dependency (const dynamic_task_graph_node &node)
 Add a single dependency.
 
void add_dependencies (const std::set< dynamic_task_graph_node > &nodes)
 Wrapper around add_dependency()
 
bool is_submitted () const
 Has task been submitted.
 
std::string to_string () const
 

Private Attributes

std::function< void()> _functor
 
std::shared_ptr< dynamic_task_graph_spawned_node_spawned_task
 
std::vector< std::shared_ptr< dynamic_task_graph_spawned_node > > _in_dependency
 In dependencies.
 

Friends

class dynamic_task_graph
 
class dynamic_task_graph_spawned_node
 

Detailed Description

Represents one node in task graph.

Definition at line 26 of file dynamic_task_graph_node.h.

Constructor & Destructor Documentation

◆ dynamic_task_graph_node() [1/3]

tbb::dynamic_task_graph_node::dynamic_task_graph_node ( std::function< void()> functor)

Create new task graph node.

Each task graph node is tied to a functor. When we create a task graph node, the task is not yet submitted or ready. We have to explicitly put() it into the task graph.

Definition at line 9 of file dynamic_task_graph_node.cpp.

◆ dynamic_task_graph_node() [2/3]

tbb::dynamic_task_graph_node::dynamic_task_graph_node ( std::function< void()> functor,
const std::string & task_description )

Second parameter will be ignored if you work without debugg info.

Definition at line 18 of file dynamic_task_graph_node.cpp.

◆ dynamic_task_graph_node() [3/3]

tbb::dynamic_task_graph_node::dynamic_task_graph_node ( const dynamic_task_graph_node & node)

You can copy a task graph node after it has been submitted.

If you do so before, there might be two copies of this one task graph node, and they both might add in-dependencies independently. You might even submit this handle twice.

Also consult dynamic_task_graph::put() which

Definition at line 31 of file dynamic_task_graph_node.cpp.

References is_submitted().

Here is the call graph for this function:

Member Function Documentation

◆ add_dependencies()

void tbb::dynamic_task_graph_node::add_dependencies ( const std::set< dynamic_task_graph_node > & nodes)

Wrapper around add_dependency()

Definition at line 49 of file dynamic_task_graph_node.cpp.

◆ add_dependency()

void tbb::dynamic_task_graph_node::add_dependency ( const dynamic_task_graph_node & node)

Add a single dependency.

This works if and only if node has already been put into the task graph. You cannot add any dependency before that (cmp concept of anti-dependencies in OpenMP).

Definition at line 42 of file dynamic_task_graph_node.cpp.

References _spawned_task, and is_submitted().

Here is the call graph for this function:

◆ is_submitted()

bool tbb::dynamic_task_graph_node::is_submitted ( ) const

Has task been submitted.

After you have submitted a node, you can use it as input dependency for other nodes. However, you cannot add further dependencies to itself anymore.

Definition at line 56 of file dynamic_task_graph_node.cpp.

Referenced by add_dependency(), dynamic_task_graph_node(), and tbb::dynamic_task_graph::wait().

Here is the caller graph for this function:

◆ to_string()

std::string tbb::dynamic_task_graph_node::to_string ( ) const

Definition at line 61 of file dynamic_task_graph_node.cpp.

Friends And Related Symbol Documentation

◆ dynamic_task_graph

friend class dynamic_task_graph
friend

Definition at line 28 of file dynamic_task_graph_node.h.

◆ dynamic_task_graph_spawned_node

friend class dynamic_task_graph_spawned_node
friend

Definition at line 29 of file dynamic_task_graph_node.h.

Field Documentation

◆ _functor

std::function<void()> tbb::dynamic_task_graph_node::_functor
private

◆ _in_dependency

std::vector< std::shared_ptr<dynamic_task_graph_spawned_node> > tbb::dynamic_task_graph_node::_in_dependency
private

In dependencies.

Can only refer to submitted tasks. If a task is given a number and it also depends on another task with the same number, this number is not stored within this array. Instead, _depends_on_previous_task_with_same_number is set.

See dynamic_task_graph_spawned_node for a documentation why we have to use shared pointers here.

Definition at line 96 of file dynamic_task_graph_node.h.

Referenced by tbb::dynamic_task_graph::put().

◆ _spawned_task

std::shared_ptr<dynamic_task_graph_spawned_node> tbb::dynamic_task_graph_node::_spawned_task
private

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