Make CoreCH SearchEngineData inherited from CH one

this allows to keep a single Algorithm template parameter in internal
interfaces as

template <typename Algorithm>
search(SearchEngineData<Algorithm> &,
       const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &, ...)
This commit is contained in:
Michael Krasnyk
2017-04-12 08:22:28 +02:00
committed by Patrick Niklaus
parent f96bae40ac
commit 59b70c4d11
10 changed files with 43 additions and 40 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ template <typename Algorithm> class Engine final : public EngineInterface
private:
std::unique_ptr<DataFacadeProvider<Algorithm>> facade_provider;
mutable SearchEngineData<typename RoutingAlgorithms<Algorithm>::HeapAlgorithm> heaps;
mutable SearchEngineData<Algorithm> heaps;
const plugins::ViaRoutePlugin route_plugin;
const plugins::TablePlugin table_plugin;
+2 -11
View File
@@ -57,16 +57,7 @@ class RoutingAlgorithmsInterface
template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgorithmsInterface
{
public:
// HeapAlgorithm is an explicit heap algorithm type to be used with Algorithm
// - CH algorithms use CH heap
// - CoreCH algorithms use CH heap
// - MLD algorithms use MLD heap
using HeapAlgorithm = typename std::conditional<
std::is_same<Algorithm, routing_algorithms::corech::Algorithm>::value,
routing_algorithms::ch::Algorithm,
Algorithm>::type;
RoutingAlgorithms(SearchEngineData<HeapAlgorithm> &heaps,
RoutingAlgorithms(SearchEngineData<Algorithm> &heaps,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade)
: heaps(heaps), facade(facade)
{
@@ -131,7 +122,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
}
private:
SearchEngineData<HeapAlgorithm> &heaps;
SearchEngineData<Algorithm> &heaps;
// Owned by shared-ptr passed to the query
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade;
@@ -27,7 +27,7 @@ InternalRouteResult directShortestPathSearch(
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<ch::Algorithm> &engine_working_data,
SearchEngineData<corech::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
@@ -22,8 +22,8 @@ static const constexpr double DEFAULT_GPS_PRECISION = 5;
//[1] "Hidden Markov Map Matching Through Noise and Sparseness";
// P. Newson and J. Krumm; 2009; ACM GIS
template <typename Algorithm, typename SearchEngineData>
SubMatchingList mapMatching(SearchEngineData &engine_working_data,
template <typename Algorithm>
SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
@@ -13,9 +13,9 @@ namespace engine
namespace routing_algorithms
{
template <typename Algorithm, typename SearchEngineData>
template <typename Algorithm>
InternalRouteResult
shortestPathSearch(SearchEngineData &engine_working_data,
shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint);
+12
View File
@@ -12,6 +12,12 @@ namespace osrm
namespace engine
{
// Algorithm-dependent heaps
// - CH algorithms use CH heaps
// - CoreCH algorithms use CoreCH heaps that can be upcasted to CH heaps when CH algorithms reused
// by CoreCH at calling ch::routingStep, ch::retrievePackedPathFromSingleHeap and ch::unpackPath
// - MLD algorithms use MLD heaps
template <typename Algorithm> struct SearchEngineData
{
};
@@ -59,6 +65,12 @@ template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
};
template <>
struct SearchEngineData<routing_algorithms::corech::Algorithm>
: public SearchEngineData<routing_algorithms::ch::Algorithm>
{
};
struct MultiLayerDijkstraHeapData
{
NodeID parent;