Add abstraction to change the data facade at compile time

This commit is contained in:
Patrick Niklaus 2017-07-13 13:05:08 +00:00 committed by Patrick Niklaus
parent b2ed46efb5
commit 49f0b1eb59
33 changed files with 267 additions and 275 deletions

View File

@ -0,0 +1,26 @@
#ifndef OSRM_ENGINE_DATAFACADE_DATAFACADE_HPP
#define OSRM_ENGINE_DATAFACADE_DATAFACADE_HPP
#ifdef OSRM_EXTERNAL_MEMORY
// Register your own data backend here
#error "No external memory implementation found"
#else
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
namespace osrm
{
namespace engine
{
using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase;
template <typename AlgorithmT>
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
}
}
#endif
#endif

View File

@ -2,6 +2,7 @@
#define OSRM_ENGINE_DATAFACADE_PROVIDER_HPP
#include "engine/data_watchdog.hpp"
#include "engine/datafacade.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade/process_memory_allocator.hpp"
@ -9,48 +10,56 @@ namespace osrm
{
namespace engine
{
template <typename AlgorithmT> class DataFacadeProvider
namespace detail
{
using FacadeT = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
template <typename AlgorithmT, template <typename A> class FacadeT> class DataFacadeProvider
{
public:
using Facade = FacadeT<AlgorithmT>;
virtual ~DataFacadeProvider() = default;
virtual std::shared_ptr<const FacadeT> Get() const = 0;
virtual std::shared_ptr<const Facade> Get() const = 0;
};
template <typename AlgorithmT> class ImmutableProvider final : public DataFacadeProvider<AlgorithmT>
template <typename AlgorithmT, template <typename A> class FacadeT>
class ImmutableProvider final : public DataFacadeProvider<AlgorithmT, FacadeT>
{
using FacadeT = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
public:
using Facade = typename DataFacadeProvider<AlgorithmT, FacadeT>::Facade;
ImmutableProvider(const storage::StorageConfig &config)
: immutable_data_facade(std::make_shared<FacadeT>(
: immutable_data_facade(std::make_shared<Facade>(
std::make_shared<datafacade::ProcessMemoryAllocator>(config)))
{
}
std::shared_ptr<const FacadeT> Get() const override final { return immutable_data_facade; }
std::shared_ptr<const Facade> Get() const override final { return immutable_data_facade; }
private:
std::shared_ptr<const FacadeT> immutable_data_facade;
std::shared_ptr<const Facade> immutable_data_facade;
};
template <typename AlgorithmT> class WatchingProvider final : public DataFacadeProvider<AlgorithmT>
template <typename AlgorithmT, template <typename A> class FacadeT>
class WatchingProvider : public DataFacadeProvider<AlgorithmT, FacadeT>
{
using FacadeT = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
DataWatchdog<AlgorithmT> watchdog;
public:
std::shared_ptr<const FacadeT> Get() const override final
{
// We need a singleton here because multiple instances of DataWatchdog
// conflict on shared memory mappings
return watchdog.Get();
}
using Facade = typename DataFacadeProvider<AlgorithmT, FacadeT>::Facade;
std::shared_ptr<const Facade> Get() const override final { return watchdog.Get(); }
};
}
template <typename AlgorithmT>
using DataFacadeProvider = detail::DataFacadeProvider<AlgorithmT, DataFacade>;
template <typename AlgorithmT>
using WatchingProvider = detail::WatchingProvider<AlgorithmT, DataFacade>;
template <typename AlgorithmT>
using ImmutableProvider = detail::ImmutableProvider<AlgorithmT, DataFacade>;
}
}
#endif

View File

@ -85,47 +85,41 @@ template <typename Algorithm> class Engine final : public EngineInterface
Status Route(const api::RouteParameters &params,
util::json::Object &result) const override final
{
auto facade = facade_provider->Get();
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
return route_plugin.HandleRequest(*facade, algorithms, params, result);
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
return route_plugin.HandleRequest(algorithms, params, result);
}
Status Table(const api::TableParameters &params,
util::json::Object &result) const override final
{
auto facade = facade_provider->Get();
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
return table_plugin.HandleRequest(*facade, algorithms, params, result);
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
return table_plugin.HandleRequest(algorithms, params, result);
}
Status Nearest(const api::NearestParameters &params,
util::json::Object &result) const override final
{
auto facade = facade_provider->Get();
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
return nearest_plugin.HandleRequest(*facade, algorithms, params, result);
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
return nearest_plugin.HandleRequest(algorithms, params, result);
}
Status Trip(const api::TripParameters &params, util::json::Object &result) const override final
{
auto facade = facade_provider->Get();
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
return trip_plugin.HandleRequest(*facade, algorithms, params, result);
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
return trip_plugin.HandleRequest(algorithms, params, result);
}
Status Match(const api::MatchParameters &params,
util::json::Object &result) const override final
{
auto facade = facade_provider->Get();
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
return match_plugin.HandleRequest(*facade, algorithms, params, result);
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
return match_plugin.HandleRequest(algorithms, params, result);
}
Status Tile(const api::TileParameters &params, std::string &result) const override final
{
auto facade = facade_provider->Get();
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, *facade};
return tile_plugin.HandleRequest(*facade, algorithms, params, result);
auto algorithms = RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get()};
return tile_plugin.HandleRequest(algorithms, params, result);
}
static bool CheckCompability(const EngineConfig &config);

