Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Graph adders #236

Merged
merged 5 commits into from
Dec 20, 2024
Merged

Enhance Graph adders #236

merged 5 commits into from
Dec 20, 2024

Conversation

Grufoony
Copy link
Collaborator

No description provided.

src/dsm/headers/Graph.hpp Fixed Show fixed Hide fixed
@@ -271,10 +277,16 @@
Func f = streetLength) const;
};

template <typename node_t, typename... TArgs>

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
@@ -271,10 +277,16 @@
Func f = streetLength) const;
};

template <typename node_t, typename... TArgs>
requires(std::is_base_of_v<Node, node_t>,

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
@@ -271,10 +277,16 @@
Func f = streetLength) const;
};

template <typename node_t, typename... TArgs>
requires(std::is_base_of_v<Node, node_t>,
std::constructible_from<node_t, Id, TArgs...>)

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
std::constructible_from<node_t, Id, TArgs...>)
node_t& Graph::addNode(Id id, TArgs&&... args) {
addNode(std::make_unique<node_t>(id, std::forward<TArgs>(args)...));
return dynamic_cast<node_t&>(*m_nodes[id]);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.5 rule Note

MISRA 15.5 rule
@@ -283,6 +295,14 @@
addNodes(std::forward<Tn>(nodes)...);
}

template <typename edge_t, typename... TArgs>

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
@@ -283,6 +295,14 @@
addNodes(std::forward<Tn>(nodes)...);
}

template <typename edge_t, typename... TArgs>
requires(std::is_base_of_v<Street, edge_t>,

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
@@ -283,6 +295,14 @@
addNodes(std::forward<Tn>(nodes)...);
}

template <typename edge_t, typename... TArgs>
requires(std::is_base_of_v<Street, edge_t>,
std::constructible_from<edge_t, Id, TArgs...>)

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
std::constructible_from<edge_t, Id, TArgs...>)
edge_t& Graph::addEdge(Id id, TArgs&&... args) {
addStreet(std::make_unique<edge_t>(id, std::forward<TArgs>(args)...));
return dynamic_cast<edge_t&>(*m_streets[id]);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.5 rule Note

MISRA 15.5 rule
@@ -20,13 +20,12 @@
Bench b1(n_rep);

std::cout << "Benchmarking addNode\n";
Intersection n1(std::rand());
b1.benchmark([&g1](const Intersection& node) -> void { g1.addNode(node); }, n1);
b1.benchmark([&g1]() -> void { g1.addNode<Intersection>(std::rand()); });

Check notice

Code scanning / Cppcheck (reported by Codacy)

Do not use the rand() function for generating pseudorandom numbers Note test

Do not use the rand() function for generating pseudorandom numbers
@Grufoony Grufoony requested a review from sbaldu December 20, 2024 15:09
@Grufoony Grufoony merged commit 8592bb3 into main Dec 20, 2024
25 checks passed
@Grufoony Grufoony deleted the enhance_graphAdders branch December 20, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant