Return vertex from PluginGraph::AddVertex()

This commit is contained in:
Oliver Hamlet
2023-01-06 22:20:37 +00:00
parent 1abba782f0
commit a82f9a8f99
3 changed files with 24 additions and 52 deletions
+3 -1
View File
@@ -577,9 +577,11 @@ void PluginGraph::AddEdge(const vertex_t& fromVertex,
pathsCache_.CachePath(fromVertex, toVertex);
}
void PluginGraph::AddVertex(const PluginSortingData& plugin) {
vertex_t PluginGraph::AddVertex(const PluginSortingData& plugin) {
const auto vertex = boost::add_vertex(plugin, graph_);
pluginNameVertexMap.emplace(plugin.GetName(), vertex);
return vertex;
}
void PluginGraph::AddSpecificEdges() {
+1 -1
View File
@@ -88,7 +88,7 @@ public:
void AddEdge(const vertex_t& fromVertex,
const vertex_t& toVertex,
EdgeType edgeType);
void AddVertex(const PluginSortingData& plugin);
vertex_t AddVertex(const PluginSortingData& plugin);
void AddSpecificEdges();
void AddHardcodedPluginEdges(
@@ -151,11 +151,8 @@ TEST_F(PluginGraphTest,
addOverlapEdgesShouldNotAddEdgesBetweenNonOverlappingPlugins) {
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -175,11 +172,8 @@ TEST_F(
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -199,11 +193,8 @@ TEST_F(
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -222,11 +213,8 @@ TEST_F(
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -246,11 +234,8 @@ TEST_F(
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -269,11 +254,8 @@ TEST_F(
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -293,11 +275,8 @@ TEST_F(
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -318,11 +297,8 @@ TEST_F(
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -344,11 +320,8 @@ TEST_F(
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();
@@ -370,11 +343,8 @@ TEST_F(PluginGraphTest,
PluginGraph graph;
graph.AddVertex(CreatePluginSortingData("1.esp"));
graph.AddVertex(CreatePluginSortingData("2.esp"));
const auto v1 = graph.GetVertexByName("1.esp").value();
const auto v2 = graph.GetVertexByName("2.esp").value();
const auto v1 = graph.AddVertex(CreatePluginSortingData("1.esp"));
const auto v2 = graph.AddVertex(CreatePluginSortingData("2.esp"));
graph.AddOverlapEdges();