Horizon
Loading...
Searching...
No Matches
dependency_graph.hpp
1#pragma once
2#include "uuid.hpp"
3#include <vector>
4#include <map>
5#include <set>
6
7namespace horizon {
8
10public:
11 DependencyGraph(const UUID &uu);
12 std::vector<UUID> get_sorted();
13 const std::set<UUID> &get_not_found() const;
14 void dump(const std::string &filename) const;
15
16protected:
17 class Node {
18 public:
19 Node(const UUID &uu, const std::vector<UUID> &deps) : uuid(uu), dependencies(deps)
20 {
21 }
22 const UUID uuid;
23 const std::vector<UUID> dependencies;
24 unsigned int level = 0;
25 unsigned int order = 0;
26 bool in_stack = false;
27 bool operator<(const Node &other) const
28 {
29 return std::make_pair(level, order) < std::make_pair(other.level, other.order);
30 }
31 };
32
33 std::map<UUID, Node> nodes;
34 const UUID root_uuid;
35 void visit(Node &node, unsigned int level);
36 std::set<UUID> not_found;
37};
38
39} // namespace horizon
Definition dependency_graph.hpp:17
Definition dependency_graph.hpp:9
This class encapsulates a UUID and allows it to be uses as a value type.
Definition uuid.hpp:16