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

Undo libosrm API break by adding old interface as method overload #5861

Merged
merged 2 commits into from
Jan 27, 2021

Conversation

mjjbell
Copy link
Member

@mjjbell mjjbell commented Oct 18, 2020

Issue

Alternative to #5860

Removes the breaking libosrm API change by adding the old interface to the new. This does not introduce any new breaks.

The downside of this is that it allows for multiple ways to return JSON responses.

Tasklist

Requirements / Relations

Closes #5741
Closes #5548

@mjjbell mjjbell force-pushed the mbell/libosrm_api_2 branch from 6576366 to 41298e0 Compare October 19, 2020 00:22
Removes the breaking libosrm API change by adding the old interface to
the new. This does not introduce any new breaks.

The downside of this is that it allows for multiple ways to
return JSON responses.
Copy link
Contributor

@akashihi akashihi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking loudly - can we use some template magic to avoid methods duplication?

@mjjbell
Copy link
Member Author

mjjbell commented Oct 20, 2020

Just thinking loudly - can we use some template magic to avoid methods duplication?

I'm not a templates expert, but with a bit of meta-programming it looks like we can do something like:

    template <class T,
              typename = std::enable_if_t<is_any<T, json::Object, engine::api::ResultT>::value>>
    Status Route(const engine::api::RouteParameters &params, T &result) const;

Is there a nicer way to do it? This feels a bit more difficult to understand than the overloaded methods, given osrm.hpp also acts as documentation.

@akashihi
Copy link
Contributor

You meta-programming kung fu is better than mine :) Let's wait for a second opinion.

@danpat danpat mentioned this pull request Jan 26, 2021
@danpat danpat merged commit bd3eb65 into Project-OSRM:master Jan 27, 2021
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.

libosrm breaking change in master after v5.22.0 libosrm interface broken due to public API changes
3 participants