View File

@ -32,8 +32,7 @@ class MatchPlugin : public BasePlugin
{
}
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::MatchParameters &parameters,
util::json::Object &json_result) const;

View File

@ -19,8 +19,7 @@ class NearestPlugin final : public BasePlugin
public:
explicit NearestPlugin(const int max_results);
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::NearestParameters &params,
util::json::Object &result) const;

View File

@ -21,8 +21,7 @@ class TablePlugin final : public BasePlugin
public:
explicit TablePlugin(const int max_locations_distance_table);
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::TableParameters &params,
util::json::Object &result) const;

View File

@ -26,8 +26,7 @@ namespace plugins
class TilePlugin final : public BasePlugin
{
public:
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::TileParameters &parameters,
std::string &pbf_buffer) const;
};

View File

@ -38,8 +38,7 @@ class TripPlugin final : public BasePlugin
public:
explicit TripPlugin(const int max_locations_trip_) : max_locations_trip(max_locations_trip_) {}
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::TripParameters &parameters,
util::json::Object &json_result) const;
};

View File

@ -32,8 +32,7 @@ class ViaRoutePlugin final : public BasePlugin
public:
explicit ViaRoutePlugin(int max_locations_viaroute, int max_alternatives);
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::RouteParameters &route_parameters,
util::json::Object &json_result) const;
};

View File

