-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
chore: C++20 RoutingAlgorithm concept #7529
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
294921b
Add C++20 RoutingAlgorithm concept and constrain core templates
DennisOSRM b6a8194
fix: formatting
DennisOSRM 9c1c89c
routing: tighten RoutingAlgorithm concept by requiring IsRoutingAlgor…
DennisOSRM 16f9c29
routing: address reviewer comments - remove unused <type_traits> and …
DennisOSRM d0f58a5
Merge branch 'master' into poc/concepts-routing-algorithm
DennisOSRM e158817
style: move include concepts.hpp higher and remove duplicate (formatt…
DennisOSRM dc1adb2
Merge remote-tracking branch 'origin/master' into poc/concepts-routin…
DennisOSRM 896e40c
tests: mark offline::Algorithm as supported routing algorithm
DennisOSRM c41ddc9
fix: formatting
DennisOSRM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #ifndef OSRM_ENGINE_CONCEPTS_HPP | ||
| #define OSRM_ENGINE_CONCEPTS_HPP | ||
|
|
||
| #include "engine/algorithm.hpp" | ||
| #include <concepts> | ||
|
|
||
| namespace osrm::engine::routing_algorithms | ||
| { | ||
|
|
||
| /* | ||
| * RoutingAlgorithm concept | ||
| * ------------------------ | ||
| * This concept documents and checks the compile-time interface expected | ||
| * from the routing algorithm marker types used throughout the engine | ||
| * (e.g., routing_algorithms::ch::Algorithm and routing_algorithms::mld::Algorithm). | ||
| * | ||
| * Required compile-time/public interface (checked by this concept): | ||
| * - routing_algorithms::name<Algorithm>() -> const char* | ||
| * - routing_algorithms::identifier<Algorithm>() -> const char* | ||
| * - trait templates (instantiable): | ||
| * HasAlternativePathSearch<Algorithm> | ||
| * HasShortestPathSearch<Algorithm> | ||
| * HasDirectShortestPathSearch<Algorithm> | ||
| * HasMapMatching<Algorithm> | ||
| * HasManyToManySearch<Algorithm> | ||
| * SupportsDistanceAnnotationType<Algorithm> | ||
| * HasGetTileTurns<Algorithm> | ||
| * HasExcludeFlags<Algorithm> | ||
| * - the above trait specializations must expose a compile-time ::value convertible to bool | ||
| */ | ||
| template <typename T> | ||
| concept RoutingAlgorithm = requires { | ||
| /* name() and identifier() are callable and return C strings */ | ||
| { name<T>() } -> std::convertible_to<const char *>; | ||
| { identifier<T>() } -> std::convertible_to<const char *>; | ||
|
|
||
| /* trait templates are instantiable */ | ||
| typename HasAlternativePathSearch<T>; | ||
| typename HasShortestPathSearch<T>; | ||
| typename HasDirectShortestPathSearch<T>; | ||
| typename HasMapMatching<T>; | ||
| typename HasManyToManySearch<T>; | ||
| typename SupportsDistanceAnnotationType<T>; | ||
| typename HasGetTileTurns<T>; | ||
| typename HasExcludeFlags<T>; | ||
|
|
||
| /* trait values are usable as compile-time booleans */ | ||
| { HasAlternativePathSearch<T>::value } -> std::convertible_to<bool>; | ||
| { HasShortestPathSearch<T>::value } -> std::convertible_to<bool>; | ||
| { HasDirectShortestPathSearch<T>::value } -> std::convertible_to<bool>; | ||
| { HasMapMatching<T>::value } -> std::convertible_to<bool>; | ||
| { HasManyToManySearch<T>::value } -> std::convertible_to<bool>; | ||
| { SupportsDistanceAnnotationType<T>::value } -> std::convertible_to<bool>; | ||
| { HasGetTileTurns<T>::value } -> std::convertible_to<bool>; | ||
| { HasExcludeFlags<T>::value } -> std::convertible_to<bool>; | ||
| } && IsRoutingAlgorithm<T>::value; | ||
|
|
||
| } // namespace osrm::engine::routing_algorithms | ||
|
|
||
| #endif // OSRM_ENGINE_CONCEPTS_HPP | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.