From a64145b7129c10baedc53155ffcfb02bf0fdba79 Mon Sep 17 00:00:00 2001 From: vng Date: Wed, 26 Jul 2017 17:46:26 +0300 Subject: [PATCH] Fixed mld algorithm to use template data facade. --- .../routing_algorithms/routing_base_mld.hpp | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/include/engine/routing_algorithms/routing_base_mld.hpp b/include/engine/routing_algorithms/routing_base_mld.hpp index 102a8f8ed..21d8fa6e2 100644 --- a/include/engine/routing_algorithms/routing_base_mld.hpp +++ b/include/engine/routing_algorithms/routing_base_mld.hpp @@ -30,7 +30,8 @@ namespace // Unrestricted search (Args is const PhantomNodes &): // * use partition.GetQueryLevel to find the node query level based on source and target phantoms // * allow to traverse all cells -inline LevelID getNodeQueryLevel(const partition::MultiLevelPartitionView &partition, +template +inline LevelID getNodeQueryLevel(const MultiLevelPartition &partition, NodeID node, const PhantomNodes &phantom_nodes) { @@ -54,8 +55,8 @@ inline bool checkParentCellRestriction(CellID, const PhantomNodes &) { return tr // Restricted search (Args is LevelID, CellID): // * use the fixed level for queries // * check if the node cell is the same as the specified parent onr -inline LevelID -getNodeQueryLevel(const partition::MultiLevelPartitionView &, NodeID, LevelID level, CellID) +template +inline LevelID getNodeQueryLevel(const MultiLevelPartition &, NodeID, LevelID level, CellID) { return level; } @@ -130,10 +131,10 @@ retrievePackedPathFromHeap(const SearchEngineData::QueryHeap &forward return packed_path; } -template +template void routingStep(const DataFacade &facade, - SearchEngineData::QueryHeap &forward_heap, - SearchEngineData::QueryHeap &reverse_heap, + typename SearchEngineData::QueryHeap &forward_heap, + typename SearchEngineData::QueryHeap &reverse_heap, NodeID &middle_node, EdgeWeight &path_upper_bound, const bool force_loop_forward, @@ -260,11 +261,11 @@ using UnpackedNodes = std::vector; using UnpackedEdges = std::vector; using UnpackedPath = std::tuple; -template +template UnpackedPath search(SearchEngineData &engine_working_data, const DataFacade &facade, - SearchEngineData::QueryHeap &forward_heap, - SearchEngineData::QueryHeap &reverse_heap, + typename SearchEngineData::QueryHeap &forward_heap, + typename SearchEngineData::QueryHeap &reverse_heap, const bool force_loop_forward, const bool force_loop_reverse, EdgeWeight weight_upper_bound, @@ -389,10 +390,11 @@ UnpackedPath search(SearchEngineData &engine_working_data, } // Alias to be compatible with the CH-based search +template inline void search(SearchEngineData &engine_working_data, const DataFacade &facade, - SearchEngineData::QueryHeap &forward_heap, - SearchEngineData::QueryHeap &reverse_heap, + typename SearchEngineData::QueryHeap &forward_heap, + typename SearchEngineData::QueryHeap &reverse_heap, EdgeWeight &weight, std::vector &unpacked_nodes, const bool force_loop_forward, @@ -442,13 +444,14 @@ void unpackPath(const FacadeT &facade, annotatePath(facade, phantom_nodes, unpacked_nodes, unpacked_edges, unpacked_path); } -inline double getNetworkDistance(SearchEngineData &engine_working_data, - const DataFacade &facade, - SearchEngineData::QueryHeap &forward_heap, - SearchEngineData::QueryHeap &reverse_heap, - const PhantomNode &source_phantom, - const PhantomNode &target_phantom, - EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT) +template +double getNetworkDistance(SearchEngineData &engine_working_data, + const DataFacade &facade, + typename SearchEngineData::QueryHeap &forward_heap, + typename SearchEngineData::QueryHeap &reverse_heap, + const PhantomNode &source_phantom, + const PhantomNode &target_phantom, + EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT) { forward_heap.Clear(); reverse_heap.Clear();