2016-11-14 21:34:39 -05:00
|
|
|
#ifndef CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|
|
|
|
#define CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2017-01-09 15:40:33 -05:00
|
|
|
#include "engine/datafacade/algorithm_datafacade.hpp"
|
2017-01-18 07:44:17 -05:00
|
|
|
#include "engine/datafacade/contiguous_block_allocator.hpp"
|
2016-05-27 15:05:04 -04:00
|
|
|
#include "engine/datafacade/datafacade_base.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
|
2017-03-04 13:54:06 -05:00
|
|
|
#include "engine/algorithm.hpp"
|
2017-05-22 10:07:12 -04:00
|
|
|
#include "engine/approach.hpp"
|
2017-05-29 08:46:11 -04:00
|
|
|
#include "engine/geospatial_query.hpp"
|
2017-03-04 13:54:06 -05:00
|
|
|
|
2016-12-06 10:14:25 -05:00
|
|
|
#include "storage/shared_datatype.hpp"
|
2017-04-04 03:52:00 -04:00
|
|
|
#include "storage/shared_memory_ownership.hpp"
|
2018-04-03 11:16:53 -04:00
|
|
|
#include "storage/view_factory.hpp"
|
2016-03-01 16:30:31 -05:00
|
|
|
|
2016-12-06 15:30:46 -05:00
|
|
|
#include "util/exception.hpp"
|
|
|
|
#include "util/exception_utils.hpp"
|
|
|
|
#include "util/log.hpp"
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-10-07 19:52:47 -04:00
|
|
|
#include <boost/assert.hpp>
|
2015-12-09 16:34:22 -05:00
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
#include <algorithm>
|
2016-10-19 20:11:36 -04:00
|
|
|
#include <cstddef>
|
2016-04-12 09:00:08 -04:00
|
|
|
#include <iterator>
|
2015-02-26 04:11:33 -05:00
|
|
|
#include <limits>
|
2015-01-27 06:35:29 -05:00
|
|
|
#include <memory>
|
2016-02-05 08:58:06 -05:00
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
2022-12-11 04:10:26 -05:00
|
|
|
namespace osrm::engine::datafacade
|
2016-01-05 10:51:13 -05:00
|
|
|
{
|
|
|
|
|
2017-01-09 15:40:33 -05:00
|
|
|
template <typename AlgorithmT> class ContiguousInternalMemoryAlgorithmDataFacade;
|
|
|
|
|
|
|
|
template <>
|
2017-03-31 06:52:04 -04:00
|
|
|
class ContiguousInternalMemoryAlgorithmDataFacade<CH> : public datafacade::AlgorithmDataFacade<CH>
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
|
|
|
private:
|
2017-08-20 19:24:05 -04:00
|
|
|
using QueryGraph = util::FilteredGraphView<contractor::QueryGraphView>;
|
2017-01-09 15:40:33 -05:00
|
|
|
using GraphNode = QueryGraph::NodeArrayEntry;
|
|
|
|
using GraphEdge = QueryGraph::EdgeArrayEntry;
|
|
|
|
|
2017-04-02 19:02:57 -04:00
|
|
|
QueryGraph m_query_graph;
|
2017-01-09 15:40:33 -05:00
|
|
|
|
|
|
|
// allocator that keeps the allocation data
|
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ContiguousInternalMemoryAlgorithmDataFacade(
|
2018-03-28 19:18:28 -04:00
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator_,
|
|
|
|
const std::string &metric_name,
|
|
|
|
std::size_t exclude_index)
|
2017-01-09 15:40:33 -05:00
|
|
|
: allocator(std::move(allocator_))
|
|
|
|
{
|
2018-04-04 19:05:34 -04:00
|
|
|
InitializeInternalPointers(allocator->GetIndex(), metric_name, exclude_index);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
void InitializeInternalPointers(const storage::SharedDataIndex &index,
|
2018-03-28 19:18:28 -04:00
|
|
|
const std::string &metric_name,
|
2017-08-20 19:24:05 -04:00
|
|
|
const std::size_t exclude_index)
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
2018-04-04 19:05:34 -04:00
|
|
|
m_query_graph =
|
|
|
|
make_filtered_graph_view(index, "/ch/metrics/" + metric_name, exclude_index);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// search graph access
|
2017-04-02 19:02:57 -04:00
|
|
|
unsigned GetNumberOfNodes() const override final { return m_query_graph.GetNumberOfNodes(); }
|
2017-01-09 15:40:33 -05:00
|
|
|
|
2017-04-02 19:02:57 -04:00
|
|
|
unsigned GetNumberOfEdges() const override final { return m_query_graph.GetNumberOfEdges(); }
|
2017-01-09 15:40:33 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
unsigned GetOutDegree(const NodeID edge_based_node_id) const override final
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_query_graph.GetOutDegree(edge_based_node_id);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
NodeID GetTarget(const EdgeID edge_based_edge_id) const override final
|
|
|
|
{
|
|
|
|
return m_query_graph.GetTarget(edge_based_edge_id);
|
|
|
|
}
|
2017-01-09 15:40:33 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const override final
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_query_graph.GetEdgeData(edge_based_edge_id);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const override final
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_query_graph.GetAdjacentEdgeRange(edge_based_node_id);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// searches for a specific edge
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeID FindEdge(const NodeID edge_based_node_from,
|
|
|
|
const NodeID edge_based_node_to) const override final
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_query_graph.FindEdge(edge_based_node_from, edge_based_node_to);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeID FindEdgeInEitherDirection(const NodeID edge_based_node_from,
|
|
|
|
const NodeID edge_based_node_to) const override final
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_query_graph.FindEdgeInEitherDirection(edge_based_node_from, edge_based_node_to);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeID FindEdgeIndicateIfReverse(const NodeID edge_based_node_from,
|
|
|
|
const NodeID edge_based_node_to,
|
|
|
|
bool &result) const override final
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_query_graph.FindEdgeIndicateIfReverse(
|
|
|
|
edge_based_node_from, edge_based_node_to, result);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeID FindSmallestEdge(const NodeID edge_based_node_from,
|
|
|
|
const NodeID edge_based_node_to,
|
2017-01-09 15:40:33 -05:00
|
|
|
std::function<bool(EdgeData)> filter) const override final
|
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_query_graph.FindSmallestEdge(edge_based_node_from, edge_based_node_to, filter);
|
2017-01-09 15:40:33 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-11-10 19:56:56 -05:00
|
|
|
/**
|
|
|
|
* This base class implements the Datafacade interface for accessing
|
2016-11-14 21:34:39 -05:00
|
|
|
* data that's stored in a single large block of memory (RAM).
|
|
|
|
*
|
|
|
|
* In this case "internal memory" refers to RAM - as opposed to "external memory",
|
|
|
|
* which usually refers to disk.
|
2016-11-10 19:56:56 -05:00
|
|
|
*/
|
2017-01-09 15:40:33 -05:00
|
|
|
class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-11-10 19:56:56 -05:00
|
|
|
private:
|
2016-01-28 10:28:44 -05:00
|
|
|
using super = BaseDataFacade;
|
2016-05-03 05:48:33 -04:00
|
|
|
using RTreeLeaf = super::RTreeLeaf;
|
2017-04-02 19:58:06 -04:00
|
|
|
using SharedRTree = util::StaticRTree<RTreeLeaf, storage::Ownership::View>;
|
2016-01-28 10:28:44 -05:00
|
|
|
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2017-08-16 16:21:19 -04:00
|
|
|
extractor::ClassData exclude_mask;
|
2016-05-06 19:53:11 -04:00
|
|
|
extractor::ProfileProperties *m_profile_properties;
|
2017-03-09 12:01:04 -05:00
|
|
|
extractor::Datasources *m_datasources;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2018-03-28 19:18:09 -04:00
|
|
|
std::uint32_t m_check_sum;
|
2022-10-30 14:52:57 -04:00
|
|
|
std::string_view m_data_timestamp;
|
2017-04-02 15:24:11 -04:00
|
|
|
util::vector_view<util::Coordinate> m_coordinate_list;
|
2017-04-10 16:15:25 -04:00
|
|
|
extractor::PackedOSMIDsView m_osmnodeid_list;
|
2017-04-02 15:24:11 -04:00
|
|
|
util::vector_view<std::uint32_t> m_lane_description_offsets;
|
2018-01-05 08:33:53 -05:00
|
|
|
util::vector_view<extractor::TurnLaneType::Mask> m_lane_description_masks;
|
2017-04-02 15:24:11 -04:00
|
|
|
util::vector_view<TurnPenalty> m_turn_weight_penalties;
|
|
|
|
util::vector_view<TurnPenalty> m_turn_duration_penalties;
|
2017-03-08 19:41:18 -05:00
|
|
|
extractor::SegmentDataView segment_data;
|
2017-04-25 05:36:34 -04:00
|
|
|
extractor::EdgeBasedNodeDataView edge_based_node_data;
|
2018-01-05 08:33:53 -05:00
|
|
|
guidance::TurnDataView turn_data;
|
2016-03-15 02:03:19 -04:00
|
|
|
|
2017-04-02 15:24:11 -04:00
|
|
|
util::vector_view<char> m_datasource_name_data;
|
|
|
|
util::vector_view<std::size_t> m_datasource_name_offsets;
|
|
|
|
util::vector_view<std::size_t> m_datasource_name_lengths;
|
|
|
|
util::vector_view<util::guidance::LaneTupleIdPair> m_lane_tupel_id_pairs;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2018-02-09 13:32:09 -05:00
|
|
|
util::vector_view<extractor::StorageManeuverOverride> m_maneuver_overrides;
|
|
|
|
util::vector_view<NodeID> m_maneuver_override_node_sequences;
|
|
|
|
|
2018-04-03 11:16:53 -04:00
|
|
|
SharedRTree m_static_rtree;
|
2016-05-06 19:53:11 -04:00
|
|
|
std::unique_ptr<SharedGeospatialQuery> m_geospatial_query;
|
2015-01-27 06:35:29 -05:00
|
|
|
boost::filesystem::path file_index_path;
|
|
|
|
|
2017-06-19 09:27:46 -04:00
|
|
|
extractor::IntersectionBearingsView intersection_bearings_view;
|
2016-08-17 03:49:19 -04:00
|
|
|
|
2018-03-21 07:10:02 -04:00
|
|
|
extractor::NameTableView m_name_table;
|
2016-04-26 07:27:40 -04:00
|
|
|
// the look-up table for entry classes. An entry class lists the possibility of entry for all
|
|
|
|
// available turns. Such a class id is stored with every edge.
|
2017-04-02 15:24:11 -04:00
|
|
|
util::vector_view<util::guidance::EntryClass> m_entry_class_table;
|
2016-04-26 07:27:40 -04:00
|
|
|
|
2017-01-18 07:44:17 -05:00
|
|
|
// allocator that keeps the allocation data
|
2017-01-09 15:40:33 -05:00
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
void InitializeInternalPointers(const storage::SharedDataIndex &index,
|
2018-04-03 11:16:53 -04:00
|
|
|
const std::string &metric_name,
|
|
|
|
const std::size_t exclude_index)
|
2016-03-21 18:34:59 -04:00
|
|
|
{
|
2018-03-27 05:44:13 -04:00
|
|
|
// TODO: For multi-metric support we need to have separate exclude classes per metric
|
2018-03-28 19:18:28 -04:00
|
|
|
(void)metric_name;
|
2018-04-03 11:16:53 -04:00
|
|
|
|
|
|
|
m_profile_properties =
|
2018-04-04 19:05:34 -04:00
|
|
|
index.GetBlockPtr<extractor::ProfileProperties>("/common/properties");
|
2017-07-21 17:55:19 -04:00
|
|
|
|
2017-08-16 16:21:19 -04:00
|
|
|
exclude_mask = m_profile_properties->excludable_classes[exclude_index];
|
2016-03-21 18:34:59 -04:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
m_check_sum = *index.GetBlockPtr<std::uint32_t>("/common/connectivity_checksum");
|
2017-01-09 15:40:33 -05:00
|
|
|
|
2019-01-15 05:18:20 -05:00
|
|
|
m_data_timestamp = make_timestamp_view(index, "/common/timestamp");
|
|
|
|
|
2018-04-03 11:16:53 -04:00
|
|
|
std::tie(m_coordinate_list, m_osmnodeid_list) =
|
2018-04-04 19:05:34 -04:00
|
|
|
make_nbn_data_view(index, "/common/nbn_data");
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
m_static_rtree = make_search_tree_view(index, "/common/rtree");
|
2016-01-05 06:04:04 -05:00
|
|
|
m_geospatial_query.reset(
|
2018-04-03 11:16:53 -04:00
|
|
|
new SharedGeospatialQuery(m_static_rtree, m_coordinate_list, *this));
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
edge_based_node_data = make_ebn_data_view(index, "/common/ebg_node_data");
|
2017-04-21 05:23:49 -04:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
turn_data = make_turn_data_view(index, "/common/turn_data");
|
2016-05-18 16:09:14 -04:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
m_name_table = make_name_table_view(index, "/common/names");
|
2017-09-25 09:37:11 -04:00
|
|
|
|
2018-04-03 11:16:53 -04:00
|
|
|
std::tie(m_lane_description_offsets, m_lane_description_masks) =
|
2018-04-04 19:05:34 -04:00
|
|
|
make_turn_lane_description_views(index, "/common/turn_lanes");
|
|
|
|
m_lane_tupel_id_pairs = make_lane_data_view(index, "/common/turn_lanes");
|
2017-09-25 09:37:11 -04:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
m_turn_weight_penalties = make_turn_weight_view(index, "/common/turn_penalty");
|
|
|
|
m_turn_duration_penalties = make_turn_duration_view(index, "/common/turn_penalty");
|
2017-04-25 05:36:34 -04:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
segment_data = make_segment_data_view(index, "/common/segment_data");
|
2016-06-15 08:38:24 -04:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
m_datasources = index.GetBlockPtr<extractor::Datasources>("/common/data_sources_names");
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2018-04-03 11:16:53 -04:00
|
|
|
intersection_bearings_view =
|
2018-04-04 19:05:34 -04:00
|
|
|
make_intersection_bearings_view(index, "/common/intersection_bearings");
|
2018-02-09 13:32:09 -05:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
m_entry_class_table = make_entry_classes_view(index, "/common/entry_classes");
|
2018-04-03 11:16:53 -04:00
|
|
|
|
|
|
|
std::tie(m_maneuver_overrides, m_maneuver_override_node_sequences) =
|
2018-04-04 19:05:34 -04:00
|
|
|
make_maneuver_overrides_views(index, "/common/maneuver_overrides");
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2017-01-18 07:44:17 -05:00
|
|
|
public:
|
|
|
|
// allows switching between process_memory/shared_memory datafacade, based on the type of
|
|
|
|
// allocator
|
2017-08-14 17:24:33 -04:00
|
|
|
ContiguousInternalMemoryDataFacadeBase(std::shared_ptr<ContiguousBlockAllocator> allocator_,
|
2018-03-28 19:18:28 -04:00
|
|
|
const std::string &metric_name,
|
2017-08-16 16:21:19 -04:00
|
|
|
const std::size_t exclude_index)
|
2017-01-18 07:44:17 -05:00
|
|
|
: allocator(std::move(allocator_))
|
|
|
|
{
|
2018-04-04 19:05:34 -04:00
|
|
|
InitializeInternalPointers(allocator->GetIndex(), metric_name, exclude_index);
|
2017-01-18 07:44:17 -05:00
|
|
|
}
|
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
// node and edge information access
|
2021-06-01 15:48:12 -04:00
|
|
|
util::Coordinate GetCoordinateOfNode(const NodeID node_based_node_id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_coordinate_list[node_based_node_id];
|
2016-03-14 11:25:39 -04:00
|
|
|
}
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
OSMNodeID GetOSMNodeIDOfNode(const NodeID node_based_node_id) const override final
|
2016-05-18 16:09:14 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return m_osmnodeid_list[node_based_node_id];
|
2016-05-18 16:09:14 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
NodeForwardRange GetUncompressedForwardGeometry(const PackedGeometryID id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2018-03-19 14:41:02 -04:00
|
|
|
return segment_data.GetForwardGeometry(id);
|
2016-01-29 20:52:20 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
NodeReverseRange GetUncompressedReverseGeometry(const PackedGeometryID id) const override final
|
2016-01-29 20:52:20 -05:00
|
|
|
{
|
2018-03-19 14:41:02 -04:00
|
|
|
return segment_data.GetReverseGeometry(id);
|
2016-07-22 12:23:54 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
DurationForwardRange
|
|
|
|
GetUncompressedForwardDurations(const PackedGeometryID id) const override final
|
2016-05-12 12:50:10 -04:00
|
|
|
{
|
2018-03-19 14:41:02 -04:00
|
|
|
return segment_data.GetForwardDurations(id);
|
2016-05-12 12:50:10 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
DurationReverseRange
|
|
|
|
GetUncompressedReverseDurations(const PackedGeometryID id) const override final
|
2016-05-12 12:50:10 -04:00
|
|
|
{
|
2018-03-19 14:41:02 -04:00
|
|
|
return segment_data.GetReverseDurations(id);
|
2016-05-12 12:50:10 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
WeightForwardRange GetUncompressedForwardWeights(const PackedGeometryID id) const override final
|
2016-07-22 12:23:54 -04:00
|
|
|
{
|
2018-03-19 14:41:02 -04:00
|
|
|
return segment_data.GetForwardWeights(id);
|
2016-07-22 12:23:54 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
WeightReverseRange GetUncompressedReverseWeights(const PackedGeometryID id) const override final
|
2016-07-22 12:23:54 -04:00
|
|
|
{
|
2018-03-19 14:41:02 -04:00
|
|
|
return segment_data.GetReverseWeights(id);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2017-03-09 12:01:04 -05:00
|
|
|
// Returns the data source ids that were used to supply the edge
|
|
|
|
// weights.
|
2021-06-01 15:48:12 -04:00
|
|
|
DatasourceForwardRange
|
|
|
|
GetUncompressedForwardDatasources(const PackedGeometryID id) const override final
|
2017-03-09 12:01:04 -05:00
|
|
|
{
|
2018-03-19 14:41:02 -04:00
|
|
|
return segment_data.GetForwardDatasources(id);
|
2017-03-09 12:01:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the data source ids that were used to supply the edge
|
|
|
|
// weights.
|
2021-06-01 15:48:12 -04:00
|
|
|
DatasourceReverseRange
|
|
|
|
GetUncompressedReverseDatasources(const PackedGeometryID id) const override final
|
2017-03-09 12:01:04 -05:00
|
|
|
{
|
2018-03-19 14:41:02 -04:00
|
|
|
return segment_data.GetReverseDatasources(id);
|
2017-03-09 12:01:04 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
TurnPenalty GetWeightPenaltyForEdgeID(const EdgeID edge_based_edge_id) const override final
|
2016-05-12 12:50:10 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
BOOST_ASSERT(m_turn_weight_penalties.size() > edge_based_edge_id);
|
|
|
|
return m_turn_weight_penalties[edge_based_edge_id];
|
2016-05-12 12:50:10 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
TurnPenalty GetDurationPenaltyForEdgeID(const EdgeID edge_based_edge_id) const override final
|
2016-05-12 12:50:10 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
BOOST_ASSERT(m_turn_duration_penalties.size() > edge_based_edge_id);
|
|
|
|
return m_turn_duration_penalties[edge_based_edge_id];
|
2016-05-12 12:50:10 -04:00
|
|
|
}
|
|
|
|
|
2018-01-05 08:33:53 -05:00
|
|
|
osrm::guidance::TurnInstruction
|
2021-06-01 15:48:12 -04:00
|
|
|
GetTurnInstructionForEdgeID(const EdgeID edge_based_edge_id) const override final
|
2015-02-05 08:58:07 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return turn_data.GetTurnInstruction(edge_based_edge_id);
|
2015-02-05 08:58:07 -05:00
|
|
|
}
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-02-23 15:23:13 -05:00
|
|
|
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate south_west,
|
2016-05-06 20:56:08 -04:00
|
|
|
const util::Coordinate north_east) const override final
|
2016-02-16 13:51:04 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2016-05-27 15:05:04 -04:00
|
|
|
const util::RectangleInt2D bbox{
|
|
|
|
south_west.lon, north_east.lon, south_west.lat, north_east.lat};
|
2016-02-16 13:51:04 -05:00
|
|
|
return m_geospatial_query->Search(bbox);
|
|
|
|
}
|
|
|
|
|
2016-02-20 22:27:26 -05:00
|
|
|
std::vector<PhantomNodeWithDistance>
|
2016-02-23 15:23:13 -05:00
|
|
|
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
2022-08-27 06:36:20 -04:00
|
|
|
const double max_distance,
|
|
|
|
const boost::optional<Bearing> bearing,
|
2018-12-13 19:10:32 -05:00
|
|
|
const Approach approach,
|
|
|
|
const bool use_all_edges) const override final
|
2016-02-20 22:27:26 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2016-02-20 22:27:26 -05:00
|
|
|
|
2017-05-29 08:46:11 -04:00
|
|
|
return m_geospatial_query->NearestPhantomNodes(
|
2022-08-27 06:36:20 -04:00
|
|
|
input_coordinate, approach, boost::none, max_distance, bearing, use_all_edges);
|
2016-02-22 18:44:35 -05:00
|
|
|
}
|
|
|
|
|
2015-12-09 16:34:22 -05:00
|
|
|
std::vector<PhantomNodeWithDistance>
|
2016-02-23 15:23:13 -05:00
|
|
|
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
2022-08-27 06:36:20 -04:00
|
|
|
const size_t max_results,
|
|
|
|
const boost::optional<double> max_distance,
|
|
|
|
const boost::optional<Bearing> bearing,
|
2017-05-29 10:13:15 -04:00
|
|
|
const Approach approach) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-05-27 15:05:04 -04:00
|
|
|
return m_geospatial_query->NearestPhantomNodes(
|
2022-08-27 06:36:20 -04:00
|
|
|
input_coordinate, approach, max_results, max_distance, bearing, boost::none);
|
2016-01-28 10:28:44 -05:00
|
|
|
}
|
|
|
|
|
2022-08-27 06:36:20 -04:00
|
|
|
PhantomCandidateAlternatives
|
|
|
|
NearestCandidatesWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
|
|
const boost::optional<double> max_distance,
|
|
|
|
const boost::optional<Bearing> bearing,
|
|
|
|
const Approach approach,
|
|
|
|
const bool use_all_edges) const override final
|
2014-09-23 12:46:14 -04:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2014-09-23 12:46:14 -04:00
|
|
|
|
2022-08-27 06:36:20 -04:00
|
|
|
return m_geospatial_query->NearestCandidatesWithAlternativeFromBigComponent(
|
|
|
|
input_coordinate, approach, max_distance, bearing, use_all_edges);
|
2014-09-23 12:46:14 -04:00
|
|
|
}
|
|
|
|
|
2018-03-28 19:18:09 -04:00
|
|
|
std::uint32_t GetCheckSum() const override final { return m_check_sum; }
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2019-01-15 05:18:20 -05:00
|
|
|
std::string GetTimestamp() const override final
|
|
|
|
{
|
|
|
|
return std::string(m_data_timestamp.begin(), m_data_timestamp.end());
|
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
GeometryID GetGeometryIndex(const NodeID edge_based_node_id) const override final
|
2017-04-25 05:36:34 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return edge_based_node_data.GetGeometryID(edge_based_node_id);
|
2017-04-25 05:36:34 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
ComponentID GetComponentID(const NodeID edge_based_node_id) const override final
|
2017-05-15 06:15:00 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return edge_based_node_data.GetComponentID(edge_based_node_id);
|
2017-05-15 06:15:00 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
extractor::TravelMode GetTravelMode(const NodeID edge_based_node_id) const override final
|
2017-04-25 05:36:34 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return edge_based_node_data.GetTravelMode(edge_based_node_id);
|
2017-04-25 05:36:34 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
extractor::ClassData GetClassData(const NodeID edge_based_node_id) const override final
|
2017-06-27 18:01:05 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return edge_based_node_data.GetClassData(edge_based_node_id);
|
2017-06-27 18:01:05 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
bool ExcludeNode(const NodeID edge_based_node_id) const override final
|
2017-07-21 17:55:19 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return (edge_based_node_data.GetClassData(edge_based_node_id) & exclude_mask) > 0;
|
2017-07-21 17:55:19 -04:00
|
|
|
}
|
|
|
|
|
2017-06-27 18:01:05 -04:00
|
|
|
std::vector<std::string> GetClasses(const extractor::ClassData class_data) const override final
|
|
|
|
{
|
|
|
|
auto indexes = extractor::getClassIndexes(class_data);
|
|
|
|
std::vector<std::string> classes(indexes.size());
|
|
|
|
std::transform(indexes.begin(), indexes.end(), classes.begin(), [this](const auto index) {
|
|
|
|
return m_profile_properties->GetClassName(index);
|
|
|
|
});
|
|
|
|
|
|
|
|
return classes;
|
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
NameID GetNameIndex(const NodeID edge_based_node_id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return edge_based_node_data.GetNameID(edge_based_node_id);
|
2016-03-14 11:25:39 -04:00
|
|
|
}
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
std::string_view GetNameForID(const NameID id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2017-01-19 09:14:30 -05:00
|
|
|
return m_name_table.GetNameForID(id);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
std::string_view GetRefForID(const NameID id) const override final
|
2016-09-05 09:01:51 -04:00
|
|
|
{
|
2017-01-19 09:14:30 -05:00
|
|
|
return m_name_table.GetRefForID(id);
|
2016-09-05 09:01:51 -04:00
|
|
|
}
|
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
std::string_view GetPronunciationForID(const NameID id) const override final
|
2016-05-25 21:35:38 -04:00
|
|
|
{
|
2017-01-19 09:14:30 -05:00
|
|
|
return m_name_table.GetPronunciationForID(id);
|
2016-05-26 18:47:46 -04:00
|
|
|
}
|
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
std::string_view GetDestinationsForID(const NameID id) const override final
|
2016-05-26 18:47:46 -04:00
|
|
|
{
|
2017-01-19 09:14:30 -05:00
|
|
|
return m_name_table.GetDestinationsForID(id);
|
2016-05-25 21:35:38 -04:00
|
|
|
}
|
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
std::string_view GetExitsForID(const NameID id) const override final
|
2017-06-29 16:12:25 -04:00
|
|
|
{
|
|
|
|
return m_name_table.GetExitsForID(id);
|
|
|
|
}
|
|
|
|
|
2022-10-30 14:52:57 -04:00
|
|
|
std::string_view GetDatasourceName(const DatasourceID id) const override final
|
2016-03-15 02:03:19 -04:00
|
|
|
{
|
2017-03-09 12:01:04 -05:00
|
|
|
return m_datasources->GetSourceName(id);
|
2016-03-15 02:03:19 -04:00
|
|
|
}
|
|
|
|
|
2016-05-06 19:53:11 -04:00
|
|
|
bool GetContinueStraightDefault() const override final
|
|
|
|
{
|
|
|
|
return m_profile_properties->continue_straight_at_waypoint;
|
|
|
|
}
|
2016-04-26 07:27:40 -04:00
|
|
|
|
2016-11-01 17:13:10 -04:00
|
|
|
double GetMapMatchingMaxSpeed() const override final
|
|
|
|
{
|
|
|
|
return m_profile_properties->max_speed_for_map_matching;
|
|
|
|
}
|
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
const char *GetWeightName() const override final { return m_profile_properties->weight_name; }
|
|
|
|
|
|
|
|
unsigned GetWeightPrecision() const override final
|
|
|
|
{
|
|
|
|
return m_profile_properties->weight_precision;
|
|
|
|
}
|
|
|
|
|
2017-01-17 03:24:52 -05:00
|
|
|
double GetWeightMultiplier() const override final
|
|
|
|
{
|
|
|
|
return m_profile_properties->GetWeightMultiplier();
|
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
util::guidance::BearingClass
|
|
|
|
GetBearingClass(const NodeID node_based_node_id) const override final
|
2016-04-26 07:27:40 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return intersection_bearings_view.GetBearingClass(node_based_node_id);
|
2016-04-26 07:27:40 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
guidance::TurnBearing PreTurnBearing(const EdgeID edge_based_edge_id) const override final
|
2016-08-17 03:49:19 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return turn_data.GetPreTurnBearing(edge_based_edge_id);
|
2016-08-17 03:49:19 -04:00
|
|
|
}
|
2021-06-01 15:48:12 -04:00
|
|
|
guidance::TurnBearing PostTurnBearing(const EdgeID edge_based_edge_id) const override final
|
2016-08-17 03:49:19 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return turn_data.GetPostTurnBearing(edge_based_edge_id);
|
2016-08-17 03:49:19 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
util::guidance::EntryClass GetEntryClass(const EdgeID edge_based_edge_id) const override final
|
2016-04-26 07:27:40 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
auto entry_class_id = turn_data.GetEntryClassID(edge_based_edge_id);
|
2016-04-26 07:27:40 -04:00
|
|
|
return m_entry_class_table.at(entry_class_id);
|
|
|
|
}
|
2016-06-15 08:38:24 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
bool HasLaneData(const EdgeID edge_based_edge_id) const override final
|
|
|
|
{
|
|
|
|
return turn_data.HasLaneData(edge_based_edge_id);
|
|
|
|
}
|
2016-06-15 08:38:24 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
util::guidance::LaneTupleIdPair
|
|
|
|
GetLaneData(const EdgeID edge_based_edge_id) const override final
|
2016-06-15 08:38:24 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
BOOST_ASSERT(HasLaneData(edge_based_edge_id));
|
|
|
|
return m_lane_tupel_id_pairs.at(turn_data.GetLaneDataID(edge_based_edge_id));
|
2016-06-15 08:38:24 -04:00
|
|
|
}
|
|
|
|
|
2018-01-05 08:33:53 -05:00
|
|
|
extractor::TurnLaneDescription
|
2016-06-21 04:41:08 -04:00
|
|
|
GetTurnDescription(const LaneDescriptionID lane_description_id) const override final
|
2016-06-15 08:38:24 -04:00
|
|
|
{
|
2016-06-21 04:41:08 -04:00
|
|
|
if (lane_description_id == INVALID_LANE_DESCRIPTIONID)
|
|
|
|
return {};
|
|
|
|
else
|
2018-01-05 08:33:53 -05:00
|
|
|
return extractor::TurnLaneDescription(
|
2016-06-21 04:41:08 -04:00
|
|
|
m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id],
|
2016-07-26 09:00:58 -04:00
|
|
|
m_lane_description_masks.begin() +
|
|
|
|
m_lane_description_offsets[lane_description_id + 1]);
|
2016-06-15 08:38:24 -04:00
|
|
|
}
|
2017-05-22 10:09:53 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
bool IsLeftHandDriving(const NodeID edge_based_node_id) const override final
|
2017-05-22 10:09:53 -04:00
|
|
|
{
|
2017-08-16 06:07:46 -04:00
|
|
|
// TODO: can be moved to a data block indexed by GeometryID
|
2021-06-01 15:48:12 -04:00
|
|
|
return edge_based_node_data.IsLeftHandDriving(edge_based_node_id);
|
2017-05-22 10:09:53 -04:00
|
|
|
}
|
2017-10-14 08:21:31 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
bool IsSegregated(const NodeID edge_based_node_id) const override final
|
2017-10-14 08:21:31 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return edge_based_node_data.IsSegregated(edge_based_node_id);
|
2017-10-14 08:21:31 -04:00
|
|
|
}
|
2018-02-09 13:32:09 -05:00
|
|
|
|
|
|
|
std::vector<extractor::ManeuverOverride>
|
|
|
|
GetOverridesThatStartAt(const NodeID edge_based_node_id) const override final
|
|
|
|
{
|
|
|
|
std::vector<extractor::ManeuverOverride> results;
|
|
|
|
|
|
|
|
// heterogeneous comparison:
|
|
|
|
struct Comp
|
|
|
|
{
|
|
|
|
bool operator()(const extractor::StorageManeuverOverride &s, NodeID i) const
|
|
|
|
{
|
|
|
|
return s.start_node < i;
|
|
|
|
}
|
|
|
|
bool operator()(NodeID i, const extractor::StorageManeuverOverride &s) const
|
|
|
|
{
|
|
|
|
return i < s.start_node;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
auto found_range = std::equal_range(
|
|
|
|
m_maneuver_overrides.begin(), m_maneuver_overrides.end(), edge_based_node_id, Comp{});
|
|
|
|
|
2020-11-26 10:21:39 -05:00
|
|
|
std::for_each(found_range.first, found_range.second, [&](const auto &override) {
|
2018-02-09 13:32:09 -05:00
|
|
|
std::vector<NodeID> sequence(
|
|
|
|
m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_begin,
|
|
|
|
m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_end);
|
|
|
|
results.push_back(extractor::ManeuverOverride{std::move(sequence),
|
|
|
|
override.instruction_node,
|
|
|
|
override.override_type,
|
|
|
|
override.direction});
|
|
|
|
});
|
|
|
|
return results;
|
|
|
|
}
|
2015-01-27 06:35:29 -05:00
|
|
|
};
|
2017-01-09 15:40:33 -05:00
|
|
|
|
|
|
|
template <typename AlgorithmT> class ContiguousInternalMemoryDataFacade;
|
|
|
|
|
|
|
|
template <>
|
2017-03-31 06:52:04 -04:00
|
|
|
class ContiguousInternalMemoryDataFacade<CH>
|
2017-01-09 15:40:33 -05:00
|
|
|
: public ContiguousInternalMemoryDataFacadeBase,
|
2017-03-31 06:52:04 -04:00
|
|
|
public ContiguousInternalMemoryAlgorithmDataFacade<CH>
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
|
|
|
public:
|
2022-07-04 16:46:59 -04:00
|
|
|
ContiguousInternalMemoryDataFacade(const std::shared_ptr<ContiguousBlockAllocator> &allocator,
|
2018-03-28 19:18:28 -04:00
|
|
|
const std::string &metric_name,
|
2017-08-16 16:21:19 -04:00
|
|
|
const std::size_t exclude_index)
|
2018-03-27 05:44:13 -04:00
|
|
|
: ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index),
|
|
|
|
ContiguousInternalMemoryAlgorithmDataFacade<CH>(allocator, metric_name, exclude_index)
|
2017-01-09 15:40:33 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2017-02-25 00:13:38 -05:00
|
|
|
|
2017-03-31 06:52:04 -04:00
|
|
|
template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public AlgorithmDataFacade<MLD>
|
2017-03-01 17:55:18 -05:00
|
|
|
{
|
|
|
|
// MLD data
|
2018-02-01 10:47:43 -05:00
|
|
|
partitioner::MultiLevelPartitionView mld_partition;
|
|
|
|
partitioner::CellStorageView mld_cell_storage;
|
2017-07-24 20:05:15 -04:00
|
|
|
customizer::CellMetricView mld_cell_metric;
|
2017-03-06 22:59:28 -05:00
|
|
|
using QueryGraph = customizer::MultiLevelEdgeBasedGraphView;
|
|
|
|
using GraphNode = QueryGraph::NodeArrayEntry;
|
|
|
|
using GraphEdge = QueryGraph::EdgeArrayEntry;
|
|
|
|
|
|
|
|
QueryGraph query_graph;
|
2017-03-01 17:55:18 -05:00
|
|
|
|
2018-04-04 19:05:34 -04:00
|
|
|
void InitializeInternalPointers(const storage::SharedDataIndex &index,
|
2018-03-28 19:18:28 -04:00
|
|
|
const std::string &metric_name,
|
2017-08-16 16:21:19 -04:00
|
|
|
const std::size_t exclude_index)
|
2017-03-01 17:55:18 -05:00
|
|
|
{
|
2018-04-04 19:05:34 -04:00
|
|
|
mld_partition = make_partition_view(index, "/mld/multilevelpartition");
|
|
|
|
mld_cell_metric =
|
|
|
|
make_filtered_cell_metric_view(index, "/mld/metrics/" + metric_name, exclude_index);
|
|
|
|
mld_cell_storage = make_cell_storage_view(index, "/mld/cellstorage");
|
|
|
|
query_graph = make_multi_level_graph_view(index, "/mld/multilevelgraph");
|
2017-03-06 17:00:11 -05:00
|
|
|
}
|
|
|
|
|
2017-03-06 22:59:28 -05:00
|
|
|
// allocator that keeps the allocation data
|
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
2017-03-01 17:55:18 -05:00
|
|
|
|
2017-03-06 22:59:28 -05:00
|
|
|
public:
|
|
|
|
ContiguousInternalMemoryAlgorithmDataFacade(
|
2018-03-28 19:18:28 -04:00
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator_,
|
|
|
|
const std::string &metric_name,
|
|
|
|
const std::size_t exclude_index)
|
2017-03-06 22:59:28 -05:00
|
|
|
: allocator(std::move(allocator_))
|
2017-03-01 17:55:18 -05:00
|
|
|
{
|
2018-04-04 19:05:34 -04:00
|
|
|
InitializeInternalPointers(allocator->GetIndex(), metric_name, exclude_index);
|
2017-03-06 17:00:11 -05:00
|
|
|
}
|
|
|
|
|
2018-02-01 10:47:43 -05:00
|
|
|
const partitioner::MultiLevelPartitionView &GetMultiLevelPartition() const override
|
2017-03-06 17:00:11 -05:00
|
|
|
{
|
2017-03-06 22:59:28 -05:00
|
|
|
return mld_partition;
|
2017-03-06 17:00:11 -05:00
|
|
|
}
|
|
|
|
|
2018-02-01 10:47:43 -05:00
|
|
|
const partitioner::CellStorageView &GetCellStorage() const override { return mld_cell_storage; }
|
2017-03-06 22:59:28 -05:00
|
|
|
|
2017-07-24 20:05:15 -04:00
|
|
|
const customizer::CellMetricView &GetCellMetric() const override { return mld_cell_metric; }
|
|
|
|
|
2017-03-06 17:00:11 -05:00
|
|
|
// search graph access
|
2017-03-06 22:59:28 -05:00
|
|
|
unsigned GetNumberOfNodes() const override final { return query_graph.GetNumberOfNodes(); }
|
2017-03-06 17:00:11 -05:00
|
|
|
|
2018-04-08 12:37:08 -04:00
|
|
|
unsigned GetMaxBorderNodeID() const override final { return query_graph.GetMaxBorderNodeID(); }
|
|
|
|
|
2017-03-06 22:59:28 -05:00
|
|
|
unsigned GetNumberOfEdges() const override final { return query_graph.GetNumberOfEdges(); }
|
2017-03-06 17:00:11 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
unsigned GetOutDegree(const NodeID edge_based_node_id) const override final
|
2017-03-06 17:00:11 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.GetOutDegree(edge_based_node_id);
|
2017-03-06 17:00:11 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeRange GetAdjacentEdgeRange(const NodeID edge_based_node_id) const override final
|
2018-04-22 02:34:31 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.GetAdjacentEdgeRange(edge_based_node_id);
|
2018-04-22 02:34:31 -04:00
|
|
|
}
|
2017-03-06 17:00:11 -05:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeWeight GetNodeWeight(const NodeID edge_based_node_id) const override final
|
2017-03-06 17:00:11 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.GetNodeWeight(edge_based_node_id);
|
2017-03-06 17:00:11 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeDuration GetNodeDuration(const NodeID edge_based_node_id) const override final
|
2017-03-06 17:00:11 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.GetNodeDuration(edge_based_node_id);
|
2018-04-22 02:34:31 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeDistance GetNodeDistance(const NodeID edge_based_node_id) const override final
|
2018-10-30 00:47:49 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.GetNodeDistance(edge_based_node_id);
|
2018-10-30 00:47:49 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
bool IsForwardEdge(const NodeID edge_based_node_id) const override final
|
2018-04-23 00:01:09 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.IsForwardEdge(edge_based_node_id);
|
2018-04-23 00:01:09 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
bool IsBackwardEdge(const NodeID edge_based_node_id) const override final
|
2018-04-23 00:01:09 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.IsBackwardEdge(edge_based_node_id);
|
2018-04-23 00:01:09 -04:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
NodeID GetTarget(const EdgeID edge_based_edge_id) const override final
|
|
|
|
{
|
|
|
|
return query_graph.GetTarget(edge_based_edge_id);
|
|
|
|
}
|
2018-04-22 02:34:31 -04:00
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
const EdgeData &GetEdgeData(const EdgeID edge_based_edge_id) const override final
|
2018-04-22 02:34:31 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.GetEdgeData(edge_based_edge_id);
|
2017-03-06 22:59:28 -05:00
|
|
|
}
|
|
|
|
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeRange GetBorderEdgeRange(const LevelID level,
|
|
|
|
const NodeID edge_based_node_id) const override final
|
2017-03-06 22:59:28 -05:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.GetBorderEdgeRange(level, edge_based_node_id);
|
2017-03-01 17:55:18 -05:00
|
|
|
}
|
2017-03-15 09:36:41 -04:00
|
|
|
|
|
|
|
// searches for a specific edge
|
2021-06-01 15:48:12 -04:00
|
|
|
EdgeID FindEdge(const NodeID edge_based_node_from,
|
|
|
|
const NodeID edge_based_node_to) const override final
|
2017-03-15 09:36:41 -04:00
|
|
|
{
|
2021-06-01 15:48:12 -04:00
|
|
|
return query_graph.FindEdge(edge_based_node_from, edge_based_node_to);
|
2017-03-06 22:59:28 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
2017-03-31 06:52:04 -04:00
|
|
|
class ContiguousInternalMemoryDataFacade<MLD> final
|
2017-03-06 22:59:28 -05:00
|
|
|
: public ContiguousInternalMemoryDataFacadeBase,
|
2017-03-31 06:52:04 -04:00
|
|
|
public ContiguousInternalMemoryAlgorithmDataFacade<MLD>
|
2017-03-06 22:59:28 -05:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
public:
|
2022-07-04 16:46:59 -04:00
|
|
|
ContiguousInternalMemoryDataFacade(const std::shared_ptr<ContiguousBlockAllocator> &allocator,
|
2018-03-28 19:18:28 -04:00
|
|
|
const std::string &metric_name,
|
2017-08-16 16:21:19 -04:00
|
|
|
const std::size_t exclude_index)
|
2018-03-27 05:44:13 -04:00
|
|
|
: ContiguousInternalMemoryDataFacadeBase(allocator, metric_name, exclude_index),
|
|
|
|
ContiguousInternalMemoryAlgorithmDataFacade<MLD>(allocator, metric_name, exclude_index)
|
2017-03-06 22:59:28 -05:00
|
|
|
{
|
2017-03-15 09:36:41 -04:00
|
|
|
}
|
2017-03-01 17:55:18 -05:00
|
|
|
};
|
2022-12-20 12:00:11 -05:00
|
|
|
} // namespace osrm::engine::datafacade
|
2016-01-05 10:51:13 -05:00
|
|
|
|
2016-11-14 21:34:39 -05:00
|
|
|
#endif // CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|