10 #ifndef WRENCH_DAGOFTASKS_H
11 #define WRENCH_DAGOFTASKS_H
13 #include <boost/graph/adjacency_list.hpp>
14 #include <boost/graph/breadth_first_search.hpp>
17 #include "wrench/workflow/WorkflowTask.h"
40 typedef boost::adjacency_list<boost::listS, boost::vecS, boost::bidirectionalS, VertexProperties>
DAG;
78 class custom_bfs_visitor :
public boost::default_bfs_visitor {
83 explicit custom_bfs_visitor(
const WorkflowTask *target_task) : boost::default_bfs_visitor() {
84 this->target_task = target_task;
87 template<
typename Vertex,
typename Graph>
88 void discover_vertex(Vertex u, Graph &g) {
89 if (g[u].task == target_task) {
90 throw std::runtime_error(
"path found");
95 std::vector<const WorkflowTask*> task_list;
96 std::unordered_map<const WorkflowTask *, unsigned long> task_map;
109 #endif //WRENCH_DAGOFTASKS_H
An internal class that uses the Boost Graph Library to implement a DAG of WorkflowTask objects.
Definition: DagOfTasks.h:50
std::vector< WorkflowTask * > getChildren(const WorkflowTask *task)
Method to get the children of a task vertex.
Definition: DagOfTasks.cpp:178
void removeEdge(WorkflowTask *src, WorkflowTask *dst)
Remove an edge between two task vertices.
Definition: DagOfTasks.cpp:83
long getNumberOfParents(const WorkflowTask *task)
Method to get the number of parents of a task vertex.
Definition: DagOfTasks.cpp:198
void addEdge(WorkflowTask *src, WorkflowTask *dst)
Method to add an edge between to task vertices.
Definition: DagOfTasks.cpp:64
const WorkflowTask * task
Task attached to the vertex.
Definition: DagOfTasks.h:34
void addVertex(const WorkflowTask *task)
Method to add a task vertex to the DAG.
Definition: DagOfTasks.cpp:24
bool doesPathExist(const WorkflowTask *src, const WorkflowTask *dst)
Method to check whether a path exists between to task vertices.
Definition: DagOfTasks.cpp:102
unsigned long vertex_t
Convenient vertext_t typedef.
Definition: DagOfTasks.h:45
Definition: Action.cpp:28
Data structure to store vertex properties.
Definition: DagOfTasks.h:30
A computational task in a Workflow.
Definition: WorkflowTask.h:33
std::vector< WorkflowTask * > getParents(const WorkflowTask *task)
Method to get the parents of a task vertex.
Definition: DagOfTasks.cpp:217
long getNumberOfChildren(const WorkflowTask *task)
Method to get the number of children of a task vertex.
Definition: DagOfTasks.cpp:159
void removeVertex(WorkflowTask *task)
Method to remove a task vertex from the DAG.
Definition: DagOfTasks.cpp:39
boost::adjacency_list< boost::listS, boost::vecS, boost::bidirectionalS, VertexProperties > DAG
Convenient DAG typedef.
Definition: DagOfTasks.h:40
bool doesEdgeExist(const WorkflowTask *src, const WorkflowTask *dst)
Method to check whether an edge exists between to task vertices.
Definition: DagOfTasks.cpp:137