From aa736dbe3a504810c353c712db695ade24b368fe Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Fri, 30 Jun 2017 23:51:14 +0200 Subject: [PATCH] Generalize directShortestPathSearch interface --- .../direct_shortest_path.hpp | 19 ++++--------- .../direct_shortest_path.cpp | 27 +++++++------------ 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/include/engine/routing_algorithms/direct_shortest_path.hpp b/include/engine/routing_algorithms/direct_shortest_path.hpp index 055b6ab13..6cc5cc488 100644 --- a/include/engine/routing_algorithms/direct_shortest_path.hpp +++ b/include/engine/routing_algorithms/direct_shortest_path.hpp @@ -21,20 +21,11 @@ namespace routing_algorithms /// by the previous route. /// This variation is only an optimazation for graphs with slow queries, for example /// not fully contracted graphs. -InternalRouteResult directShortestPathSearch( - SearchEngineData &engine_working_data, - const datafacade::ContiguousInternalMemoryDataFacade &facade, - const PhantomNodes &phantom_nodes); - -InternalRouteResult directShortestPathSearch( - SearchEngineData &engine_working_data, - const datafacade::ContiguousInternalMemoryDataFacade &facade, - const PhantomNodes &phantom_nodes); - -InternalRouteResult directShortestPathSearch( - SearchEngineData &engine_working_data, - const datafacade::ContiguousInternalMemoryDataFacade &facade, - const PhantomNodes &phantom_nodes); +template +InternalRouteResult +directShortestPathSearch(SearchEngineData &engine_working_data, + const datafacade::ContiguousInternalMemoryDataFacade &facade, + const PhantomNodes &phantom_nodes); } // namespace routing_algorithms } // namespace engine diff --git a/src/engine/routing_algorithms/direct_shortest_path.cpp b/src/engine/routing_algorithms/direct_shortest_path.cpp index b406bb205..671ea1308 100644 --- a/src/engine/routing_algorithms/direct_shortest_path.cpp +++ b/src/engine/routing_algorithms/direct_shortest_path.cpp @@ -44,8 +44,6 @@ extractRoute(const datafacade::ContiguousInternalMemoryDataFacade &f return raw_route_data; } -namespace detail -{ /// This is a striped down version of the general shortest path algorithm. /// The general algorithm always computes two queries for each leg. This is only /// necessary in case of vias, where the directions of the start node is constrainted @@ -53,10 +51,10 @@ namespace detail /// This variation is only an optimazation for graphs with slow queries, for example /// not fully contracted graphs. template -InternalRouteResult directShortestPathSearchImpl( - SearchEngineData &engine_working_data, - const datafacade::ContiguousInternalMemoryDataFacade &facade, - const PhantomNodes &phantom_nodes) +InternalRouteResult +directShortestPathSearch(SearchEngineData &engine_working_data, + const datafacade::ContiguousInternalMemoryDataFacade &facade, + const PhantomNodes &phantom_nodes) { engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes()); auto &forward_heap = *engine_working_data.forward_heap_1; @@ -100,24 +98,17 @@ InternalRouteResult directShortestPathSearchImpl( return extractRoute(facade, weight, phantom_nodes, unpacked_nodes, unpacked_edges); } -} // namespace ch - -InternalRouteResult directShortestPathSearch( +template InternalRouteResult directShortestPathSearch( SearchEngineData &engine_working_data, const datafacade::ContiguousInternalMemoryDataFacade &facade, - const PhantomNodes &phantom_nodes) -{ - return detail::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes); -} + const PhantomNodes &phantom_nodes); -InternalRouteResult directShortestPathSearch( +template InternalRouteResult directShortestPathSearch( SearchEngineData &engine_working_data, const datafacade::ContiguousInternalMemoryDataFacade &facade, - const PhantomNodes &phantom_nodes) -{ - return detail::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes); -} + const PhantomNodes &phantom_nodes); +template <> InternalRouteResult directShortestPathSearch( SearchEngineData &engine_working_data, const datafacade::ContiguousInternalMemoryDataFacade &facade,