diff --git a/include/engine/datafacade/bigramblock_datafacade_base.hpp b/include/engine/datafacade/bigramblock_datafacade_base.hpp index 226d6c4ee..65a3fb6d1 100644 --- a/include/engine/datafacade/bigramblock_datafacade_base.hpp +++ b/include/engine/datafacade/bigramblock_datafacade_base.hpp @@ -37,12 +37,23 @@ #include #include +#include +#include + namespace osrm { namespace engine { namespace datafacade { +namespace +{ +template ::value>> +using ConstArrayRef = boost::iterator_range; + +using CoordinateArrayRef = ConstArrayRef; +using OSMNodeArrayRef = ConstArrayRef; +} /** * This base class implements the Datafacade interface for accessing @@ -58,8 +69,7 @@ class BigRAMBlockDataFacadeBase : public BaseDataFacade using IndexBlock = util::RangeTable<16, true>::BlockT; using InputEdge = QueryGraph::InputEdge; using RTreeLeaf = super::RTreeLeaf; - using SharedRTree = - util::StaticRTree::vector, true>; + using SharedRTree = util::StaticRTree; using SharedGeospatialQuery = GeospatialQuery; using RTreeNode = SharedRTree::TreeNode; @@ -68,8 +78,8 @@ class BigRAMBlockDataFacadeBase : public BaseDataFacade std::string m_timestamp; extractor::ProfileProperties *m_profile_properties; - util::ShM::vector m_coordinate_list; - util::PackedVector m_osmnodeid_list; + CoordinateArrayRef m_coordinate_list; + OSMNodeArrayRef m_osmnodeid_list; util::ShM::vector m_via_geometry_list; util::ShM::vector m_name_ID_list; util::ShM::vector m_lane_data_id; @@ -178,21 +188,21 @@ class BigRAMBlockDataFacadeBase : public BaseDataFacade { const auto coordinate_list_ptr = data_layout->GetBlockPtr( memory_block, storage::DataLayout::COORDINATE_LIST); - m_coordinate_list.reset(coordinate_list_ptr, - data_layout->num_entries[storage::DataLayout::COORDINATE_LIST]); + + m_coordinate_list = CoordinateArrayRef( + coordinate_list_ptr, + coordinate_list_ptr + data_layout->num_entries[storage::DataLayout::COORDINATE_LIST]); for (unsigned i = 0; i < m_coordinate_list.size(); ++i) { BOOST_ASSERT(GetCoordinateOfNode(i).IsValid()); } - const auto osmnodeid_list_ptr = data_layout->GetBlockPtr( + const auto osmnodeid_list_ptr = data_layout->GetBlockPtr( memory_block, storage::DataLayout::OSM_NODE_ID_LIST); - m_osmnodeid_list.reset(osmnodeid_list_ptr, - data_layout->num_entries[storage::DataLayout::OSM_NODE_ID_LIST]); - // 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( - data_layout->num_entries[storage::DataLayout::COORDINATE_LIST]); + m_osmnodeid_list = OSMNodeArrayRef( + osmnodeid_list_ptr, + osmnodeid_list_ptr + data_layout->num_entries[storage::DataLayout::COORDINATE_LIST]); const auto travel_mode_list_ptr = data_layout->GetBlockPtr( memory_block, storage::DataLayout::TRAVEL_MODE); @@ -467,7 +477,7 @@ class BigRAMBlockDataFacadeBase : public BaseDataFacade OSMNodeID GetOSMNodeIDOfNode(const unsigned id) const override final { - return m_osmnodeid_list.at(id); + return m_osmnodeid_list[id]; } virtual std::vector GetUncompressedForwardGeometry(const EdgeID id) const override final diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index 8fb639987..fb11da65a 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -514,7 +514,8 @@ void Storage::LoadData(DataLayout *layout_ptr, char *memory_ptr) name_file.readInto(reinterpret_cast(name_blocks_ptr), layout_ptr->GetBlockSize(DataLayout::NAME_BLOCKS)); - // For some reason, this value (the same as ) + // The file format contains the element count a second time. Don't know why, + // but we need to read it here to progress the file pointer to the correct spot const auto temp_count = name_file.readElementCount32(); const auto name_char_ptr =