MyraMath
traverse.h
Go to the documentation of this file.
1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
6 #ifndef MYRAMATH_JOBGRAPH_TRAVERSE_H
7 #define MYRAMATH_JOBGRAPH_TRAVERSE_H
8 
14 // Required components of return value.
16 #include <vector>
17 #include <map>
18 
19 namespace myra {
20 
21 // Forward declarations.
22 class Job;
23 class JobGraph;
24 
26 // Note that Jobs are returned in a topologically sorted order, so a sequential forward for
27 // loop will visit all the Jobs in an order that satisfies all parent/child relationships.
28 std::vector<Job*> traverse_ordered(const JobGraph& graph);
29 
31 // Note that Jobs are returned in basically random order.
32 // Caller needs to sequence them using parent/child dependencies.
33 std::vector<Job*> traverse_unordered(const JobGraph& graph);
34 
36 std::map<JobID,int> key2j(const std::vector<Job*> jobs);
37 
38 class JobMap
39 {
40  public:
41  JobMap();
42  JobMap(const std::vector<Job*> jobs);
43  int at(JobID id) const;
44  int size() const;
45  private:
46  typedef std::pair<JobID,int> Pair;
47  typedef std::vector<Pair> Pairs;
48  Pairs pairs;
49 };
50 
51 std::vector<JobID> key2j3(std::vector<Job*> jobs);
52 
53 } // namespace
54 
55 #endif
Definition: traverse.h:38
Definition: syntax.dox:1
Key type used to identify the Job&#39;s of a JobGraph.
Key type used to identify the Job&#39;s of a JobGraph.
Definition: JobID.h:60