MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / DependencyGraphImpl

Class DependencyGraphImpl

modules/core/core/src/graph/build.dag.cpp:7–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5{
6using namespace lemon;
7class DependencyGraphImpl : public DependencyGraph
8{
9public:
10 using DAGVertex = ListDigraph::Node;
11 using DAGEdge = ListDigraph::Arc;
12 using DAGVertMap = ListDigraph::NodeMap<Node*>;
13 using DAGEdgeMap = ListDigraph::ArcMap<Edge*>;
14 using DAG = ListDigraph;
15 DependencyGraphImpl() SKR_NOEXCEPT
16 : vert_map(graph), edge_map(graph)
17 {
18
19 }
20 DAG graph;
21 DAGVertMap vert_map;
22 DAGEdgeMap edge_map;
23
24 virtual dag_id_t insert(Node* node) SKR_NOEXCEPT final
25 {
26 const auto dag_node = graph.addNode();
27 node->id = graph.id(dag_node);
28 node->graph = this;
29 vert_map.set(dag_node, node);
30 node->on_insert();
31 return node->id;
32 }
33
34 virtual Node* access_node(dag_id_t id) SKR_NOEXCEPT final
35 {
36 const auto dag_node = graph.nodeFromId((int)id);
37 return vert_map[dag_node];
38 }
39
40 virtual bool remove(dag_id_t id) SKR_NOEXCEPT final
41 {
42 auto dag_node = graph.nodeFromId((int)id);
43 vert_map[dag_node]->on_remove();
44 graph.erase(dag_node);
45 return true;
46 }
47
48 virtual bool remove(Node* node) SKR_NOEXCEPT final
49 {
50 return remove(node->id);
51 }
52
53 virtual bool clear() SKR_NOEXCEPT final
54 {
55 graph.clear();
56 return true;
57 }
58
59 virtual bool link(Node* from, Node* to, Edge* edge) SKR_NOEXCEPT final
60 {
61 const auto from_node = graph.nodeFromId((int)from->get_id());
62 const auto to_node = graph.nodeFromId((int)to->get_id());
63 SKR_UNUSED const auto dag_arc = graph.addArc(from_node, to_node);
64 if (edge)

Callers

nothing calls this directly

Calls 13

removeFunction · 0.50
addNodeMethod · 0.45
idMethod · 0.45
setMethod · 0.45
nodeFromIdMethod · 0.45
eraseMethod · 0.45
clearMethod · 0.45
get_idMethod · 0.45
addArcMethod · 0.45
sourceMethod · 0.45
targetMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected