HTGS  v2.0
The Hybrid Task Graph Scheduler
htgs::RuleEdge< T, U, W > Class Template Reference

Implements the rule edge that is added to the graph. More...

#include <htgs/core/graph/edge/RuleEdge.hpp>

Inheritance diagram for htgs::RuleEdge< T, U, W >:
Inheritance graph
Collaboration diagram for htgs::RuleEdge< T, U, W >:
Collaboration graph

Public Member Functions

 RuleEdge (Bookkeeper< T > *bookkeeper, std::shared_ptr< IRule< T, U >> rule, ITask< U, W > *consumer)
 Creates a rule edge. More...
 
void applyEdge (AnyTaskGraphConf *graph) override
 Applies an edge to a task graph. More...
 
EdgeDescriptorcopy (AnyTaskGraphConf *graph) override
 Creates a copy of the edge descriptor to be added to other graphs, such as those within execution pipelines. More...
 
- Public Member Functions inherited from htgs::EdgeDescriptor
virtual ~EdgeDescriptor ()
 Destructor.
 

Private Attributes

Bookkeeper< T > * bookkeeper
 The bookkeeper task.
 
std::shared_ptr< IRule< T, U > > rule
 the rule
 
ITask< U, W > * consumer
 the consumer task
 

Detailed Description

template<class T, class U, class W>
class htgs::RuleEdge< T, U, W >

Implements the rule edge that is added to the graph.

This edge connects a bookkeeper with some consumer task via a rule. The rule is used to decide when to produce data, often based on the state of the computation.

When applying the edge, the bookkeeper and consumer tasks are created. A new rule manager is created to manage the rule. This rule manager is added to the bookkeeper and uses the input connector from the consumer task to produce data.

During edge copying the bookkeeper and consumer tasks are copied. The rule is reused. This mechanism shares the rule among multiple bookkeepers, but is acceptable as the rule defines a mutex to ensure no race conditions.

Template Parameters
Tthe input type of the Bookkeeper and IRule
Uthe output type of the IRule and the input type of the consumer ITask
Wthe output type of the consumer ITask

Constructor & Destructor Documentation

◆ RuleEdge()

template<class T, class U, class W>
htgs::RuleEdge< T, U, W >::RuleEdge ( Bookkeeper< T > *  bookkeeper,
std::shared_ptr< IRule< T, U >>  rule,
ITask< U, W > *  consumer 
)
inline

Creates a rule edge.

Parameters
bookkeeperthe bookkeeper task
rulethe rule
consumerthe consumer task

Member Function Documentation

◆ applyEdge()

template<class T, class U, class W>
void htgs::RuleEdge< T, U, W >::applyEdge ( AnyTaskGraphConf graph)
inlineoverridevirtual

Applies an edge to a task graph.

An edge is added to the supplied task graph. Each ITask is obtains a task manager that is to be used to manage the ITask. The graph has helper function AnyTaskGraphConf::getTaskManager. This is used to get the correct task manager that is to be used for a given ITask.

Parameters
graphthe task graph configuration that the edge is applied to.

Implements htgs::EdgeDescriptor.

◆ copy()

template<class T, class U, class W>
EdgeDescriptor* htgs::RuleEdge< T, U, W >::copy ( AnyTaskGraphConf graph)
inlineoverridevirtual

Creates a copy of the edge descriptor to be added to other graphs, such as those within execution pipelines.

The edge descriptor typically has ITasks that are added to a TaskManager, which is then added to the task graph. The copy function is used to copy the ITasks and any other meta data that is needed for applying the edge. The implementation should use the AnyTaskGraphConf::getCopy function to get copies of the ITask.

Parameters
graphthe graph you are getting ITask copies from.
Returns
a new EdgeDescriptor to be used to apply edges to a future task graph configuration.

Implements htgs::EdgeDescriptor.


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