@ -46,6 +46,8 @@ class RoutingAlgorithmsInterface
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes) const = 0;
virtual const DataFacadeBase &GetFacade() const = 0;
virtual bool HasAlternativePathSearch() const = 0;
virtual bool HasShortestPathSearch() const = 0;
virtual bool HasDirectShortestPathSearch() const = 0;
@ -59,7 +61,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
{
public:
RoutingAlgorithms(SearchEngineData<Algorithm> &heaps,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade)
std::shared_ptr<const DataFacade<Algorithm>> facade)
: heaps(heaps), facade(facade)
{
}
@ -93,6 +95,8 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes) const final override;
const DataFacadeBase &GetFacade() const final override { return *facade; }
bool HasAlternativePathSearch() const final override
{
return routing_algorithms::HasAlternativePathSearch<Algorithm>::value;
@ -125,9 +129,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
private:
SearchEngineData<Algorithm> &heaps;
// Owned by shared-ptr passed to the query
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade;
std::shared_ptr<const DataFacade<Algorithm>> facade;
};
template <typename Algorithm>
@ -136,7 +138,7 @@ RoutingAlgorithms<Algorithm>::AlternativePathSearch(const PhantomNodes &phantom_
unsigned number_of_alternatives) const
{
return routing_algorithms::alternativePathSearch(
heaps, facade, phantom_node_pair, number_of_alternatives);
heaps, *facade, phantom_node_pair, number_of_alternatives);
}
template <typename Algorithm>
@ -145,14 +147,14 @@ InternalRouteResult RoutingAlgorithms<Algorithm>::ShortestPathSearch(
const boost::optional<bool> continue_straight_at_waypoint) const
{
return routing_algorithms::shortestPathSearch(
heaps, facade, phantom_node_pair, continue_straight_at_waypoint);
heaps, *facade, phantom_node_pair, continue_straight_at_waypoint);
}
template <typename Algorithm>
InternalRouteResult
RoutingAlgorithms<Algorithm>::DirectShortestPathSearch(const PhantomNodes &phantom_nodes) const
{
return routing_algorithms::directShortestPathSearch(heaps, facade, phantom_nodes);
return routing_algorithms::directShortestPathSearch(heaps, *facade, phantom_nodes);
}
template <typename Algorithm>
@ -162,7 +164,7 @@ RoutingAlgorithms<Algorithm>::ManyToManySearch(const std::vector<PhantomNode> &p
const std::vector<std::size_t> &target_indices) const
{
return routing_algorithms::manyToManySearch(
heaps, facade, phantom_nodes, source_indices, target_indices);
heaps, *facade, phantom_nodes, source_indices, target_indices);
}
template <typename Algorithm>
@ -174,7 +176,7 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms<Algorithm>::MapMatc
const bool allow_splitting) const
{
return routing_algorithms::mapMatching(heaps,
facade,
*facade,
candidates_list,
trace_coordinates,
trace_timestamps,
@ -187,7 +189,7 @@ inline std::vector<routing_algorithms::TurnData> RoutingAlgorithms<Algorithm>::G
const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes) const
{
return routing_algorithms::getTileTurns(facade, edges, sorted_edge_indexes);
return routing_algorithms::getTileTurns(*facade, edges, sorted_edge_indexes);
}
// CoreCH overrides

View File

@ -1,7 +1,7 @@
#ifndef ALTERNATIVE_PATH_ROUTING_HPP
#define ALTERNATIVE_PATH_ROUTING_HPP
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade.hpp"
#include "engine/internal_route_result.hpp"
#include "engine/algorithm.hpp"
@ -16,15 +16,13 @@ namespace engine
namespace routing_algorithms
{
InternalManyRoutesResult
alternativePathSearch(SearchEngineData<ch::Algorithm> &search_engine_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
InternalManyRoutesResult alternativePathSearch(SearchEngineData<ch::Algorithm> &search_engine_data,
const DataFacade<ch::Algorithm> &facade,
const PhantomNodes &phantom_node_pair,
unsigned number_of_alternatives);
InternalManyRoutesResult
alternativePathSearch(SearchEngineData<mld::Algorithm> &search_engine_data,
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
InternalManyRoutesResult alternativePathSearch(SearchEngineData<mld::Algorithm> &search_engine_data,
const DataFacade<mld::Algorithm> &facade,
const PhantomNodes &phantom_node_pair,
unsigned number_of_alternatives);

View File

@ -2,7 +2,7 @@
#define DIRECT_SHORTEST_PATH_HPP
#include "engine/algorithm.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade.hpp"
#include "engine/internal_route_result.hpp"
#include "engine/search_engine_data.hpp"
@ -22,9 +22,8 @@ namespace routing_algorithms
/// This variation is only an optimazation for graphs with slow queries, for example
/// not fully contracted graphs.
template <typename Algorithm>
InternalRouteResult
directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
InternalRouteResult directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
const PhantomNodes &phantom_nodes);
} // namespace routing_algorithms

View File

@ -2,7 +2,7 @@
#define MANY_TO_MANY_ROUTING_HPP
#include "engine/algorithm.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade.hpp"
#include "engine/search_engine_data.hpp"
#include "util/typedefs.hpp"
@ -17,9 +17,8 @@ namespace routing_algorithms
{
template <typename Algorithm>
std::vector<EdgeWeight>
manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
std::vector<EdgeWeight> manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
const std::vector<PhantomNode> &phantom_nodes,
const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices);

View File

@ -2,7 +2,7 @@
#define MAP_MATCHING_HPP
#include "engine/algorithm.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade.hpp"
#include "engine/map_matching/sub_matching.hpp"
#include "engine/search_engine_data.hpp"
@ -24,7 +24,7 @@ static const constexpr double DEFAULT_GPS_PRECISION = 5;
// P. Newson and J. Krumm; 2009; ACM GIS
template <typename Algorithm>
SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,

View File

@ -4,7 +4,7 @@
#include "extractor/guidance/turn_instruction.hpp"
#include "engine/algorithm.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade.hpp"
#include "engine/internal_route_result.hpp"
#include "engine/phantom_node.hpp"
#include "engine/search_engine_data.hpp"
@ -320,7 +320,7 @@ void annotatePath(const FacadeT &facade,
}
template <typename Algorithm>
double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
double getPathDistance(const DataFacade<Algorithm> &facade,
const std::vector<PathData> unpacked_path,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom)
@ -373,8 +373,7 @@ double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algo
}
template <typename AlgorithmT>
InternalRouteResult
extractRoute(const datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT> &facade,
InternalRouteResult extractRoute(const DataFacade<AlgorithmT> &facade,
const EdgeWeight weight,
const PhantomNodes &phantom_nodes,
const std::vector<NodeID> &unpacked_nodes,

View File

@ -2,7 +2,7 @@
#define OSRM_ENGINE_ROUTING_BASE_CH_HPP
#include "engine/algorithm.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade.hpp"
#include "engine/routing_algorithms/routing_base.hpp"
#include "engine/search_engine_data.hpp"
@ -23,7 +23,7 @@ namespace ch
// Stalling
template <bool DIRECTION, typename HeapT>
bool stallAtNode(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
bool stallAtNode(const DataFacade<Algorithm> &facade,
const NodeID node,
const EdgeWeight weight,
const HeapT &query_heap)
@ -49,7 +49,7 @@ bool stallAtNode(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
}
template <bool DIRECTION>
void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
const NodeID node,
const EdgeWeight weight,
SearchEngineData<Algorithm>::QueryHeap &heap)
@ -113,7 +113,7 @@ we need to add an offset to the termination criterion.
static constexpr bool ENABLE_STALLING = true;
static constexpr bool DISABLE_STALLING = false;
template <bool DIRECTION, bool STALLING = ENABLE_STALLING>
void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void routingStep(const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
NodeID &middle_node_id,
@ -186,8 +186,7 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
}
template <bool UseDuration>
EdgeWeight getLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
NodeID node)
EdgeWeight getLoopWeight(const DataFacade<Algorithm> &facade, NodeID node)
{
EdgeWeight loop_weight = UseDuration ? MAXIMAL_EDGE_DURATION : INVALID_EDGE_WEIGHT;
for (auto edge : facade.GetAdjacentEdgeRange(node))
@ -227,7 +226,7 @@ EdgeWeight getLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<Al
* original edge found.
*/
template <typename BidirectionalIterator, typename Callback>
void unpackPath(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void unpackPath(const DataFacade<Algorithm> &facade,
BidirectionalIterator packed_path_begin,
BidirectionalIterator packed_path_end,
Callback &&callback)
@ -327,7 +326,7 @@ void unpackPath(const FacadeT &facade,
* @param to the node the CH edge finishes at
* @param unpacked_path the sequence of original NodeIDs that make up the expanded CH edge
*/
void unpackEdge(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void unpackEdge(const DataFacade<Algorithm> &facade,
const NodeID from,
const NodeID to,
std::vector<NodeID> &unpacked_path);
@ -354,7 +353,7 @@ void retrievePackedPathFromSingleHeap(const SearchEngineData<Algorithm>::QueryHe
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
std::int32_t &weight,
@ -367,9 +366,8 @@ void search(SearchEngineData<Algorithm> &engine_working_data,
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<ch::Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,
@ -390,7 +388,7 @@ namespace corech
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const DataFacade<corech::Algorithm> &facade,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
int &weight,
@ -403,9 +401,8 @@ void search(SearchEngineData<Algorithm> &engine_working_data,
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<corech::Algorithm> &facade,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,

View File

@ -2,7 +2,7 @@
#define OSRM_ENGINE_ROUTING_BASE_MLD_HPP
#include "engine/algorithm.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade.hpp"
#include "engine/routing_algorithms/routing_base.hpp"
#include "engine/search_engine_data.hpp"
@ -131,7 +131,7 @@ retrievePackedPathFromHeap(const SearchEngineData<Algorithm>::QueryHeap &forward
}
template <bool DIRECTION, typename... Args>
void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void routingStep(const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
NodeID &middle_node,
@ -262,7 +262,7 @@ using UnpackedPath = std::tuple<EdgeWeight, UnpackedNodes, UnpackedEdges>;
template <typename... Args>
UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const bool force_loop_forward,
@ -390,7 +390,7 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
// Alias to be compatible with the CH-based search
inline void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
EdgeWeight &weight,
@ -442,9 +442,8 @@ void unpackPath(const FacadeT &facade,
annotatePath(facade, phantom_nodes, unpacked_nodes, unpacked_edges, unpacked_path);
}
inline double
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
inline double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,

View File

@ -14,9 +14,8 @@ namespace routing_algorithms
{
template <typename Algorithm>
InternalRouteResult
shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
InternalRouteResult shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint);

View File

@ -2,7 +2,8 @@
#define OSRM_ENGINE_ROUTING_ALGORITHMS_TILE_TURNS_HPP
#include "engine/algorithm.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
#include "engine/datafacade.hpp"
#include "engine/datafacade/datafacade_base.hpp"
#include "util/coordinate.hpp"
#include "util/typedefs.hpp"
@ -28,13 +29,11 @@ struct TurnData final
using RTreeLeaf = datafacade::BaseDataFacade::RTreeLeaf;
std::vector<TurnData>
getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
std::vector<TurnData> getTileTurns(const DataFacade<ch::Algorithm> &facade,
const std::vector<RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes);
std::vector<TurnData>
getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
std::vector<TurnData> getTileTurns(const DataFacade<mld::Algorithm> &facade,
const std::vector<RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes);

View File

@ -109,8 +109,7 @@ void filterCandidates(const std::vector<util::Coordinate> &coordinates,
}
}
Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::MatchParameters &parameters,
util::json::Object &json_result) const
{
@ -121,6 +120,8 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
json_result);
}
const auto &facade = algorithms.GetFacade();
BOOST_ASSERT(parameters.IsValid());
// enforce maximum number of locations for performance reasons

View File

@ -19,14 +19,14 @@ namespace plugins
NearestPlugin::NearestPlugin(const int max_results_) : max_results{max_results_} {}
Status
NearestPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface & /*algorithms*/,
Status NearestPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::NearestParameters &params,
util::json::Object &json_result) const
{
BOOST_ASSERT(params.IsValid());
const auto &facade = algorithms.GetFacade();
if (max_results > 0 &&
(boost::numeric_cast<std::int64_t>(params.number_of_results) > max_results))
{

View File

@ -28,8 +28,7 @@ TablePlugin::TablePlugin(const int max_locations_distance_table)
{
}
Status TablePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::TableParameters &params,
util::json::Object &result) const
{
@ -67,6 +66,7 @@ Status TablePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
return Error("TooBig", "Too many table coordinates", result);
}
const auto &facade = algorithms.GetFacade();
auto phantom_nodes = GetPhantomNodes(facade, params);
if (phantom_nodes.size() != params.coordinates.size())

View File

@ -230,10 +230,7 @@ FixedPoint coordinatesToTilePoint(const util::Coordinate point, const BBox &tile
return FixedPoint{px, py};
}
std::vector<RTreeLeaf> getEdges(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
unsigned x,
unsigned y,
unsigned z)
std::vector<RTreeLeaf> getEdges(const DataFacadeBase &facade, unsigned x, unsigned y, unsigned z)
{
double min_lon, min_lat, max_lon, max_lat;
@ -274,7 +271,7 @@ std::vector<std::size_t> getEdgeIndex(const std::vector<RTreeLeaf> &edges)
return sorted_edge_indexes;
}
void encodeVectorTile(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
void encodeVectorTile(const DataFacadeBase &facade,
unsigned x,
unsigned y,
unsigned z,
@ -882,13 +879,13 @@ void encodeVectorTile(const datafacade::ContiguousInternalMemoryDataFacadeBase &
}
}
Status TilePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status TilePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::TileParameters &parameters,
std::string &pbf_buffer) const
{
BOOST_ASSERT(parameters.IsValid());
const auto &facade = algorithms.GetFacade();
auto edges = getEdges(facade, parameters.x, parameters.y, parameters.z);
auto edge_index = getEdgeIndex(edges);

View File

@ -142,8 +142,7 @@ void ManipulateTableForFSE(const std::size_t source_id,
//********* End of changes to table *************************************
}
Status TripPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status TripPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::TripParameters &parameters,
util::json::Object &json_result) const
{
@ -192,6 +191,7 @@ Status TripPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataF
return Error("InvalidValue", "Invalid coordinate value.", json_result);
}
const auto &facade = algorithms.GetFacade();
auto phantom_node_pairs = GetPhantomNodes(facade, parameters);
if (phantom_node_pairs.size() != number_of_locations)
{

View File

@ -26,9 +26,7 @@ ViaRoutePlugin::ViaRoutePlugin(int max_locations_viaroute, int max_alternatives)
{
}
Status
ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
const RoutingAlgorithmsInterface &algorithms,
Status ViaRoutePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms,
const api::RouteParameters &route_parameters,
util::json::Object &json_result) const
{
@ -75,6 +73,7 @@ ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFaca
return Error("InvalidValue", "Invalid coordinate value.", json_result);
}
const auto &facade = algorithms.GetFacade();
auto phantom_node_pairs = GetPhantomNodes(facade, route_parameters);
if (phantom_node_pairs.size() != route_parameters.coordinates.size())
{

View File

@ -50,7 +50,7 @@ struct RankedCandidateNode
// todo: reorder parameters
template <bool DIRECTION>
void alternativeRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void alternativeRoutingStep(const DataFacade<Algorithm> &facade,
QueryHeap &heap1,
QueryHeap &heap2,
NodeID *middle_node,
@ -153,9 +153,8 @@ void retrievePackedAlternatePath(const QueryHeap &forward_heap1,
// compute and unpack <s,..,v> and <v,..,t> by exploring search spaces
// from v and intersecting against queues. only half-searches have to be
// done at this stage
void computeWeightAndSharingOfViaPath(
SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void computeWeightAndSharingOfViaPath(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
const NodeID via_node,
EdgeWeight *real_weight_of_via_path,
EdgeWeight *sharing_of_via_path,
@ -318,9 +317,8 @@ void computeWeightAndSharingOfViaPath(
}
// conduct T-Test
bool viaNodeCandidatePassesTTest(
SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
bool viaNodeCandidatePassesTTest(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
QueryHeap &existing_forward_heap,
QueryHeap &existing_reverse_heap,
QueryHeap &new_forward_heap,
@ -562,9 +560,8 @@ bool viaNodeCandidatePassesTTest(
}
} // anon. namespace
InternalManyRoutesResult
alternativePathSearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
InternalManyRoutesResult alternativePathSearch(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
const PhantomNodes &phantom_node_pair,
unsigned /*number_of_alternatives*/)
{

View File

@ -28,7 +28,7 @@ using namespace mld;
using Heap = SearchEngineData<Algorithm>::QueryHeap;
using Partition = partition::MultiLevelPartitionView;
using Facade = datafacade::ContiguousInternalMemoryDataFacade<Algorithm>;
using Facade = DataFacade<Algorithm>;
// Implementation details
namespace

View File

@ -18,9 +18,8 @@ namespace routing_algorithms
/// This variation is only an optimazation for graphs with slow queries, for example
/// not fully contracted graphs.
template <typename Algorithm>
InternalRouteResult
directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
InternalRouteResult directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
const PhantomNodes &phantom_nodes)
{
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());
@ -65,20 +64,19 @@ directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
return extractRoute(facade, weight, phantom_nodes, unpacked_nodes, unpacked_edges);
}
template InternalRouteResult directShortestPathSearch(
SearchEngineData<corech::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
template InternalRouteResult
directShortestPathSearch(SearchEngineData<corech::Algorithm> &engine_working_data,
const DataFacade<corech::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
template InternalRouteResult directShortestPathSearch(
SearchEngineData<ch::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
template InternalRouteResult
directShortestPathSearch(SearchEngineData<ch::Algorithm> &engine_working_data,
const DataFacade<ch::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
template <>
InternalRouteResult directShortestPathSearch(
SearchEngineData<mld::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
InternalRouteResult directShortestPathSearch(SearchEngineData<mld::Algorithm> &engine_working_data,
const DataFacade<mld::Algorithm> &facade,
const PhantomNodes &phantom_nodes)
{
engine_working_data.InitializeOrClearFirstThreadLocalStorage(facade.GetNumberOfNodes());

View File

@ -31,8 +31,7 @@ struct NodeBucket
// FIXME This should be replaced by an std::unordered_multimap, though this needs benchmarking
using SearchSpaceWithBuckets = std::unordered_map<NodeID, std::vector<NodeBucket>>;
inline bool
addLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
inline bool addLoopWeight(const DataFacade<ch::Algorithm> &facade,
const NodeID node,
EdgeWeight &weight,
EdgeDuration &duration)
@ -56,7 +55,7 @@ addLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm
}
template <bool DIRECTION>
void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
void relaxOutgoingEdges(const DataFacade<ch::Algorithm> &facade,
const NodeID node,
const EdgeWeight weight,
const EdgeDuration duration,
@ -97,17 +96,14 @@ void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<ch:
}
}
inline bool addLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &,
const NodeID,
EdgeWeight &,
EdgeDuration &)
inline bool
addLoopWeight(const DataFacade<mld::Algorithm> &, const NodeID, EdgeWeight &, EdgeDuration &)
{ // MLD overlay does not introduce loop edges
return false;
}
template <bool DIRECTION>
void relaxOutgoingEdges(
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
const NodeID node,
const EdgeWeight weight,
const EdgeDuration duration,
@ -218,7 +214,7 @@ void relaxOutgoingEdges(
}
template <typename Algorithm>
void forwardRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void forwardRoutingStep(const DataFacade<Algorithm> &facade,
const unsigned row_idx,
const unsigned number_of_targets,
typename SearchEngineData<Algorithm>::ManyToManyQueryHeap &query_heap,
@ -272,7 +268,7 @@ void forwardRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<Alg
}
template <typename Algorithm>
void backwardRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void backwardRoutingStep(const DataFacade<Algorithm> &facade,
const unsigned column_idx,
typename SearchEngineData<Algorithm>::ManyToManyQueryHeap &query_heap,
SearchSpaceWithBuckets &search_space_with_buckets,
@ -291,9 +287,8 @@ void backwardRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<Al
}
template <typename Algorithm>
std::vector<EdgeWeight>
manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
std::vector<EdgeWeight> manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
const std::vector<PhantomNode> &phantom_nodes,
const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices)
@ -386,14 +381,14 @@ manyToManySearch(SearchEngineData<Algorithm> &engine_working_data,
template std::vector<EdgeWeight>
manyToManySearch(SearchEngineData<ch::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const DataFacade<ch::Algorithm> &facade,
const std::vector<PhantomNode> &phantom_nodes,
const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices);
template std::vector<EdgeWeight>
manyToManySearch(SearchEngineData<mld::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
const DataFacade<mld::Algorithm> &facade,
const std::vector<PhantomNode> &phantom_nodes,
const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices);

View File

@ -50,7 +50,7 @@ unsigned getMedianSampleTime(const std::vector<unsigned> &timestamps)
template <typename Algorithm>
SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,
@ -422,7 +422,7 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
template SubMatchingList
mapMatching(SearchEngineData<ch::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const DataFacade<ch::Algorithm> &facade,
const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,
@ -431,7 +431,7 @@ mapMatching(SearchEngineData<ch::Algorithm> &engine_working_data,
template SubMatchingList
mapMatching(SearchEngineData<corech::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const DataFacade<corech::Algorithm> &facade,
const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,
@ -440,7 +440,7 @@ mapMatching(SearchEngineData<corech::Algorithm> &engine_working_data,
template SubMatchingList
mapMatching(SearchEngineData<mld::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
const DataFacade<mld::Algorithm> &facade,
const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,

View File

@ -16,7 +16,7 @@ namespace ch
* @param to the node the CH edge finishes at
* @param unpacked_path the sequence of original NodeIDs that make up the expanded CH edge
*/
void unpackEdge(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void unpackEdge(const DataFacade<Algorithm> &facade,
const NodeID from,
const NodeID to,
std::vector<NodeID> &unpacked_path)
@ -72,7 +72,7 @@ void retrievePackedPathFromSingleHeap(const SearchEngineData<Algorithm>::QueryHe
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(SearchEngineData<Algorithm> & /*engine_working_data*/,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
EdgeWeight &weight,
@ -151,7 +151,7 @@ void search(SearchEngineData<Algorithm> & /*engine_working_data*/,
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,
@ -204,7 +204,7 @@ namespace corech
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
EdgeWeight &weight,
@ -384,7 +384,7 @@ void search(SearchEngineData<Algorithm> &engine_working_data,
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,

View File

@ -22,7 +22,7 @@ const static constexpr bool DO_NOT_FORCE_LOOP = false;
// searches source forward/reverse -> target forward/reverse
template <typename Algorithm>
void searchWithUTurn(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const bool search_from_forward_node,
@ -93,7 +93,7 @@ void searchWithUTurn(SearchEngineData<Algorithm> &engine_working_data,
// source forward/reverse -> target reverse
template <typename Algorithm>
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const DataFacade<Algorithm> &facade,
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const bool search_from_forward_node,
@ -178,7 +178,7 @@ void search(SearchEngineData<Algorithm> &engine_working_data,
}
template <typename Algorithm>
void unpackLegs(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
void unpackLegs(const DataFacade<Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector,
const std::vector<NodeID> &total_packed_path,
const std::vector<std::size_t> &packed_leg_begin,
@ -210,9 +210,8 @@ void unpackLegs(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm>
}
template <typename Algorithm>
InternalRouteResult
shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
InternalRouteResult shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const DataFacade<Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint)
{
@ -459,19 +458,19 @@ shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
template InternalRouteResult
shortestPathSearch(SearchEngineData<ch::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const DataFacade<ch::Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint);
template InternalRouteResult
shortestPathSearch(SearchEngineData<corech::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const DataFacade<corech::Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint);
template InternalRouteResult
shortestPathSearch(SearchEngineData<mld::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
const DataFacade<mld::Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint);

View File

@ -227,19 +227,15 @@ std::vector<TurnData> generateTurns(const datafacade &facade,
} // namespace
// CH Version of finding all turn penalties. Here is where the actual work is happening
std::vector<TurnData>
getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
std::vector<TurnData> getTileTurns(const DataFacade<ch::Algorithm> &facade,
const std::vector<RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes)
{
// Define how to find the representative edge between two edge based nodes for a CH
struct EdgeFinderCH
{
EdgeFinderCH(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade)
: facade(facade)
{
}
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade;
EdgeFinderCH(const DataFacade<ch::Algorithm> &facade) : facade(facade) {}
const DataFacade<ch::Algorithm> &facade;
EdgeID operator()(const NodeID approach_node, const NodeID exit_node) const
{
@ -283,19 +279,15 @@ getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm>
}
// MLD version to find all turns
std::vector<TurnData>
getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
std::vector<TurnData> getTileTurns(const DataFacade<mld::Algorithm> &facade,
const std::vector<RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes)
{
// Define how to find the representative edge between two edge-based-nodes for a MLD
struct EdgeFinderMLD
{
EdgeFinderMLD(const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade)
: facade(facade)
{
}
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade;
EdgeFinderMLD(const DataFacade<mld::Algorithm> &facade) : facade(facade) {}
const DataFacade<mld::Algorithm> &facade;
EdgeID operator()(const NodeID approach_node, const NodeID exit_node) const
{