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
|
|
|
|
2016-05-10 02:37:45 -04:00
|
|
|
#include "extractor/compressed_edge_container.hpp"
|
2016-03-01 16:30:31 -05:00
|
|
|
#include "extractor/guidance/turn_instruction.hpp"
|
2016-06-21 04:41:08 -04:00
|
|
|
#include "extractor/guidance/turn_lane_types.hpp"
|
2016-03-21 18:34:59 -04:00
|
|
|
#include "extractor/profile_properties.hpp"
|
2016-12-06 10:14:25 -05:00
|
|
|
#include "storage/shared_datatype.hpp"
|
2016-04-26 07:27:40 -04:00
|
|
|
#include "util/guidance/bearing_class.hpp"
|
|
|
|
#include "util/guidance/entry_class.hpp"
|
2016-06-15 08:38:24 -04:00
|
|
|
#include "util/guidance/turn_lanes.hpp"
|
2016-03-01 16:30:31 -05:00
|
|
|
|
2017-01-09 15:40:33 -05:00
|
|
|
#include "engine/algorithm.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "engine/geospatial_query.hpp"
|
2017-02-23 10:39:29 -05:00
|
|
|
#include "util/cell_storage.hpp"
|
2016-12-06 15:30:46 -05:00
|
|
|
#include "util/exception.hpp"
|
|
|
|
#include "util/exception_utils.hpp"
|
2016-08-17 03:49:19 -04:00
|
|
|
#include "util/guidance/turn_bearing.hpp"
|
2016-12-06 15:30:46 -05:00
|
|
|
#include "util/log.hpp"
|
2017-02-23 10:39:29 -05:00
|
|
|
#include "util/multi_level_partition.hpp"
|
2017-01-19 09:14:30 -05:00
|
|
|
#include "util/name_table.hpp"
|
2016-10-28 17:45:05 -04:00
|
|
|
#include "util/packed_vector.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "util/range_table.hpp"
|
2016-04-26 07:27:40 -04:00
|
|
|
#include "util/rectangle.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "util/static_graph.hpp"
|
|
|
|
#include "util/static_rtree.hpp"
|
2016-05-10 02:37:45 -04:00
|
|
|
#include "util/typedefs.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>
|
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace engine
|
|
|
|
{
|
|
|
|
namespace datafacade
|
|
|
|
{
|
|
|
|
|
2017-01-09 15:40:33 -05:00
|
|
|
template <typename AlgorithmT> class ContiguousInternalMemoryAlgorithmDataFacade;
|
|
|
|
|
|
|
|
template <>
|
|
|
|
class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH>
|
|
|
|
: public datafacade::AlgorithmDataFacade<algorithm::CH>
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
using QueryGraph = util::StaticGraph<EdgeData, true>;
|
|
|
|
using GraphNode = QueryGraph::NodeArrayEntry;
|
|
|
|
using GraphEdge = QueryGraph::EdgeArrayEntry;
|
|
|
|
|
|
|
|
std::unique_ptr<QueryGraph> m_query_graph;
|
|
|
|
|
|
|
|
// allocator that keeps the allocation data
|
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
|
|
|
|
|
|
|
void InitializeGraphPointer(storage::DataLayout &data_layout, char *memory_block)
|
|
|
|
{
|
|
|
|
auto graph_nodes_ptr = data_layout.GetBlockPtr<GraphNode>(
|
|
|
|
memory_block, storage::DataLayout::CH_GRAPH_NODE_LIST);
|
|
|
|
|
|
|
|
auto graph_edges_ptr = data_layout.GetBlockPtr<GraphEdge>(
|
|
|
|
memory_block, storage::DataLayout::CH_GRAPH_EDGE_LIST);
|
|
|
|
|
|
|
|
util::ShM<GraphNode, true>::vector node_list(
|
|
|
|
graph_nodes_ptr, data_layout.num_entries[storage::DataLayout::CH_GRAPH_NODE_LIST]);
|
|
|
|
util::ShM<GraphEdge, true>::vector edge_list(
|
|
|
|
graph_edges_ptr, data_layout.num_entries[storage::DataLayout::CH_GRAPH_EDGE_LIST]);
|
|
|
|
m_query_graph.reset(new QueryGraph(node_list, edge_list));
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
ContiguousInternalMemoryAlgorithmDataFacade(
|
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator_)
|
|
|
|
: allocator(std::move(allocator_))
|
|
|
|
{
|
|
|
|
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory());
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitializeInternalPointers(storage::DataLayout &data_layout, char *memory_block)
|
|
|
|
{
|
|
|
|
InitializeGraphPointer(data_layout, memory_block);
|
|
|
|
}
|
|
|
|
|
|
|
|
// search graph access
|
|
|
|
unsigned GetNumberOfNodes() const override final { return m_query_graph->GetNumberOfNodes(); }
|
|
|
|
|
|
|
|
unsigned GetNumberOfEdges() const override final { return m_query_graph->GetNumberOfEdges(); }
|
|
|
|
|
|
|
|
unsigned GetOutDegree(const NodeID n) const override final
|
|
|
|
{
|
|
|
|
return m_query_graph->GetOutDegree(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
NodeID GetTarget(const EdgeID e) const override final { return m_query_graph->GetTarget(e); }
|
|
|
|
|
|
|
|
EdgeData &GetEdgeData(const EdgeID e) const override final
|
|
|
|
{
|
|
|
|
return m_query_graph->GetEdgeData(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
EdgeID BeginEdges(const NodeID n) const override final { return m_query_graph->BeginEdges(n); }
|
|
|
|
|
|
|
|
EdgeID EndEdges(const NodeID n) const override final { return m_query_graph->EndEdges(n); }
|
|
|
|
|
|
|
|
EdgeRange GetAdjacentEdgeRange(const NodeID node) const override final
|
|
|
|
{
|
|
|
|
return m_query_graph->GetAdjacentEdgeRange(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
// searches for a specific edge
|
|
|
|
EdgeID FindEdge(const NodeID from, const NodeID to) const override final
|
|
|
|
{
|
|
|
|
return m_query_graph->FindEdge(from, to);
|
|
|
|
}
|
|
|
|
|
|
|
|
EdgeID FindEdgeInEitherDirection(const NodeID from, const NodeID to) const override final
|
|
|
|
{
|
|
|
|
return m_query_graph->FindEdgeInEitherDirection(from, to);
|
|
|
|
}
|
|
|
|
|
|
|
|
EdgeID
|
|
|
|
FindEdgeIndicateIfReverse(const NodeID from, const NodeID to, bool &result) const override final
|
|
|
|
{
|
|
|
|
return m_query_graph->FindEdgeIndicateIfReverse(from, to, result);
|
|
|
|
}
|
|
|
|
|
|
|
|
EdgeID FindSmallestEdge(const NodeID from,
|
|
|
|
const NodeID to,
|
|
|
|
std::function<bool(EdgeData)> filter) const override final
|
|
|
|
{
|
|
|
|
return m_query_graph->FindSmallestEdge(from, to, filter);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-25 00:13:38 -05:00
|
|
|
template <>
|
|
|
|
class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CoreCH>
|
|
|
|
: public datafacade::AlgorithmDataFacade<algorithm::CoreCH>
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
util::ShM<bool, true>::vector m_is_core_node;
|
|
|
|
|
|
|
|
// allocator that keeps the allocation data
|
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
|
|
|
|
|
|
|
void InitializeCoreInformationPointer(storage::DataLayout &data_layout, char *memory_block)
|
|
|
|
{
|
|
|
|
auto core_marker_ptr =
|
|
|
|
data_layout.GetBlockPtr<unsigned>(memory_block, storage::DataLayout::CH_CORE_MARKER);
|
|
|
|
util::ShM<bool, true>::vector is_core_node(
|
|
|
|
core_marker_ptr, data_layout.num_entries[storage::DataLayout::CH_CORE_MARKER]);
|
|
|
|
m_is_core_node = std::move(is_core_node);
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
ContiguousInternalMemoryAlgorithmDataFacade(
|
|
|
|
std::shared_ptr<ContiguousBlockAllocator> allocator_)
|
|
|
|
: allocator(std::move(allocator_))
|
|
|
|
{
|
|
|
|
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory());
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitializeInternalPointers(storage::DataLayout &data_layout, char *memory_block)
|
|
|
|
{
|
|
|
|
InitializeCoreInformationPointer(data_layout, memory_block);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsCoreNode(const NodeID id) const override final
|
|
|
|
{
|
2017-03-03 08:28:11 -05:00
|
|
|
BOOST_ASSERT(id < m_is_core_node.size());
|
|
|
|
return m_is_core_node[id];
|
2017-02-25 00:13:38 -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-10 02:37:45 -04:00
|
|
|
using IndexBlock = util::RangeTable<16, true>::BlockT;
|
2016-05-03 05:48:33 -04:00
|
|
|
using RTreeLeaf = super::RTreeLeaf;
|
2016-11-15 19:40:40 -05:00
|
|
|
using SharedRTree =
|
|
|
|
util::StaticRTree<RTreeLeaf, util::ShM<util::Coordinate, true>::vector, true>;
|
2016-01-28 10:28:44 -05:00
|
|
|
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
2016-05-03 05:48:33 -04:00
|
|
|
using RTreeNode = SharedRTree::TreeNode;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
|
|
|
std::string m_timestamp;
|
2016-05-06 19:53:11 -04:00
|
|
|
extractor::ProfileProperties *m_profile_properties;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2017-01-09 15:40:33 -05:00
|
|
|
unsigned m_check_sum;
|
2016-11-15 19:40:40 -05:00
|
|
|
util::ShM<util::Coordinate, true>::vector m_coordinate_list;
|
2016-11-15 01:07:50 -05:00
|
|
|
util::PackedVector<OSMNodeID, true> m_osmnodeid_list;
|
2016-07-22 12:23:54 -04:00
|
|
|
util::ShM<GeometryID, true>::vector m_via_geometry_list;
|
2016-12-15 12:27:09 -05:00
|
|
|
util::ShM<NameID, true>::vector m_name_ID_list;
|
2016-06-15 08:38:24 -04:00
|
|
|
util::ShM<LaneDataID, true>::vector m_lane_data_id;
|
2016-03-01 16:30:31 -05:00
|
|
|
util::ShM<extractor::guidance::TurnInstruction, true>::vector m_turn_instruction_list;
|
2016-01-05 10:51:13 -05:00
|
|
|
util::ShM<extractor::TravelMode, true>::vector m_travel_mode_list;
|
2016-08-17 03:49:19 -04:00
|
|
|
util::ShM<util::guidance::TurnBearing, true>::vector m_pre_turn_bearing;
|
|
|
|
util::ShM<util::guidance::TurnBearing, true>::vector m_post_turn_bearing;
|
2017-01-19 09:14:30 -05:00
|
|
|
util::NameTable m_names_table;
|
2016-01-05 10:51:13 -05:00
|
|
|
util::ShM<unsigned, true>::vector m_name_begin_indices;
|
|
|
|
util::ShM<unsigned, true>::vector m_geometry_indices;
|
2016-10-07 00:06:33 -04:00
|
|
|
util::ShM<NodeID, true>::vector m_geometry_node_list;
|
|
|
|
util::ShM<EdgeWeight, true>::vector m_geometry_fwd_weight_list;
|
|
|
|
util::ShM<EdgeWeight, true>::vector m_geometry_rev_weight_list;
|
2016-05-12 12:50:10 -04:00
|
|
|
util::ShM<EdgeWeight, true>::vector m_geometry_fwd_duration_list;
|
|
|
|
util::ShM<EdgeWeight, true>::vector m_geometry_rev_duration_list;
|
2016-01-05 10:51:13 -05:00
|
|
|
util::ShM<bool, true>::vector m_is_core_node;
|
2016-12-15 12:27:09 -05:00
|
|
|
util::ShM<DatasourceID, true>::vector m_datasource_list;
|
2016-06-21 04:41:08 -04:00
|
|
|
util::ShM<std::uint32_t, true>::vector m_lane_description_offsets;
|
|
|
|
util::ShM<extractor::guidance::TurnLaneType::Mask, true>::vector m_lane_description_masks;
|
2016-05-12 12:50:10 -04:00
|
|
|
util::ShM<TurnPenalty, true>::vector m_turn_weight_penalties;
|
|
|
|
util::ShM<TurnPenalty, true>::vector m_turn_duration_penalties;
|
2016-03-15 02:03:19 -04:00
|
|
|
|
|
|
|
util::ShM<char, true>::vector m_datasource_name_data;
|
|
|
|
util::ShM<std::size_t, true>::vector m_datasource_name_offsets;
|
|
|
|
util::ShM<std::size_t, true>::vector m_datasource_name_lengths;
|
2016-10-04 15:28:13 -04:00
|
|
|
util::ShM<util::guidance::LaneTupleIdPair, true>::vector m_lane_tupel_id_pairs;
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-05-06 19:53:11 -04:00
|
|
|
std::unique_ptr<SharedRTree> m_static_rtree;
|
|
|
|
std::unique_ptr<SharedGeospatialQuery> m_geospatial_query;
|
2015-01-27 06:35:29 -05:00
|
|
|
boost::filesystem::path file_index_path;
|
|
|
|
|
2017-01-19 09:14:30 -05:00
|
|
|
util::NameTable m_name_table;
|
2016-04-26 07:27:40 -04:00
|
|
|
// bearing classes by node based node
|
|
|
|
util::ShM<BearingClassID, true>::vector m_bearing_class_id_table;
|
|
|
|
// entry class IDs
|
|
|
|
util::ShM<EntryClassID, true>::vector m_entry_class_id_list;
|
2016-08-17 03:49:19 -04:00
|
|
|
|
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.
|
|
|
|
util::ShM<util::guidance::EntryClass, true>::vector m_entry_class_table;
|
|
|
|
// the look-up table for distinct bearing classes. A bearing class lists the available bearings
|
|
|
|
// at an intersection
|
2016-05-10 02:37:45 -04:00
|
|
|
std::shared_ptr<util::RangeTable<16, true>> m_bearing_ranges_table;
|
|
|
|
util::ShM<DiscreteBearing, true>::vector m_bearing_values_table;
|
2016-04-26 07:27:40 -04:00
|
|
|
|
2017-02-23 10:39:29 -05:00
|
|
|
// MLD data
|
|
|
|
util::PackedMultiLevelPartition<true> mld_partition;
|
|
|
|
util::CellStorage<true> mld_cell_storage;
|
|
|
|
|
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
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeProfilePropertiesPointer(storage::DataLayout &data_layout, char *memory_block)
|
2016-03-21 18:34:59 -04:00
|
|
|
{
|
2016-11-15 02:41:44 -05:00
|
|
|
m_profile_properties = data_layout.GetBlockPtr<extractor::ProfileProperties>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::PROPERTIES);
|
2016-03-21 18:34:59 -04:00
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeTimestampPointer(storage::DataLayout &data_layout, char *memory_block)
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-01-25 23:10:50 -05:00
|
|
|
auto timestamp_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<char>(memory_block, storage::DataLayout::TIMESTAMP);
|
|
|
|
m_timestamp.resize(data_layout.GetBlockSize(storage::DataLayout::TIMESTAMP));
|
2015-01-27 06:35:29 -05:00
|
|
|
std::copy(timestamp_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
timestamp_ptr + data_layout.GetBlockSize(storage::DataLayout::TIMESTAMP),
|
2015-01-27 06:35:29 -05:00
|
|
|
m_timestamp.begin());
|
|
|
|
}
|
|
|
|
|
2017-01-09 15:40:33 -05:00
|
|
|
void InitializeChecksumPointer(storage::DataLayout &data_layout, char *memory_block)
|
|
|
|
{
|
|
|
|
m_check_sum =
|
|
|
|
*data_layout.GetBlockPtr<unsigned>(memory_block, storage::DataLayout::HSGR_CHECKSUM);
|
|
|
|
util::Log() << "set checksum: " << m_check_sum;
|
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeRTreePointers(storage::DataLayout &data_layout, char *memory_block)
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-05-06 20:43:37 -04:00
|
|
|
BOOST_ASSERT_MSG(!m_coordinate_list.empty(), "coordinates must be loaded before r-tree");
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-10-24 23:27:56 -04:00
|
|
|
const auto file_index_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<char>(memory_block, storage::DataLayout::FILE_INDEX_PATH);
|
2016-10-06 19:51:34 -04:00
|
|
|
file_index_path = boost::filesystem::path(file_index_ptr);
|
|
|
|
if (!boost::filesystem::exists(file_index_path))
|
|
|
|
{
|
2016-12-06 15:30:46 -05:00
|
|
|
util::Log(logDEBUG) << "Leaf file name " << file_index_path.string();
|
2016-10-12 15:26:59 -04:00
|
|
|
throw util::exception("Could not load " + file_index_path.string() +
|
2016-12-06 15:30:46 -05:00
|
|
|
"Is any data loaded into shared memory?" + SOURCE_REF);
|
2016-10-06 19:51:34 -04:00
|
|
|
}
|
|
|
|
|
2016-10-24 23:27:56 -04:00
|
|
|
auto tree_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<RTreeNode>(memory_block, storage::DataLayout::R_SEARCH_TREE);
|
2016-05-27 15:05:04 -04:00
|
|
|
m_static_rtree.reset(
|
|
|
|
new SharedRTree(tree_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::R_SEARCH_TREE],
|
2016-05-27 15:05:04 -04:00
|
|
|
file_index_path,
|
|
|
|
m_coordinate_list));
|
2016-01-05 06:04:04 -05:00
|
|
|
m_geospatial_query.reset(
|
2016-05-06 19:53:11 -04:00
|
|
|
new SharedGeospatialQuery(*m_static_rtree, m_coordinate_list, *this));
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeNodeAndEdgeInformationPointers(storage::DataLayout &data_layout,
|
|
|
|
char *memory_block)
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-11-15 02:41:44 -05:00
|
|
|
const auto coordinate_list_ptr = data_layout.GetBlockPtr<util::Coordinate>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::COORDINATE_LIST);
|
2016-11-15 19:40:40 -05:00
|
|
|
m_coordinate_list.reset(coordinate_list_ptr,
|
|
|
|
data_layout.num_entries[storage::DataLayout::COORDINATE_LIST]);
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-10-06 19:51:34 -04:00
|
|
|
for (unsigned i = 0; i < m_coordinate_list.size(); ++i)
|
|
|
|
{
|
|
|
|
BOOST_ASSERT(GetCoordinateOfNode(i).IsValid());
|
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
const auto osmnodeid_list_ptr = data_layout.GetBlockPtr<std::uint64_t>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::OSM_NODE_ID_LIST);
|
2016-11-15 01:07:50 -05:00
|
|
|
m_osmnodeid_list.reset(osmnodeid_list_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::OSM_NODE_ID_LIST]);
|
2016-11-15 01:07:50 -05:00
|
|
|
// We (ab)use the number of coordinates here because we know we have the same amount of ids
|
|
|
|
m_osmnodeid_list.set_number_of_entries(
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::COORDINATE_LIST]);
|
2016-05-18 16:09:14 -04:00
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
const auto travel_mode_list_ptr = data_layout.GetBlockPtr<extractor::TravelMode>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::TRAVEL_MODE);
|
2016-05-03 05:48:33 -04:00
|
|
|
util::ShM<extractor::TravelMode, true>::vector travel_mode_list(
|
2016-11-15 02:41:44 -05:00
|
|
|
travel_mode_list_ptr, data_layout.num_entries[storage::DataLayout::TRAVEL_MODE]);
|
2016-02-05 11:53:17 -05:00
|
|
|
m_travel_mode_list = std::move(travel_mode_list);
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-10-24 23:27:56 -04:00
|
|
|
const auto lane_data_id_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<LaneDataID>(memory_block, storage::DataLayout::LANE_DATA_ID);
|
2016-06-15 08:38:24 -04:00
|
|
|
util::ShM<LaneDataID, true>::vector lane_data_id(
|
2016-11-15 02:41:44 -05:00
|
|
|
lane_data_id_ptr, data_layout.num_entries[storage::DataLayout::LANE_DATA_ID]);
|
2016-06-15 08:38:24 -04:00
|
|
|
m_lane_data_id = std::move(lane_data_id);
|
|
|
|
|
2016-08-17 03:49:19 -04:00
|
|
|
const auto lane_tupel_id_pair_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<util::guidance::LaneTupleIdPair>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::TURN_LANE_DATA);
|
2016-10-04 15:28:13 -04:00
|
|
|
util::ShM<util::guidance::LaneTupleIdPair, true>::vector lane_tupel_id_pair(
|
2016-11-15 02:41:44 -05:00
|
|
|
lane_tupel_id_pair_ptr, data_layout.num_entries[storage::DataLayout::TURN_LANE_DATA]);
|
2016-06-15 08:38:24 -04:00
|
|
|
m_lane_tupel_id_pairs = std::move(lane_tupel_id_pair);
|
|
|
|
|
2016-08-17 03:49:19 -04:00
|
|
|
const auto turn_instruction_list_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<extractor::guidance::TurnInstruction>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::TURN_INSTRUCTION);
|
2016-05-06 19:53:11 -04:00
|
|
|
util::ShM<extractor::guidance::TurnInstruction, true>::vector turn_instruction_list(
|
|
|
|
turn_instruction_list_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::TURN_INSTRUCTION]);
|
2016-02-05 11:53:17 -05:00
|
|
|
m_turn_instruction_list = std::move(turn_instruction_list);
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-10-24 23:27:56 -04:00
|
|
|
const auto name_id_list_ptr =
|
2016-12-15 12:27:09 -05:00
|
|
|
data_layout.GetBlockPtr<NameID>(memory_block, storage::DataLayout::NAME_ID_LIST);
|
|
|
|
util::ShM<NameID, true>::vector name_id_list(
|
2016-11-15 02:41:44 -05:00
|
|
|
name_id_list_ptr, data_layout.num_entries[storage::DataLayout::NAME_ID_LIST]);
|
2016-02-05 11:53:17 -05:00
|
|
|
m_name_ID_list = std::move(name_id_list);
|
2016-04-26 07:27:40 -04:00
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
const auto entry_class_id_list_ptr =
|
|
|
|
data_layout.GetBlockPtr<EntryClassID>(memory_block, storage::DataLayout::ENTRY_CLASSID);
|
2016-04-26 07:27:40 -04:00
|
|
|
typename util::ShM<EntryClassID, true>::vector entry_class_id_list(
|
2016-11-15 02:41:44 -05:00
|
|
|
entry_class_id_list_ptr, data_layout.num_entries[storage::DataLayout::ENTRY_CLASSID]);
|
2016-04-26 07:27:40 -04:00
|
|
|
m_entry_class_id_list = std::move(entry_class_id_list);
|
2016-08-17 03:49:19 -04:00
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
const auto pre_turn_bearing_ptr = data_layout.GetBlockPtr<util::guidance::TurnBearing>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::PRE_TURN_BEARING);
|
2016-08-17 03:49:19 -04:00
|
|
|
typename util::ShM<util::guidance::TurnBearing, true>::vector pre_turn_bearing(
|
2016-11-15 02:41:44 -05:00
|
|
|
pre_turn_bearing_ptr, data_layout.num_entries[storage::DataLayout::PRE_TURN_BEARING]);
|
2016-08-17 03:49:19 -04:00
|
|
|
m_pre_turn_bearing = std::move(pre_turn_bearing);
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
const auto post_turn_bearing_ptr = data_layout.GetBlockPtr<util::guidance::TurnBearing>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::POST_TURN_BEARING);
|
2016-08-17 03:49:19 -04:00
|
|
|
typename util::ShM<util::guidance::TurnBearing, true>::vector post_turn_bearing(
|
2016-11-15 02:41:44 -05:00
|
|
|
post_turn_bearing_ptr, data_layout.num_entries[storage::DataLayout::POST_TURN_BEARING]);
|
2016-08-17 03:49:19 -04:00
|
|
|
m_post_turn_bearing = std::move(post_turn_bearing);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeViaNodeListPointer(storage::DataLayout &data_layout, char *memory_block)
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-10-24 23:27:56 -04:00
|
|
|
auto via_geometry_list_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<GeometryID>(memory_block, storage::DataLayout::VIA_NODE_LIST);
|
2016-07-22 12:23:54 -04:00
|
|
|
util::ShM<GeometryID, true>::vector via_geometry_list(
|
2016-11-15 02:41:44 -05:00
|
|
|
via_geometry_list_ptr, data_layout.num_entries[storage::DataLayout::VIA_NODE_LIST]);
|
2016-07-22 12:23:54 -04:00
|
|
|
m_via_geometry_list = std::move(via_geometry_list);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeNamePointers(storage::DataLayout &data_layout, char *memory_block)
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2017-01-19 09:14:30 -05:00
|
|
|
auto name_data_ptr =
|
|
|
|
data_layout.GetBlockPtr<char>(memory_block, storage::DataLayout::NAME_CHAR_DATA);
|
|
|
|
const auto name_data_size = data_layout.num_entries[storage::DataLayout::NAME_CHAR_DATA];
|
|
|
|
m_name_table.reset(name_data_ptr, name_data_ptr + name_data_size);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeTurnLaneDescriptionsPointers(storage::DataLayout &data_layout,
|
|
|
|
char *memory_block)
|
2016-06-15 08:38:24 -04:00
|
|
|
{
|
2016-11-15 02:41:44 -05:00
|
|
|
auto offsets_ptr = data_layout.GetBlockPtr<std::uint32_t>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::LANE_DESCRIPTION_OFFSETS);
|
2016-06-21 04:41:08 -04:00
|
|
|
util::ShM<std::uint32_t, true>::vector offsets(
|
2016-11-15 02:41:44 -05:00
|
|
|
offsets_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_OFFSETS]);
|
2016-06-21 04:41:08 -04:00
|
|
|
m_lane_description_offsets = std::move(offsets);
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
auto masks_ptr = data_layout.GetBlockPtr<extractor::guidance::TurnLaneType::Mask>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::LANE_DESCRIPTION_MASKS);
|
2016-06-21 04:41:08 -04:00
|
|
|
|
|
|
|
util::ShM<extractor::guidance::TurnLaneType::Mask, true>::vector masks(
|
2016-11-15 02:41:44 -05:00
|
|
|
masks_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]);
|
2016-06-21 04:41:08 -04:00
|
|
|
m_lane_description_masks = std::move(masks);
|
2016-06-15 08:38:24 -04:00
|
|
|
}
|
2016-06-21 04:41:08 -04:00
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
void InitializeTurnPenalties(storage::DataLayout &data_layout, char *memory_block)
|
|
|
|
{
|
|
|
|
auto turn_weight_penalties_ptr = data_layout.GetBlockPtr<TurnPenalty>(
|
|
|
|
memory_block, storage::DataLayout::TURN_WEIGHT_PENALTIES);
|
|
|
|
m_turn_weight_penalties = util::ShM<TurnPenalty, true>::vector(
|
|
|
|
turn_weight_penalties_ptr,
|
|
|
|
data_layout.num_entries[storage::DataLayout::TURN_WEIGHT_PENALTIES]);
|
|
|
|
if (data_layout.num_entries[storage::DataLayout::TURN_DURATION_PENALTIES] == 0)
|
|
|
|
{ // Fallback to turn weight penalties that are turn duration penalties in deciseconds
|
|
|
|
m_turn_duration_penalties = util::ShM<TurnPenalty, true>::vector(
|
|
|
|
turn_weight_penalties_ptr,
|
|
|
|
data_layout.num_entries[storage::DataLayout::TURN_WEIGHT_PENALTIES]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
auto turn_duration_penalties_ptr = data_layout.GetBlockPtr<TurnPenalty>(
|
|
|
|
memory_block, storage::DataLayout::TURN_DURATION_PENALTIES);
|
|
|
|
m_turn_duration_penalties = util::ShM<TurnPenalty, true>::vector(
|
|
|
|
turn_duration_penalties_ptr,
|
|
|
|
data_layout.num_entries[storage::DataLayout::TURN_DURATION_PENALTIES]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeGeometryPointers(storage::DataLayout &data_layout, char *memory_block)
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-10-24 23:27:56 -04:00
|
|
|
auto geometries_index_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<unsigned>(memory_block, storage::DataLayout::GEOMETRIES_INDEX);
|
2016-05-03 05:48:33 -04:00
|
|
|
util::ShM<unsigned, true>::vector geometry_begin_indices(
|
2016-11-15 02:41:44 -05:00
|
|
|
geometries_index_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_INDEX]);
|
2016-02-05 11:53:17 -05:00
|
|
|
m_geometry_indices = std::move(geometry_begin_indices);
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
auto geometries_node_list_ptr = data_layout.GetBlockPtr<NodeID>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::GEOMETRIES_NODE_LIST);
|
2016-10-07 00:06:33 -04:00
|
|
|
util::ShM<NodeID, true>::vector geometry_node_list(
|
|
|
|
geometries_node_list_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::GEOMETRIES_NODE_LIST]);
|
2016-10-07 00:06:33 -04:00
|
|
|
m_geometry_node_list = std::move(geometry_node_list);
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
auto geometries_fwd_weight_list_ptr = data_layout.GetBlockPtr<EdgeWeight>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::GEOMETRIES_FWD_WEIGHT_LIST);
|
2016-10-07 00:06:33 -04:00
|
|
|
util::ShM<EdgeWeight, true>::vector geometry_fwd_weight_list(
|
|
|
|
geometries_fwd_weight_list_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::GEOMETRIES_FWD_WEIGHT_LIST]);
|
2016-10-07 00:06:33 -04:00
|
|
|
m_geometry_fwd_weight_list = std::move(geometry_fwd_weight_list);
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
auto geometries_rev_weight_list_ptr = data_layout.GetBlockPtr<EdgeWeight>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::GEOMETRIES_REV_WEIGHT_LIST);
|
2016-10-07 00:06:33 -04:00
|
|
|
util::ShM<EdgeWeight, true>::vector geometry_rev_weight_list(
|
|
|
|
geometries_rev_weight_list_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::GEOMETRIES_REV_WEIGHT_LIST]);
|
2016-10-07 00:06:33 -04:00
|
|
|
m_geometry_rev_weight_list = std::move(geometry_rev_weight_list);
|
2016-03-15 02:03:19 -04:00
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
auto datasources_list_ptr = data_layout.GetBlockPtr<DatasourceID>(
|
|
|
|
memory_block, storage::DataLayout::DATASOURCES_LIST);
|
|
|
|
util::ShM<DatasourceID, true>::vector datasources_list(
|
2016-11-15 02:41:44 -05:00
|
|
|
datasources_list_ptr, data_layout.num_entries[storage::DataLayout::DATASOURCES_LIST]);
|
2016-03-15 02:03:19 -04:00
|
|
|
m_datasource_list = std::move(datasources_list);
|
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
auto geometries_fwd_duration_list_ptr = data_layout.GetBlockPtr<EdgeWeight>(
|
|
|
|
memory_block, storage::DataLayout::GEOMETRIES_FWD_DURATION_LIST);
|
|
|
|
util::ShM<EdgeWeight, true>::vector geometry_fwd_duration_list(
|
|
|
|
geometries_fwd_duration_list_ptr,
|
|
|
|
data_layout.num_entries[storage::DataLayout::GEOMETRIES_FWD_DURATION_LIST]);
|
|
|
|
m_geometry_fwd_duration_list = std::move(geometry_fwd_duration_list);
|
|
|
|
|
|
|
|
auto geometries_rev_duration_list_ptr = data_layout.GetBlockPtr<EdgeWeight>(
|
|
|
|
memory_block, storage::DataLayout::GEOMETRIES_REV_DURATION_LIST);
|
|
|
|
util::ShM<EdgeWeight, true>::vector geometry_rev_duration_list(
|
|
|
|
geometries_rev_duration_list_ptr,
|
|
|
|
data_layout.num_entries[storage::DataLayout::GEOMETRIES_REV_DURATION_LIST]);
|
|
|
|
m_geometry_rev_duration_list = std::move(geometry_rev_duration_list);
|
|
|
|
|
2016-10-24 23:27:56 -04:00
|
|
|
auto datasource_name_data_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<char>(memory_block, storage::DataLayout::DATASOURCE_NAME_DATA);
|
2016-05-03 05:48:33 -04:00
|
|
|
util::ShM<char, true>::vector datasource_name_data(
|
2016-03-15 02:03:19 -04:00
|
|
|
datasource_name_data_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::DATASOURCE_NAME_DATA]);
|
2016-03-15 02:03:19 -04:00
|
|
|
m_datasource_name_data = std::move(datasource_name_data);
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
auto datasource_name_offsets_ptr = data_layout.GetBlockPtr<std::size_t>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::DATASOURCE_NAME_OFFSETS);
|
2016-05-03 05:48:33 -04:00
|
|
|
util::ShM<std::size_t, true>::vector datasource_name_offsets(
|
2016-03-15 02:03:19 -04:00
|
|
|
datasource_name_offsets_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::DATASOURCE_NAME_OFFSETS]);
|
2016-03-15 02:03:19 -04:00
|
|
|
m_datasource_name_offsets = std::move(datasource_name_offsets);
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
auto datasource_name_lengths_ptr = data_layout.GetBlockPtr<std::size_t>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::DATASOURCE_NAME_LENGTHS);
|
2016-05-03 05:48:33 -04:00
|
|
|
util::ShM<std::size_t, true>::vector datasource_name_lengths(
|
2016-03-15 02:03:19 -04:00
|
|
|
datasource_name_lengths_ptr,
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.num_entries[storage::DataLayout::DATASOURCE_NAME_LENGTHS]);
|
2016-03-15 02:03:19 -04:00
|
|
|
m_datasource_name_lengths = std::move(datasource_name_lengths);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeIntersectionClassPointers(storage::DataLayout &data_layout, char *memory_block)
|
2016-04-26 07:27:40 -04:00
|
|
|
{
|
2016-11-15 02:41:44 -05:00
|
|
|
auto bearing_class_id_ptr = data_layout.GetBlockPtr<BearingClassID>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::BEARING_CLASSID);
|
2016-04-26 07:27:40 -04:00
|
|
|
typename util::ShM<BearingClassID, true>::vector bearing_class_id_table(
|
2016-11-15 02:41:44 -05:00
|
|
|
bearing_class_id_ptr, data_layout.num_entries[storage::DataLayout::BEARING_CLASSID]);
|
2016-04-26 07:27:40 -04:00
|
|
|
m_bearing_class_id_table = std::move(bearing_class_id_table);
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
auto bearing_class_ptr = data_layout.GetBlockPtr<DiscreteBearing>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::BEARING_VALUES);
|
2016-05-10 02:37:45 -04:00
|
|
|
typename util::ShM<DiscreteBearing, true>::vector bearing_class_table(
|
2016-11-15 02:41:44 -05:00
|
|
|
bearing_class_ptr, data_layout.num_entries[storage::DataLayout::BEARING_VALUES]);
|
2016-05-10 02:37:45 -04:00
|
|
|
m_bearing_values_table = std::move(bearing_class_table);
|
|
|
|
|
2016-10-24 23:27:56 -04:00
|
|
|
auto offsets_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<unsigned>(memory_block, storage::DataLayout::BEARING_OFFSETS);
|
2016-10-24 23:27:56 -04:00
|
|
|
auto blocks_ptr =
|
2016-11-15 02:41:44 -05:00
|
|
|
data_layout.GetBlockPtr<IndexBlock>(memory_block, storage::DataLayout::BEARING_BLOCKS);
|
2016-05-10 02:37:45 -04:00
|
|
|
util::ShM<unsigned, true>::vector bearing_offsets(
|
2016-11-15 02:41:44 -05:00
|
|
|
offsets_ptr, data_layout.num_entries[storage::DataLayout::BEARING_OFFSETS]);
|
2016-05-10 02:37:45 -04:00
|
|
|
util::ShM<IndexBlock, true>::vector bearing_blocks(
|
2016-11-15 02:41:44 -05:00
|
|
|
blocks_ptr, data_layout.num_entries[storage::DataLayout::BEARING_BLOCKS]);
|
2016-05-10 02:37:45 -04:00
|
|
|
|
2016-10-14 10:11:49 -04:00
|
|
|
m_bearing_ranges_table = std::make_unique<util::RangeTable<16, true>>(
|
2016-05-10 02:37:45 -04:00
|
|
|
bearing_offsets, bearing_blocks, static_cast<unsigned>(m_bearing_values_table.size()));
|
2016-04-26 07:27:40 -04:00
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
auto entry_class_ptr = data_layout.GetBlockPtr<util::guidance::EntryClass>(
|
2016-10-24 23:27:56 -04:00
|
|
|
memory_block, storage::DataLayout::ENTRY_CLASS);
|
2016-04-26 07:27:40 -04:00
|
|
|
typename util::ShM<util::guidance::EntryClass, true>::vector entry_class_table(
|
2016-11-15 02:41:44 -05:00
|
|
|
entry_class_ptr, data_layout.num_entries[storage::DataLayout::ENTRY_CLASS]);
|
2016-04-26 07:27:40 -04:00
|
|
|
m_entry_class_table = std::move(entry_class_table);
|
|
|
|
}
|
|
|
|
|
2017-02-23 10:39:29 -05:00
|
|
|
void InitializeMLDDataPointers(storage::DataLayout &data_layout, char *memory_block)
|
|
|
|
{
|
|
|
|
if (data_layout.GetBlockSize(storage::DataLayout::MLD_CELL_PARTITION) > 0)
|
|
|
|
{
|
|
|
|
auto mld_partition_ptr =
|
|
|
|
data_layout.GetBlockPtr<char>(memory_block, storage::DataLayout::MLD_CELL_PARTITION);
|
|
|
|
mld_partition.InitializePointers(
|
|
|
|
mld_partition_ptr,
|
|
|
|
mld_partition_ptr + data_layout.num_entries[storage::DataLayout::MLD_CELL_PARTITION]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data_layout.GetBlockSize(storage::DataLayout::MLD_CELL_STORAGE) > 0)
|
|
|
|
{
|
|
|
|
auto mld_cell_storage_ptr =
|
|
|
|
data_layout.GetBlockPtr<char>(memory_block, storage::DataLayout::MLD_CELL_STORAGE);
|
|
|
|
mld_cell_storage.InitializePointers(
|
|
|
|
mld_cell_storage_ptr,
|
|
|
|
mld_cell_storage_ptr + data_layout.num_entries[storage::DataLayout::MLD_CELL_STORAGE]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-15 02:41:44 -05:00
|
|
|
void InitializeInternalPointers(storage::DataLayout &data_layout, char *memory_block)
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-11-15 02:41:44 -05:00
|
|
|
InitializeChecksumPointer(data_layout, memory_block);
|
|
|
|
InitializeNodeAndEdgeInformationPointers(data_layout, memory_block);
|
2016-05-12 12:50:10 -04:00
|
|
|
InitializeTurnPenalties(data_layout, memory_block);
|
2016-11-15 02:41:44 -05:00
|
|
|
InitializeGeometryPointers(data_layout, memory_block);
|
|
|
|
InitializeTimestampPointer(data_layout, memory_block);
|
|
|
|
InitializeViaNodeListPointer(data_layout, memory_block);
|
|
|
|
InitializeNamePointers(data_layout, memory_block);
|
|
|
|
InitializeTurnLaneDescriptionsPointers(data_layout, memory_block);
|
|
|
|
InitializeProfilePropertiesPointer(data_layout, memory_block);
|
|
|
|
InitializeRTreePointers(data_layout, memory_block);
|
|
|
|
InitializeIntersectionClassPointers(data_layout, memory_block);
|
2017-02-23 10:39:29 -05:00
|
|
|
InitializeMLDDataPointers(data_layout, memory_block);
|
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-01-09 15:40:33 -05:00
|
|
|
ContiguousInternalMemoryDataFacadeBase(std::shared_ptr<ContiguousBlockAllocator> allocator_)
|
2017-01-18 07:44:17 -05:00
|
|
|
: allocator(std::move(allocator_))
|
|
|
|
{
|
|
|
|
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory());
|
|
|
|
}
|
|
|
|
|
2015-01-27 06:35:29 -05:00
|
|
|
// node and edge information access
|
2016-02-23 15:23:13 -05:00
|
|
|
util::Coordinate GetCoordinateOfNode(const NodeID id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-05-06 20:43:37 -04:00
|
|
|
return m_coordinate_list[id];
|
2016-03-14 11:25:39 -04:00
|
|
|
}
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
OSMNodeID GetOSMNodeIDOfNode(const NodeID id) const override final
|
2016-05-18 16:09:14 -04:00
|
|
|
{
|
2016-11-15 01:07:50 -05:00
|
|
|
return m_osmnodeid_list.at(id);
|
2016-05-18 16:09:14 -04:00
|
|
|
}
|
|
|
|
|
2016-07-22 12:23:54 -04:00
|
|
|
virtual std::vector<NodeID> GetUncompressedForwardGeometry(const EdgeID id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-07-22 12:23:54 -04:00
|
|
|
/*
|
|
|
|
* NodeID's for geometries are stored in one place for
|
|
|
|
* both forward and reverse segments along the same bi-
|
|
|
|
* directional edge. The m_geometry_indices stores
|
|
|
|
* refences to where to find the beginning of the bi-
|
2016-10-07 00:06:33 -04:00
|
|
|
* directional edge in the m_geometry_node_list vector. For
|
2016-07-22 12:23:54 -04:00
|
|
|
* forward geometries of bi-directional edges, edges 2 to
|
|
|
|
* n of that edge need to be read.
|
|
|
|
*/
|
2017-02-08 09:19:29 -05:00
|
|
|
const auto begin = m_geometry_indices.at(id);
|
|
|
|
const auto end = m_geometry_indices.at(id + 1);
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-07-22 12:23:54 -04:00
|
|
|
std::vector<NodeID> result_nodes;
|
2017-02-08 09:19:29 -05:00
|
|
|
result_nodes.reserve(end - begin);
|
2016-07-22 12:23:54 -04:00
|
|
|
|
2016-10-19 16:58:20 -04:00
|
|
|
std::copy(m_geometry_node_list.begin() + begin,
|
|
|
|
m_geometry_node_list.begin() + end,
|
2017-02-08 09:19:29 -05:00
|
|
|
std::back_inserter(result_nodes));
|
2016-07-22 12:23:54 -04:00
|
|
|
|
|
|
|
return result_nodes;
|
2016-01-29 20:52:20 -05:00
|
|
|
}
|
|
|
|
|
2016-07-22 12:23:54 -04:00
|
|
|
virtual std::vector<NodeID> GetUncompressedReverseGeometry(const EdgeID id) const override final
|
2016-01-29 20:52:20 -05:00
|
|
|
{
|
2016-07-22 12:23:54 -04:00
|
|
|
/*
|
|
|
|
* NodeID's for geometries are stored in one place for
|
|
|
|
* both forward and reverse segments along the same bi-
|
|
|
|
* directional edge. The m_geometry_indices stores
|
|
|
|
* refences to where to find the beginning of the bi-
|
2016-10-07 00:06:33 -04:00
|
|
|
* directional edge in the m_geometry_node_list vector.
|
2016-07-22 12:23:54 -04:00
|
|
|
* */
|
2017-02-08 09:19:29 -05:00
|
|
|
const auto begin = m_geometry_indices.at(id);
|
|
|
|
const auto end = m_geometry_indices.at(id + 1);
|
2016-07-22 12:23:54 -04:00
|
|
|
|
|
|
|
std::vector<NodeID> result_nodes;
|
2017-02-08 09:19:29 -05:00
|
|
|
result_nodes.reserve(end - begin);
|
2016-07-22 12:23:54 -04:00
|
|
|
|
2017-02-08 09:19:29 -05:00
|
|
|
std::reverse_copy(m_geometry_node_list.begin() + begin,
|
|
|
|
m_geometry_node_list.begin() + end,
|
|
|
|
std::back_inserter(result_nodes));
|
2016-07-22 12:23:54 -04:00
|
|
|
|
|
|
|
return result_nodes;
|
|
|
|
}
|
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
virtual std::vector<EdgeWeight>
|
|
|
|
GetUncompressedForwardDurations(const EdgeID id) const override final
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* EdgeWeights's for geometries are stored in one place for
|
|
|
|
* both forward and reverse segments along the same bi-
|
|
|
|
* directional edge. The m_geometry_indices stores
|
|
|
|
* refences to where to find the beginning of the bi-
|
|
|
|
* directional edge in the m_geometry_fwd_weight_list vector.
|
|
|
|
* */
|
2017-02-08 09:19:29 -05:00
|
|
|
const auto begin = m_geometry_indices.at(id) + 1;
|
|
|
|
const auto end = m_geometry_indices.at(id + 1);
|
2016-05-12 12:50:10 -04:00
|
|
|
|
|
|
|
std::vector<EdgeWeight> result_durations;
|
2017-02-08 09:19:29 -05:00
|
|
|
result_durations.reserve(end - begin);
|
2016-05-12 12:50:10 -04:00
|
|
|
|
|
|
|
std::copy(m_geometry_fwd_duration_list.begin() + begin,
|
|
|
|
m_geometry_fwd_duration_list.begin() + end,
|
2017-02-08 09:19:29 -05:00
|
|
|
std::back_inserter(result_durations));
|
2016-05-12 12:50:10 -04:00
|
|
|
|
|
|
|
return result_durations;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual std::vector<EdgeWeight>
|
|
|
|
GetUncompressedReverseDurations(const EdgeID id) const override final
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* EdgeWeights for geometries are stored in one place for
|
|
|
|
* both forward and reverse segments along the same bi-
|
|
|
|
* directional edge. The m_geometry_indices stores
|
|
|
|
* refences to where to find the beginning of the bi-
|
|
|
|
* directional edge in the m_geometry_rev_weight_list vector. For
|
|
|
|
* reverse durations of bi-directional edges, edges 1 to
|
|
|
|
* n-1 of that edge need to be read in reverse.
|
|
|
|
*/
|
2017-02-08 09:19:29 -05:00
|
|
|
const auto begin = m_geometry_indices.at(id);
|
|
|
|
const auto end = m_geometry_indices.at(id + 1) - 1;
|
2016-05-12 12:50:10 -04:00
|
|
|
|
|
|
|
std::vector<EdgeWeight> result_durations;
|
2017-02-08 09:19:29 -05:00
|
|
|
result_durations.reserve(end - begin);
|
2016-05-12 12:50:10 -04:00
|
|
|
|
2017-02-08 09:19:29 -05:00
|
|
|
std::reverse_copy(m_geometry_rev_duration_list.begin() + begin,
|
|
|
|
m_geometry_rev_duration_list.begin() + end,
|
|
|
|
std::back_inserter(result_durations));
|
2016-05-12 12:50:10 -04:00
|
|
|
|
|
|
|
return result_durations;
|
|
|
|
}
|
|
|
|
|
2016-07-22 12:23:54 -04:00
|
|
|
virtual std::vector<EdgeWeight>
|
|
|
|
GetUncompressedForwardWeights(const EdgeID id) const override final
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* EdgeWeights's for geometries are stored in one place for
|
|
|
|
* both forward and reverse segments along the same bi-
|
|
|
|
* directional edge. The m_geometry_indices stores
|
|
|
|
* refences to where to find the beginning of the bi-
|
2016-10-07 00:06:33 -04:00
|
|
|
* directional edge in the m_geometry_fwd_weight_list vector.
|
2016-07-22 12:23:54 -04:00
|
|
|
* */
|
2017-02-08 09:19:29 -05:00
|
|
|
const auto begin = m_geometry_indices.at(id) + 1;
|
|
|
|
const auto end = m_geometry_indices.at(id + 1);
|
2016-01-29 20:52:20 -05:00
|
|
|
|
2016-07-22 12:23:54 -04:00
|
|
|
std::vector<EdgeWeight> result_weights;
|
2017-02-08 09:19:29 -05:00
|
|
|
result_weights.reserve(end - begin);
|
2016-07-22 12:23:54 -04:00
|
|
|
|
2016-10-19 16:58:20 -04:00
|
|
|
std::copy(m_geometry_fwd_weight_list.begin() + begin,
|
|
|
|
m_geometry_fwd_weight_list.begin() + end,
|
2017-02-08 09:19:29 -05:00
|
|
|
std::back_inserter(result_weights));
|
2016-07-22 12:23:54 -04:00
|
|
|
|
|
|
|
return result_weights;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual std::vector<EdgeWeight>
|
|
|
|
GetUncompressedReverseWeights(const EdgeID id) const override final
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* EdgeWeights for geometries are stored in one place for
|
|
|
|
* both forward and reverse segments along the same bi-
|
|
|
|
* directional edge. The m_geometry_indices stores
|
|
|
|
* refences to where to find the beginning of the bi-
|
2016-10-07 00:06:33 -04:00
|
|
|
* directional edge in the m_geometry_rev_weight_list vector. For
|
2016-07-22 12:23:54 -04:00
|
|
|
* reverse weights of bi-directional edges, edges 1 to
|
|
|
|
* n-1 of that edge need to be read in reverse.
|
|
|
|
*/
|
2017-02-08 09:19:29 -05:00
|
|
|
const auto begin = m_geometry_indices.at(id);
|
|
|
|
const auto end = m_geometry_indices.at(id + 1) - 1;
|
2016-07-22 12:23:54 -04:00
|
|
|
|
|
|
|
std::vector<EdgeWeight> result_weights;
|
2017-02-08 09:19:29 -05:00
|
|
|
result_weights.reserve(end - begin);
|
2016-07-22 12:23:54 -04:00
|
|
|
|
2017-02-08 09:19:29 -05:00
|
|
|
std::reverse_copy(m_geometry_rev_weight_list.begin() + begin,
|
|
|
|
m_geometry_rev_weight_list.begin() + end,
|
|
|
|
std::back_inserter(result_weights));
|
2016-10-19 16:58:20 -04:00
|
|
|
|
2016-07-22 12:23:54 -04:00
|
|
|
return result_weights;
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
virtual GeometryID GetGeometryIndexForEdgeID(const EdgeID id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
2016-07-22 12:23:54 -04:00
|
|
|
return m_via_geometry_list.at(id);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
virtual TurnPenalty GetWeightPenaltyForEdgeID(const unsigned id) const override final
|
|
|
|
{
|
|
|
|
BOOST_ASSERT(m_turn_weight_penalties.size() > id);
|
|
|
|
return m_turn_weight_penalties[id];
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual TurnPenalty GetDurationPenaltyForEdgeID(const unsigned id) const override final
|
|
|
|
{
|
|
|
|
BOOST_ASSERT(m_turn_duration_penalties.size() > id);
|
|
|
|
return m_turn_duration_penalties[id];
|
|
|
|
}
|
|
|
|
|
2016-03-03 09:36:03 -05:00
|
|
|
extractor::guidance::TurnInstruction
|
2016-12-15 12:27:09 -05:00
|
|
|
GetTurnInstructionForEdgeID(const EdgeID id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
|
|
|
return m_turn_instruction_list.at(id);
|
|
|
|
}
|
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
extractor::TravelMode GetTravelModeForEdgeID(const EdgeID id) const override final
|
2015-02-05 08:58:07 -05:00
|
|
|
{
|
|
|
|
return m_travel_mode_list.at(id);
|
|
|
|
}
|
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,
|
2016-05-06 20:56:08 -04:00
|
|
|
const float max_distance) 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
|
|
|
|
|
|
|
return m_geospatial_query->NearestPhantomNodesInRange(input_coordinate, max_distance);
|
|
|
|
}
|
|
|
|
|
2015-12-09 16:34:22 -05:00
|
|
|
std::vector<PhantomNodeWithDistance>
|
2016-02-23 15:23:13 -05:00
|
|
|
NearestPhantomNodesInRange(const util::Coordinate input_coordinate,
|
2015-12-03 14:04:23 -05:00
|
|
|
const float max_distance,
|
2016-02-20 22:27:26 -05:00
|
|
|
const int bearing,
|
2016-05-06 20:56:08 -04:00
|
|
|
const int bearing_range) 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->NearestPhantomNodesInRange(
|
|
|
|
input_coordinate, max_distance, bearing, bearing_range);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-02-22 18:44:35 -05:00
|
|
|
std::vector<PhantomNodeWithDistance>
|
2016-02-23 15:23:13 -05:00
|
|
|
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
2016-05-06 20:56:08 -04:00
|
|
|
const unsigned max_results) const override final
|
2016-02-22 18:44:35 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2016-02-22 18:44:35 -05:00
|
|
|
|
|
|
|
return m_geospatial_query->NearestPhantomNodes(input_coordinate, max_results);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<PhantomNodeWithDistance>
|
2016-02-23 15:23:13 -05:00
|
|
|
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
2016-02-22 18:44:35 -05:00
|
|
|
const unsigned max_results,
|
2016-05-06 20:56:08 -04:00
|
|
|
const double max_distance) const override final
|
2016-02-22 18:44:35 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2016-02-22 18:44:35 -05:00
|
|
|
|
|
|
|
return m_geospatial_query->NearestPhantomNodes(input_coordinate, max_results, max_distance);
|
|
|
|
}
|
|
|
|
|
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,
|
2015-12-03 14:04:23 -05:00
|
|
|
const unsigned max_results,
|
2016-02-22 18:44:35 -05:00
|
|
|
const int bearing,
|
2016-05-06 20:56:08 -04:00
|
|
|
const int bearing_range) 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(
|
|
|
|
input_coordinate, max_results, bearing, bearing_range);
|
2015-01-27 06:35:29 -05:00
|
|
|
}
|
|
|
|
|
2016-02-22 18:44:35 -05:00
|
|
|
std::vector<PhantomNodeWithDistance>
|
2016-02-23 15:23:13 -05:00
|
|
|
NearestPhantomNodes(const util::Coordinate input_coordinate,
|
2016-02-22 18:44:35 -05:00
|
|
|
const unsigned max_results,
|
|
|
|
const double max_distance,
|
|
|
|
const int bearing,
|
2016-05-06 20:56:08 -04:00
|
|
|
const int bearing_range) const override final
|
2016-02-22 18:44:35 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2016-02-22 18:44:35 -05:00
|
|
|
|
2016-05-27 15:05:04 -04:00
|
|
|
return m_geospatial_query->NearestPhantomNodes(
|
|
|
|
input_coordinate, max_results, max_distance, bearing, bearing_range);
|
2016-02-22 18:44:35 -05:00
|
|
|
}
|
|
|
|
|
2016-01-28 10:28:44 -05:00
|
|
|
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
|
2016-05-06 20:56:08 -04:00
|
|
|
const util::Coordinate input_coordinate) const override final
|
2016-01-28 10:28:44 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2016-01-28 10:28:44 -05:00
|
|
|
|
|
|
|
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
|
|
|
|
input_coordinate);
|
|
|
|
}
|
|
|
|
|
2016-05-27 15:05:04 -04:00
|
|
|
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
|
|
|
|
const util::Coordinate input_coordinate, const double max_distance) const override final
|
2016-01-28 10:28:44 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2016-01-28 10:28:44 -05:00
|
|
|
|
|
|
|
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
|
|
|
|
input_coordinate, max_distance);
|
|
|
|
}
|
|
|
|
|
2016-02-23 15:23:13 -05:00
|
|
|
std::pair<PhantomNode, PhantomNode>
|
|
|
|
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
|
|
const double max_distance,
|
|
|
|
const int bearing,
|
2016-05-06 20:56:08 -04:00
|
|
|
const int bearing_range) const override final
|
2016-01-28 10:28:44 -05:00
|
|
|
{
|
2016-05-06 19:53:11 -04:00
|
|
|
BOOST_ASSERT(m_geospatial_query.get());
|
2016-01-28 10:28:44 -05:00
|
|
|
|
|
|
|
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
|
|
|
|
input_coordinate, max_distance, bearing, bearing_range);
|
|
|
|
}
|
|
|
|
|
2016-02-23 15:23:13 -05:00
|
|
|
std::pair<PhantomNode, PhantomNode>
|
|
|
|
NearestPhantomNodeWithAlternativeFromBigComponent(const util::Coordinate input_coordinate,
|
|
|
|
const int bearing,
|
2016-05-06 20:56:08 -04:00
|
|
|
const int bearing_range) 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
|
|
|
|
2016-01-05 06:04:04 -05:00
|
|
|
return m_geospatial_query->NearestPhantomNodeWithAlternativeFromBigComponent(
|
|
|
|
input_coordinate, bearing, bearing_range);
|
2014-09-23 12:46:14 -04:00
|
|
|
}
|
|
|
|
|
2015-01-28 04:10:28 -05:00
|
|
|
unsigned GetCheckSum() const override final { return m_check_sum; }
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
NameID GetNameIndexFromEdgeID(const EdgeID id) const override final
|
2015-01-27 06:35:29 -05:00
|
|
|
{
|
|
|
|
return m_name_ID_list.at(id);
|
2016-03-14 11:25:39 -04:00
|
|
|
}
|
2015-01-27 06:35:29 -05:00
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
StringView 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
|
|
|
}
|
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
StringView 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
|
|
|
}
|
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
StringView 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
|
|
|
}
|
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
StringView 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
|
|
|
}
|
|
|
|
|
2016-03-15 02:03:19 -04:00
|
|
|
// Returns the data source ids that were used to supply the edge
|
|
|
|
// weights.
|
2016-12-15 12:27:09 -05:00
|
|
|
virtual std::vector<DatasourceID>
|
2016-07-22 12:23:54 -04:00
|
|
|
GetUncompressedForwardDatasources(const EdgeID id) const override final
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Data sources for geometries are stored in one place for
|
|
|
|
* both forward and reverse segments along the same bi-
|
|
|
|
* directional edge. The m_geometry_indices stores
|
|
|
|
* refences to where to find the beginning of the bi-
|
|
|
|
* directional edge in the m_geometry_list vector. For
|
|
|
|
* forward datasources of bi-directional edges, edges 2 to
|
|
|
|
* n of that edge need to be read.
|
|
|
|
*/
|
2017-02-08 09:19:29 -05:00
|
|
|
const auto begin = m_geometry_indices.at(id) + 1;
|
|
|
|
const auto end = m_geometry_indices.at(id + 1);
|
2016-03-15 02:03:19 -04:00
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
std::vector<DatasourceID> result_datasources;
|
2017-02-08 09:19:29 -05:00
|
|
|
result_datasources.reserve(end - begin);
|
2016-03-15 02:03:19 -04:00
|
|
|
|
|
|
|
// If there was no datasource info, return an array of 0's.
|
|
|
|
if (m_datasource_list.empty())
|
|
|
|
{
|
2017-02-07 09:34:15 -05:00
|
|
|
result_datasources.resize(end - begin, 0);
|
2016-03-15 02:03:19 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-10-19 20:11:36 -04:00
|
|
|
std::copy(m_datasource_list.begin() + begin,
|
|
|
|
m_datasource_list.begin() + end,
|
2017-02-08 09:19:29 -05:00
|
|
|
std::back_inserter(result_datasources));
|
2016-03-15 02:03:19 -04:00
|
|
|
}
|
2016-07-22 12:23:54 -04:00
|
|
|
|
|
|
|
return result_datasources;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the data source ids that were used to supply the edge
|
|
|
|
// weights.
|
2016-12-15 12:27:09 -05:00
|
|
|
virtual std::vector<DatasourceID>
|
2016-07-22 12:23:54 -04:00
|
|
|
GetUncompressedReverseDatasources(const EdgeID id) const override final
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Datasources for geometries are stored in one place for
|
|
|
|
* both forward and reverse segments along the same bi-
|
|
|
|
* directional edge. The m_geometry_indices stores
|
|
|
|
* refences to where to find the beginning of the bi-
|
|
|
|
* directional edge in the m_geometry_list vector. For
|
|
|
|
* reverse datasources of bi-directional edges, edges 1 to
|
|
|
|
* n-1 of that edge need to be read in reverse.
|
|
|
|
*/
|
|
|
|
const unsigned begin = m_geometry_indices.at(id);
|
|
|
|
const unsigned end = m_geometry_indices.at(id + 1) - 1;
|
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
std::vector<DatasourceID> result_datasources;
|
2017-02-08 09:19:29 -05:00
|
|
|
result_datasources.reserve(end - begin);
|
2016-07-22 12:23:54 -04:00
|
|
|
|
|
|
|
// If there was no datasource info, return an array of 0's.
|
|
|
|
if (m_datasource_list.empty())
|
|
|
|
{
|
2017-02-07 09:34:15 -05:00
|
|
|
result_datasources.resize(end - begin, 0);
|
2016-07-22 12:23:54 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-08 09:19:29 -05:00
|
|
|
std::reverse_copy(m_datasource_list.begin() + begin,
|
|
|
|
m_datasource_list.begin() + end,
|
|
|
|
std::back_inserter(result_datasources));
|
2016-07-22 12:23:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return result_datasources;
|
2016-03-15 02:03:19 -04:00
|
|
|
}
|
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
StringView GetDatasourceName(const DatasourceID id) const override final
|
2016-03-15 02:03:19 -04:00
|
|
|
{
|
2016-03-22 14:30:18 -04:00
|
|
|
BOOST_ASSERT(m_datasource_name_offsets.size() >= 1);
|
2016-12-15 12:27:09 -05:00
|
|
|
BOOST_ASSERT(m_datasource_name_offsets.size() > id);
|
2016-03-15 02:03:19 -04:00
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
auto first = m_datasource_name_data.begin() + m_datasource_name_offsets[id];
|
|
|
|
auto last = m_datasource_name_data.begin() + m_datasource_name_offsets[id] +
|
|
|
|
m_datasource_name_lengths[id];
|
|
|
|
// These iterators are useless: they're InputIterators onto a contiguous block of memory.
|
|
|
|
// Deref to get to the first element, then Addressof to get the memory address of the it.
|
|
|
|
const std::size_t len = &*last - &*first;
|
2016-03-15 02:03:19 -04:00
|
|
|
|
2016-12-15 12:27:09 -05:00
|
|
|
return StringView{&*first, len};
|
2016-03-15 02:03:19 -04:00
|
|
|
}
|
|
|
|
|
2015-01-28 04:10:28 -05:00
|
|
|
std::string GetTimestamp() const override final { return m_timestamp; }
|
2016-03-21 18:34:59 -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();
|
|
|
|
}
|
|
|
|
|
2016-04-26 07:27:40 -04:00
|
|
|
BearingClassID GetBearingClassID(const NodeID id) const override final
|
|
|
|
{
|
|
|
|
return m_bearing_class_id_table.at(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
util::guidance::BearingClass
|
|
|
|
GetBearingClass(const BearingClassID bearing_class_id) const override final
|
|
|
|
{
|
|
|
|
BOOST_ASSERT(bearing_class_id != INVALID_BEARING_CLASSID);
|
2016-05-10 02:37:45 -04:00
|
|
|
auto range = m_bearing_ranges_table->GetRange(bearing_class_id);
|
|
|
|
util::guidance::BearingClass result;
|
|
|
|
for (auto itr = m_bearing_values_table.begin() + range.front();
|
2016-05-27 15:05:04 -04:00
|
|
|
itr != m_bearing_values_table.begin() + range.back() + 1;
|
|
|
|
++itr)
|
2016-05-10 02:37:45 -04:00
|
|
|
result.add(*itr);
|
|
|
|
return result;
|
2016-04-26 07:27:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
EntryClassID GetEntryClassID(const EdgeID eid) const override final
|
|
|
|
{
|
|
|
|
return m_entry_class_id_list.at(eid);
|
|
|
|
}
|
|
|
|
|
2016-08-17 03:49:19 -04:00
|
|
|
util::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const override final
|
|
|
|
{
|
|
|
|
return m_pre_turn_bearing.at(eid);
|
|
|
|
}
|
|
|
|
util::guidance::TurnBearing PostTurnBearing(const EdgeID eid) const override final
|
|
|
|
{
|
|
|
|
return m_post_turn_bearing.at(eid);
|
|
|
|
}
|
|
|
|
|
2016-04-26 07:27:40 -04:00
|
|
|
util::guidance::EntryClass GetEntryClass(const EntryClassID entry_class_id) const override final
|
|
|
|
{
|
|
|
|
return m_entry_class_table.at(entry_class_id);
|
|
|
|
}
|
2016-06-15 08:38:24 -04:00
|
|
|
|
|
|
|
bool hasLaneData(const EdgeID id) const override final
|
|
|
|
{
|
|
|
|
return INVALID_LANE_DATAID != m_lane_data_id.at(id);
|
|
|
|
}
|
|
|
|
|
2016-10-04 15:28:13 -04:00
|
|
|
util::guidance::LaneTupleIdPair GetLaneData(const EdgeID id) const override final
|
2016-06-15 08:38:24 -04:00
|
|
|
{
|
|
|
|
BOOST_ASSERT(hasLaneData(id));
|
|
|
|
return m_lane_tupel_id_pairs.at(m_lane_data_id.at(id));
|
|
|
|
}
|
|
|
|
|
2016-06-21 04:41:08 -04:00
|
|
|
extractor::guidance::TurnLaneDescription
|
|
|
|
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
|
|
|
|
return extractor::guidance::TurnLaneDescription(
|
|
|
|
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-02-23 10:39:29 -05:00
|
|
|
|
|
|
|
const util::PackedMultiLevelPartition<true> &GetMultiLevelPartition() const
|
|
|
|
{
|
|
|
|
return mld_partition;
|
|
|
|
}
|
|
|
|
|
|
|
|
const util::CellStorage<true> &GetCellStorage() const { return mld_cell_storage; }
|
2015-01-27 06:35:29 -05:00
|
|
|
};
|
2017-01-09 15:40:33 -05:00
|
|
|
|
|
|
|
template <typename AlgorithmT> class ContiguousInternalMemoryDataFacade;
|
|
|
|
|
|
|
|
template <>
|
|
|
|
class ContiguousInternalMemoryDataFacade<algorithm::CH>
|
|
|
|
: public ContiguousInternalMemoryDataFacadeBase,
|
|
|
|
public ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator)
|
|
|
|
: ContiguousInternalMemoryDataFacadeBase(allocator),
|
|
|
|
ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH>(allocator)
|
|
|
|
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2017-02-25 00:13:38 -05:00
|
|
|
|
|
|
|
template <>
|
|
|
|
class ContiguousInternalMemoryDataFacade<algorithm::CoreCH> final
|
|
|
|
: public ContiguousInternalMemoryDataFacade<algorithm::CH>,
|
|
|
|
public ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CoreCH>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator)
|
|
|
|
: ContiguousInternalMemoryDataFacade<algorithm::CH>(allocator),
|
|
|
|
ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CoreCH>(allocator)
|
|
|
|
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-14 21:34:39 -05:00
|
|
|
#endif // CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP
|