PRGraphVisitors.h
Go to the documentation of this file.
1 #ifndef PRGRAPHVISITORS_H_
2 #define PRGRAPHVISITORS_H_
3 
4 #include "IGraphVisitor.h"
5 #include "PrecedenceRulesGraph.h"
6 
7 namespace concurrency {
8 
9  class RunSimulator : public IGraphVisitor {
10  public:
12  RunSimulator(const int& slotNum) {
13  m_nodesSucceeded = 0;
14  m_slotNum = slotNum;
15  };
17  ~RunSimulator() override {}
18 
19  bool visitEnter(DecisionNode& node) const override;
20 
21  bool visit(DecisionNode& node) override;
22 
23  bool visitLeave(DecisionNode& node) const override;
24 
25 
26  bool visitEnter(AlgorithmNode& node) const override;
27 
28  bool visit(AlgorithmNode& node) override;
29 
30 
31  void reset() override { m_nodesSucceeded = 0; }
32 
33  };
34 
38  class Trigger : public IGraphVisitor {
39  public:
41  Trigger(const int& slotNum) {
42  m_nodesSucceeded = 0;
43  m_slotNum = slotNum;
44  };
46  ~Trigger() override {}
47 
48  bool visitEnter(DecisionNode& node) const override;
49 
50  bool visit(DecisionNode& node) override;
51 
52  bool visitLeave(DecisionNode& /*node*/) const override {return true;};
53 
54 
55  bool visitEnter(AlgorithmNode& node) const override;
56 
57  bool visit(AlgorithmNode& node) override;
58 
59 
60  void reset() override { m_nodesSucceeded = 0; }
61 
62  };
63 
64 
65  class Supervisor : public IGraphVisitor {
66  public:
68  Supervisor(const int& slotNum) {
69  m_nodesSucceeded = 0;
70  m_slotNum = slotNum;
71  };
73  ~Supervisor() override {}
74 
75  bool visitEnter(DecisionNode& node) const override;
76 
77  bool visit(DecisionNode& node) override;
78 
79  bool visitLeave(DecisionNode& /*node*/) const override {return true;};
80 
81 
82  bool visitEnter(AlgorithmNode& node) const override;
83 
84  bool visit(AlgorithmNode& node) override;
85 
86 
87  void reset() override { m_nodesSucceeded = 0; }
88 
89  };
90 
92  public:
95  m_nodesSucceeded = 0;
96  m_slotNum = -1;
97  };
100 
101  bool visitEnter(DecisionNode&) const override {return true;}
102 
103  bool visit(DecisionNode&) override {return true;}\
104 
105  bool visitLeave(DecisionNode&) const override {return true;}
106 
107 
108  bool visitEnter(AlgorithmNode&) const override {return true;}
109 
110  bool visit(AlgorithmNode& node) override;
111 
112 
113  void reset() override { m_nodesSucceeded = 0; }
114 
115  };
116 
118  public:
121  m_nodesSucceeded = 0;
122  m_slotNum = -1;
123  };
126 
127  bool visitEnter(DecisionNode&) const override {return true;}
128 
129  bool visit(DecisionNode&) override {return true;}
130 
131  bool visitLeave(DecisionNode&) const override {return true;}
132 
133 
134  bool visitEnter(AlgorithmNode&) const override {return true;}
135 
136  bool visit(AlgorithmNode& node) override;
137 
138 
139  void reset() override { m_nodesSucceeded = 0; }
140 
141  void runThroughAdjacents(boost::graph_traits<boost::ExecPlan>::vertex_descriptor vertex, boost::ExecPlan graph);
142 
143  };
144 
145  class RankerByTiming : public IGraphVisitor {
146  public:
149  m_nodesSucceeded = 0;
150  m_slotNum = -1;
151  };
153  ~RankerByTiming() override {}
154 
155  bool visitEnter(DecisionNode&) const override {return true;}
156 
157  bool visit(DecisionNode&) override {return true;}
158 
159  bool visitLeave(DecisionNode&) const override {return true;}
160 
161 
162  bool visitEnter(AlgorithmNode&) const override {return true;}
163 
164  bool visit(AlgorithmNode& node) override;
165 
166 
167  void reset() override { m_nodesSucceeded = 0; }
168 
169  };
170 
172  public:
175  m_nodesSucceeded = 0;
176  m_slotNum = -1;
177  };
179  ~RankerByEccentricity() override {}
180 
181  bool visitEnter(DecisionNode&) const override {return true;}
182 
183  bool visit(DecisionNode&) override {return true;}
184 
185  bool visitLeave(DecisionNode&) const override {return true;}
186 
187 
188  bool visitEnter(AlgorithmNode&) const override {return true;}
189 
190  bool visit(AlgorithmNode& node) override;
191 
192 
193  void reset() override { m_nodesSucceeded = 0; }
194 
195  };
196 
198  public:
201  m_nodesSucceeded = 0;
202  m_slotNum = -1;
203  m_currentDepth = 0;
204  m_maxKnownDepth = 0;
205  };
208 
209  bool visitEnter(DecisionNode&) const override {return true;}
210 
211  bool visit(DecisionNode&) override {return true;}
212 
213  bool visitLeave(DecisionNode&) const override {return true;}
214 
215 
216  bool visitEnter(AlgorithmNode&) const override {return true;}
217 
218  bool visit(AlgorithmNode& node) override;
219 
220 
221  void reset() override {
222  m_nodesSucceeded = 0;
223  m_currentDepth = 0;
224  m_maxKnownDepth = 0;
225  }
226 
229  void recursiveVisit(AlgorithmNode& node);
230 
233 
234  };
235 
236 }
237 
238 
239 
240 #endif /* PRGRAPHVISITORS_H_ */
~RankerByCummulativeOutDegree() override
Destructor.
bool visitLeave(DecisionNode &) const override
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AlgoNodeStruct > ExecPlan
bool visitEnter(AlgorithmNode &) const override
bool visitEnter(AlgorithmNode &) const override
bool visitLeave(DecisionNode &) const override
RunSimulator(const int &slotNum)
Constructor.
bool visit(DecisionNode &) override
bool visitLeave(DecisionNode &) const override
bool visit(DecisionNode &) override
A visitor, performing full top-down traversals of a graph.
bool visitLeave(DecisionNode &) const override
bool visitLeave(DecisionNode &) const override
~RankerByEccentricity() override
Destructor.
bool visitEnter(DecisionNode &) const override
~RankerByDataRealmEccentricity() override
Destructor.
~Trigger() override
Destructor.
bool visitEnter(DecisionNode &node) const override
bool visitLeave(DecisionNode &) const override
bool visitEnter(AlgorithmNode &) const override
bool visitEnter(DecisionNode &) const override
bool visitEnter(AlgorithmNode &) const override
bool visitLeave(DecisionNode &node) const override
bool visit(DecisionNode &) override
bool visitEnter(AlgorithmNode &) const override
bool visitLeave(DecisionNode &) const override
bool visit(DecisionNode &) override
void reset() override
bool visitEnter(DecisionNode &) const override
~Supervisor() override
Destructor.
Trigger(const int &slotNum)
Constructor.
~RankerByProductConsumption() override
Destructor.
~RunSimulator() override
Destructor.
bool visitEnter(DecisionNode &) const override
bool visitEnter(DecisionNode &) const override
bool visit(DecisionNode &) override
Supervisor(const int &slotNum)
Constructor.
~RankerByTiming() override
Destructor.
bool visit(DecisionNode &node) override