diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index c651951c9..01e40e0be 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -79,9 +79,9 @@ class ContiguousInternalMemoryAlgorithmDataFacade auto graph_edges_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::CH_GRAPH_EDGE_LIST); - util::SharedMemoryVector node_list( + util::vector_view node_list( graph_nodes_ptr, data_layout.num_entries[storage::DataLayout::CH_GRAPH_NODE_LIST]); - util::SharedMemoryVector edge_list( + util::vector_view 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)); } @@ -155,7 +155,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade : public datafacade::AlgorithmDataFacade { private: - util::ShM::vector m_is_core_node; + util::vector_view m_is_core_node; // allocator that keeps the allocation data std::shared_ptr allocator; @@ -164,7 +164,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade { auto core_marker_ptr = data_layout.GetBlockPtr(memory_block, storage::DataLayout::CH_CORE_MARKER); - util::ShM::vector is_core_node( + util::vector_view is_core_node( core_marker_ptr, data_layout.num_entries[storage::DataLayout::CH_CORE_MARKER]); m_is_core_node = std::move(is_core_node); } @@ -202,10 +202,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade using super = BaseDataFacade; using IndexBlock = util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT; using RTreeLeaf = super::RTreeLeaf; - using SharedRTree = util::StaticRTree< - RTreeLeaf, - util::ShM::vector, - osrm::storage::MemorySetting::SharedMemory>; + using SharedRTree = util::StaticRTree, + osrm::storage::MemorySetting::SharedMemory>; using SharedGeospatialQuery = GeospatialQuery; using RTreeNode = SharedRTree::TreeNode; @@ -214,38 +213,28 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade extractor::Datasources *m_datasources; unsigned m_check_sum; - util::ShM::vector - m_coordinate_list; + util::vector_view m_coordinate_list; util::PackedVector m_osmnodeid_list; - util::SharedMemoryVector m_via_geometry_list; - util::SharedMemoryVector m_name_ID_list; - util::SharedMemoryVector m_lane_data_id; - util::ShM::vector m_turn_instruction_list; - util::ShM::vector - m_travel_mode_list; - util::ShM::vector - m_pre_turn_bearing; - util::ShM::vector - m_post_turn_bearing; + util::vector_view m_via_geometry_list; + util::vector_view m_name_ID_list; + util::vector_view m_lane_data_id; + util::vector_view m_turn_instruction_list; + util::vector_view m_travel_mode_list; + util::vector_view m_pre_turn_bearing; + util::vector_view m_post_turn_bearing; util::NameTable m_names_table; - util::SharedMemoryVector m_name_begin_indices; - util::SharedMemoryVector m_is_core_node; - util::ShM::vector - m_lane_description_offsets; - util::ShM::vector m_lane_description_masks; - util::SharedMemoryVector m_turn_weight_penalties; - util::SharedMemoryVector m_turn_duration_penalties; + util::vector_view m_name_begin_indices; + util::vector_view m_is_core_node; + util::vector_view m_lane_description_offsets; + util::vector_view m_lane_description_masks; + util::vector_view m_turn_weight_penalties; + util::vector_view m_turn_duration_penalties; extractor::SegmentDataView segment_data; - util::SharedMemoryVector m_datasource_name_data; - util::ShM::vector - m_datasource_name_offsets; - util::ShM::vector - m_datasource_name_lengths; - util::ShM::vector - m_lane_tupel_id_pairs; + util::vector_view m_datasource_name_data; + util::vector_view m_datasource_name_offsets; + util::vector_view m_datasource_name_lengths; + util::vector_view m_lane_tupel_id_pairs; std::unique_ptr m_static_rtree; std::unique_ptr m_geospatial_query; @@ -253,19 +242,18 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade util::NameTable m_name_table; // bearing classes by node based node - util::SharedMemoryVector m_bearing_class_id_table; + util::vector_view m_bearing_class_id_table; // entry class IDs - util::SharedMemoryVector m_entry_class_id_list; + util::vector_view m_entry_class_id_list; // 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::vector - m_entry_class_table; + util::vector_view m_entry_class_table; // the look-up table for distinct bearing classes. A bearing class lists the available bearings // at an intersection std::shared_ptr> m_bearing_ranges_table; - util::SharedMemoryVector m_bearing_values_table; + util::vector_view m_bearing_values_table; // allocator that keeps the allocation data std::shared_ptr allocator; @@ -341,61 +329,53 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade const auto travel_mode_list_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::TRAVEL_MODE); - util::ShM::vector - travel_mode_list(travel_mode_list_ptr, - data_layout.num_entries[storage::DataLayout::TRAVEL_MODE]); + util::vector_view travel_mode_list( + travel_mode_list_ptr, data_layout.num_entries[storage::DataLayout::TRAVEL_MODE]); m_travel_mode_list = std::move(travel_mode_list); const auto lane_data_id_ptr = data_layout.GetBlockPtr(memory_block, storage::DataLayout::LANE_DATA_ID); - util::SharedMemoryVector lane_data_id( + util::vector_view lane_data_id( lane_data_id_ptr, data_layout.num_entries[storage::DataLayout::LANE_DATA_ID]); m_lane_data_id = std::move(lane_data_id); const auto lane_tupel_id_pair_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::TURN_LANE_DATA); - util::ShM::vector - lane_tupel_id_pair(lane_tupel_id_pair_ptr, - data_layout.num_entries[storage::DataLayout::TURN_LANE_DATA]); + util::vector_view lane_tupel_id_pair( + lane_tupel_id_pair_ptr, data_layout.num_entries[storage::DataLayout::TURN_LANE_DATA]); m_lane_tupel_id_pairs = std::move(lane_tupel_id_pair); const auto turn_instruction_list_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::TURN_INSTRUCTION); - util::ShM::vector - turn_instruction_list(turn_instruction_list_ptr, - data_layout.num_entries[storage::DataLayout::TURN_INSTRUCTION]); + util::vector_view turn_instruction_list( + turn_instruction_list_ptr, + data_layout.num_entries[storage::DataLayout::TURN_INSTRUCTION]); m_turn_instruction_list = std::move(turn_instruction_list); const auto name_id_list_ptr = data_layout.GetBlockPtr(memory_block, storage::DataLayout::NAME_ID_LIST); - util::SharedMemoryVector name_id_list( + util::vector_view name_id_list( name_id_list_ptr, data_layout.num_entries[storage::DataLayout::NAME_ID_LIST]); m_name_ID_list = std::move(name_id_list); const auto entry_class_id_list_ptr = data_layout.GetBlockPtr(memory_block, storage::DataLayout::ENTRY_CLASSID); - typename util::SharedMemoryVector entry_class_id_list( + typename util::vector_view entry_class_id_list( entry_class_id_list_ptr, data_layout.num_entries[storage::DataLayout::ENTRY_CLASSID]); m_entry_class_id_list = std::move(entry_class_id_list); const auto pre_turn_bearing_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::PRE_TURN_BEARING); - typename util::ShM::vector - pre_turn_bearing(pre_turn_bearing_ptr, - data_layout.num_entries[storage::DataLayout::PRE_TURN_BEARING]); + typename util::vector_view pre_turn_bearing( + pre_turn_bearing_ptr, data_layout.num_entries[storage::DataLayout::PRE_TURN_BEARING]); m_pre_turn_bearing = std::move(pre_turn_bearing); const auto post_turn_bearing_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::POST_TURN_BEARING); - typename util::ShM::vector - post_turn_bearing(post_turn_bearing_ptr, - data_layout.num_entries[storage::DataLayout::POST_TURN_BEARING]); + typename util::vector_view post_turn_bearing( + post_turn_bearing_ptr, data_layout.num_entries[storage::DataLayout::POST_TURN_BEARING]); m_post_turn_bearing = std::move(post_turn_bearing); } @@ -403,7 +383,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade { auto via_geometry_list_ptr = data_layout.GetBlockPtr(memory_block, storage::DataLayout::VIA_NODE_LIST); - util::SharedMemoryVector via_geometry_list( + util::vector_view via_geometry_list( via_geometry_list_ptr, data_layout.num_entries[storage::DataLayout::VIA_NODE_LIST]); m_via_geometry_list = std::move(via_geometry_list); } @@ -421,16 +401,15 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade { auto offsets_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::LANE_DESCRIPTION_OFFSETS); - util::ShM::vector offsets( + util::vector_view offsets( offsets_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_OFFSETS]); m_lane_description_offsets = std::move(offsets); auto masks_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::LANE_DESCRIPTION_MASKS); - util::ShM::vector - masks(masks_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]); + util::vector_view masks( + masks_ptr, data_layout.num_entries[storage::DataLayout::LANE_DESCRIPTION_MASKS]); m_lane_description_masks = std::move(masks); } @@ -438,12 +417,12 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade { auto turn_weight_penalties_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::TURN_WEIGHT_PENALTIES); - m_turn_weight_penalties = util::SharedMemoryVector( + m_turn_weight_penalties = util::vector_view( turn_weight_penalties_ptr, data_layout.num_entries[storage::DataLayout::TURN_WEIGHT_PENALTIES]); auto turn_duration_penalties_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::TURN_DURATION_PENALTIES); - m_turn_duration_penalties = util::SharedMemoryVector( + m_turn_duration_penalties = util::vector_view( turn_duration_penalties_ptr, data_layout.num_entries[storage::DataLayout::TURN_DURATION_PENALTIES]); } @@ -452,42 +431,42 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade { auto geometries_index_ptr = data_layout.GetBlockPtr(memory_block, storage::DataLayout::GEOMETRIES_INDEX); - util::SharedMemoryVector geometry_begin_indices( + util::vector_view geometry_begin_indices( geometries_index_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_INDEX]); auto geometries_node_list_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::GEOMETRIES_NODE_LIST); - util::SharedMemoryVector geometry_node_list( + util::vector_view geometry_node_list( geometries_node_list_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_NODE_LIST]); auto geometries_fwd_weight_list_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::GEOMETRIES_FWD_WEIGHT_LIST); - util::SharedMemoryVector geometry_fwd_weight_list( + util::vector_view geometry_fwd_weight_list( geometries_fwd_weight_list_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_FWD_WEIGHT_LIST]); auto geometries_rev_weight_list_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::GEOMETRIES_REV_WEIGHT_LIST); - util::SharedMemoryVector geometry_rev_weight_list( + util::vector_view geometry_rev_weight_list( geometries_rev_weight_list_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_REV_WEIGHT_LIST]); auto geometries_fwd_duration_list_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::GEOMETRIES_FWD_DURATION_LIST); - util::SharedMemoryVector geometry_fwd_duration_list( + util::vector_view geometry_fwd_duration_list( geometries_fwd_duration_list_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_FWD_DURATION_LIST]); auto geometries_rev_duration_list_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::GEOMETRIES_REV_DURATION_LIST); - util::SharedMemoryVector geometry_rev_duration_list( + util::vector_view geometry_rev_duration_list( geometries_rev_duration_list_ptr, data_layout.num_entries[storage::DataLayout::GEOMETRIES_REV_DURATION_LIST]); auto datasources_list_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::DATASOURCES_LIST); - util::SharedMemoryVector datasources_list( + util::vector_view datasources_list( datasources_list_ptr, data_layout.num_entries[storage::DataLayout::DATASOURCES_LIST]); segment_data = extractor::SegmentDataView{std::move(geometry_begin_indices), @@ -506,13 +485,13 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade { auto bearing_class_id_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::BEARING_CLASSID); - typename util::SharedMemoryVector bearing_class_id_table( + typename util::vector_view bearing_class_id_table( bearing_class_id_ptr, data_layout.num_entries[storage::DataLayout::BEARING_CLASSID]); m_bearing_class_id_table = std::move(bearing_class_id_table); auto bearing_class_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::BEARING_VALUES); - typename util::SharedMemoryVector bearing_class_table( + typename util::vector_view bearing_class_table( bearing_class_ptr, data_layout.num_entries[storage::DataLayout::BEARING_VALUES]); m_bearing_values_table = std::move(bearing_class_table); @@ -520,9 +499,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade data_layout.GetBlockPtr(memory_block, storage::DataLayout::BEARING_OFFSETS); auto blocks_ptr = data_layout.GetBlockPtr(memory_block, storage::DataLayout::BEARING_BLOCKS); - util::SharedMemoryVector bearing_offsets( + util::vector_view bearing_offsets( offsets_ptr, data_layout.num_entries[storage::DataLayout::BEARING_OFFSETS]); - util::SharedMemoryVector bearing_blocks( + util::vector_view bearing_blocks( blocks_ptr, data_layout.num_entries[storage::DataLayout::BEARING_BLOCKS]); m_bearing_ranges_table = @@ -533,10 +512,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade auto entry_class_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::ENTRY_CLASS); - typename util::ShM::vector - entry_class_table(entry_class_ptr, - data_layout.num_entries[storage::DataLayout::ENTRY_CLASS]); + typename util::vector_view entry_class_table( + entry_class_ptr, data_layout.num_entries[storage::DataLayout::ENTRY_CLASS]); m_entry_class_table = std::move(entry_class_table); } @@ -958,15 +935,13 @@ class ContiguousInternalMemoryAlgorithmDataFacade memory_block, storage::DataLayout::MLD_PARTITION); auto partition_entries_count = data_layout.GetBlockEntries(storage::DataLayout::MLD_PARTITION); - util::SharedMemoryVector partition(mld_partition_ptr, - partition_entries_count); + util::vector_view partition(mld_partition_ptr, partition_entries_count); auto mld_chilren_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::MLD_CELL_TO_CHILDREN); auto children_entries_count = data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_TO_CHILDREN); - util::SharedMemoryVector cell_to_children(mld_chilren_ptr, - children_entries_count); + util::vector_view cell_to_children(mld_chilren_ptr, children_entries_count); mld_partition = partition::MultiLevelPartitionView{level_data, partition, cell_to_children}; @@ -998,17 +973,15 @@ class ContiguousInternalMemoryAlgorithmDataFacade auto cell_level_offsets_entries_count = data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_LEVEL_OFFSETS); - util::SharedMemoryVector weights(mld_cell_weights_ptr, - weight_entries_count); - util::SharedMemoryVector source_boundary(mld_source_boundary_ptr, - source_boundary_entries_count); - util::SharedMemoryVector destination_boundary( - mld_destination_boundary_ptr, destination_boundary_entries_count); - util::ShM::vector - cells(mld_cells_ptr, cells_entries_counts); - util::ShM::vector - level_offsets(mld_cell_level_offsets_ptr, cell_level_offsets_entries_count); + util::vector_view weights(mld_cell_weights_ptr, weight_entries_count); + util::vector_view source_boundary(mld_source_boundary_ptr, + source_boundary_entries_count); + util::vector_view destination_boundary(mld_destination_boundary_ptr, + destination_boundary_entries_count); + util::vector_view cells(mld_cells_ptr, + cells_entries_counts); + util::vector_view level_offsets(mld_cell_level_offsets_ptr, + cell_level_offsets_entries_count); mld_cell_storage = partition::CellStorageView{std::move(weights), std::move(source_boundary), @@ -1028,13 +1001,13 @@ class ContiguousInternalMemoryAlgorithmDataFacade auto graph_node_to_offset_ptr = data_layout.GetBlockPtr( memory_block, storage::DataLayout::MLD_GRAPH_NODE_TO_OFFSET); - util::SharedMemoryVector node_list( + util::vector_view node_list( graph_nodes_ptr, data_layout.num_entries[storage::DataLayout::MLD_GRAPH_NODE_LIST]); - util::SharedMemoryVector edge_list( + util::vector_view edge_list( graph_edges_ptr, data_layout.num_entries[storage::DataLayout::MLD_GRAPH_EDGE_LIST]); - util::ShM::vector - node_to_offset(graph_node_to_offset_ptr, - data_layout.num_entries[storage::DataLayout::MLD_GRAPH_NODE_TO_OFFSET]); + util::vector_view node_to_offset( + graph_node_to_offset_ptr, + data_layout.num_entries[storage::DataLayout::MLD_GRAPH_NODE_TO_OFFSET]); query_graph = QueryGraph(std::move(node_list), std::move(edge_list), std::move(node_to_offset)); diff --git a/include/util/shared_memory_vector_wrapper.hpp b/include/util/shared_memory_vector_wrapper.hpp index a625e631f..8080aa397 100644 --- a/include/util/shared_memory_vector_wrapper.hpp +++ b/include/util/shared_memory_vector_wrapper.hpp @@ -184,8 +184,7 @@ template struct ShM }; template -using SharedMemoryVector = - typename util::ShM::vector; +using vector_view = typename util::ShM::vector; template using InternalMemoryVector = typename util::ShM::vector; diff --git a/include/util/static_graph.hpp b/include/util/static_graph.hpp index bff17eeb7..4a3dc50c3 100644 --- a/include/util/static_graph.hpp +++ b/include/util/static_graph.hpp @@ -126,8 +126,8 @@ class StaticGraph InitializeFromSortedEdgeRange(nodes, edges.begin(), edges.end()); } - StaticGraph(typename ShM::vector node_array_, - typename ShM::vector edge_array_) + StaticGraph(typename util::ShM::vector node_array_, + typename util::ShM::vector edge_array_) : node_array(std::move(node_array_)), edge_array(std::move(edge_array_)) { BOOST_ASSERT(!node_array.empty()); diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index 04f970c4d..5084620da 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -55,10 +55,9 @@ namespace storage { using RTreeLeaf = engine::datafacade::BaseDataFacade::RTreeLeaf; -using RTreeNode = util::StaticRTree< - RTreeLeaf, - util::ShM::vector, - osrm::storage::MemorySetting::SharedMemory>::TreeNode; +using RTreeNode = util::StaticRTree, + osrm::storage::MemorySetting::SharedMemory>::TreeNode; using QueryGraph = util::StaticGraph; using EdgeBasedGraph = util::StaticGraph;