dispenso 1.4.1
A library for task parallelism
Loading...
Searching...
No Matches
dispenso::GraphT< N > Class Template Reference

#include <graph.h>

Public Member Functions

 GraphT (const GraphT< N > &)=delete
 
 GraphT ()
 
 GraphT (GraphT< N > &&other)
 
template<class T >
N & addNode (T &&f)
 
size_t numNodes () const
 
const N & node (size_t index) const
 
N & node (size_t index)
 
SubgraphT< N > & addSubgraph ()
 
size_t numSubgraphs () const
 
const SubgraphT< N > & subgraph (size_t index) const
 
SubgraphT< N > & subgraph (size_t index)
 
template<class F >
void forEachSubgraph (F &&func) const
 
template<class F >
void forEachSubgraph (F &&func)
 
template<class F >
void forEachNode (F &&func) const
 
template<class F >
void forEachNode (F &&func)
 
void clear ()
 
void clearSubgraphs ()
 

Friends

template<class T >
class SubgraphT
 

Detailed Description

template<class N>
class dispenso::GraphT< N >

A directed acyclic graph (DAG) for expressing task dependencies.

GraphT manages a collection of subgraphs, each containing nodes that represent work to be done. Nodes can have dependencies on other nodes, and the graph executor ensures nodes run only after their dependencies complete.

Template Parameters
NThe node type (Node or BiPropNode).

Definition at line 577 of file graph.h.

Constructor & Destructor Documentation

◆ GraphT() [1/2]

template<class N >
dispenso::GraphT< N >::GraphT ( )
inline

Create empty graph.

Definition at line 586 of file graph.h.

◆ GraphT() [2/2]

template<class N >
dispenso::GraphT< N >::GraphT ( GraphT< N > && other)

Move constructor

Member Function Documentation

◆ addNode()

template<class N >
template<class T >
N & dispenso::GraphT< N >::addNode ( T && f)
inline

Construct a NodeType with a valid functor. This node is created into subgraph 0. This is not concurrency safe.

Parameters
fA functor with signature void().

Definition at line 605 of file graph.h.

◆ addSubgraph()

template<class N >
SubgraphT< N > & dispenso::GraphT< N >::addSubgraph ( )

Create an empty subgraph. This is not concurrency safe.

◆ clear()

template<class N >
void dispenso::GraphT< N >::clear ( )
inline

Destroy all nodes and subgraphs. This is not concurrency safe.

Definition at line 708 of file graph.h.

◆ clearSubgraphs()

template<class N >
void dispenso::GraphT< N >::clearSubgraphs ( )
inline

Destroy all nodes. Keeps subgraphs. This is not concurrency safe.

Definition at line 715 of file graph.h.

◆ forEachNode() [1/2]

template<class N >
template<class F >
void dispenso::GraphT< N >::forEachNode ( F && func)
inline

apply an func to each node in the graph. Concurrency safe.

Parameters
funca functor with signature void(const Node&)

Definition at line 698 of file graph.h.

◆ forEachNode() [2/2]

template<class N >
template<class F >
void dispenso::GraphT< N >::forEachNode ( F && func) const
inline

apply an func to each node in the graph including all nodes from all subgraphs. Concurrency safe.

Parameters
funca functor with signature void(const Node&)

Definition at line 685 of file graph.h.

◆ forEachSubgraph() [1/2]

template<class N >
template<class F >
void dispenso::GraphT< N >::forEachSubgraph ( F && func)
inline

apply an func to each subgraph in the graph. Concurrency safe.

Parameters
funca functor with signature void(SubgraphT<N>&)

Definition at line 673 of file graph.h.

◆ forEachSubgraph() [2/2]

template<class N >
template<class F >
void dispenso::GraphT< N >::forEachSubgraph ( F && func) const
inline

apply an func to each subgraph in the graph. Concurrency safe.

Parameters
funca functor with signature void(const SubgraphT<N>&)

Definition at line 662 of file graph.h.

◆ node() [1/2]

template<class N >
N & dispenso::GraphT< N >::node ( size_t index)
inline

Return reference to node with index in subgraph 0. Concurrency safe.

Parameters
index- index of the node

Definition at line 627 of file graph.h.

◆ node() [2/2]

template<class N >
const N & dispenso::GraphT< N >::node ( size_t index) const
inline

Return const reference to node with index in subgraph 0. Concurrency safe.

Parameters
index- index of the node

Definition at line 619 of file graph.h.

◆ numNodes()

template<class N >
size_t dispenso::GraphT< N >::numNodes ( ) const
inline

Return number of nodes in subgraph 0. Concurrency safe.

Definition at line 611 of file graph.h.

◆ numSubgraphs()

template<class N >
size_t dispenso::GraphT< N >::numSubgraphs ( ) const
inline

Return number of subgraphs in the graph including subgraph 0. Concurrency safe.

Definition at line 637 of file graph.h.

◆ subgraph() [1/2]

template<class N >
SubgraphT< N > & dispenso::GraphT< N >::subgraph ( size_t index)
inline

Return reference to subgraph with index. Concurrency safe.

Parameters
index- index of the subgraph.

Definition at line 653 of file graph.h.

◆ subgraph() [2/2]

template<class N >
const SubgraphT< N > & dispenso::GraphT< N >::subgraph ( size_t index) const
inline

Return const reference to subgraph with index. Concurrency safe.

Parameters
index- index of the subgraph.

Definition at line 645 of file graph.h.

Friends And Related Symbol Documentation

◆ SubgraphT

template<class N >
template<class T >
friend class SubgraphT
friend

Definition at line 735 of file graph.h.


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