Remove use of ShM<>::vector in favour of the boost::iterator_range
This commit is contained in:
parent
6949d7ee5b
commit
e2e5eb0169
@ -37,12 +37,23 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <boost/multi_array.hpp>
|
||||||
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace engine
|
namespace engine
|
||||||
{
|
{
|
||||||
namespace datafacade
|
namespace datafacade
|
||||||
{
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
template <typename T, typename = std::enable_if<std::is_const<T>::value>>
|
||||||
|
using ConstArrayRef = boost::iterator_range<T>;
|
||||||
|
|
||||||
|
using CoordinateArrayRef = ConstArrayRef<const util::Coordinate *>;
|
||||||
|
using OSMNodeArrayRef = ConstArrayRef<const OSMNodeID *>;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This base class implements the Datafacade interface for accessing
|
* 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 IndexBlock = util::RangeTable<16, true>::BlockT;
|
||||||
using InputEdge = QueryGraph::InputEdge;
|
using InputEdge = QueryGraph::InputEdge;
|
||||||
using RTreeLeaf = super::RTreeLeaf;
|
using RTreeLeaf = super::RTreeLeaf;
|
||||||
using SharedRTree =
|
using SharedRTree = util::StaticRTree<RTreeLeaf, CoordinateArrayRef, true>;
|
||||||
util::StaticRTree<RTreeLeaf, util::ShM<util::Coordinate, true>::vector, true>;
|
|
||||||
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
||||||
using RTreeNode = SharedRTree::TreeNode;
|
using RTreeNode = SharedRTree::TreeNode;
|
||||||
|
|
||||||
@ -68,8 +78,8 @@ class BigRAMBlockDataFacadeBase : public BaseDataFacade
|
|||||||
std::string m_timestamp;
|
std::string m_timestamp;
|
||||||
extractor::ProfileProperties *m_profile_properties;
|
extractor::ProfileProperties *m_profile_properties;
|
||||||
|
|
||||||
util::ShM<util::Coordinate, true>::vector m_coordinate_list;
|
CoordinateArrayRef m_coordinate_list;
|
||||||
util::PackedVector<OSMNodeID, true> m_osmnodeid_list;
|
OSMNodeArrayRef m_osmnodeid_list;
|
||||||
util::ShM<GeometryID, true>::vector m_via_geometry_list;
|
util::ShM<GeometryID, true>::vector m_via_geometry_list;
|
||||||
util::ShM<unsigned, true>::vector m_name_ID_list;
|
util::ShM<unsigned, true>::vector m_name_ID_list;
|
||||||
util::ShM<LaneDataID, true>::vector m_lane_data_id;
|
util::ShM<LaneDataID, true>::vector m_lane_data_id;
|
||||||
@ -178,21 +188,21 @@ class BigRAMBlockDataFacadeBase : public BaseDataFacade
|
|||||||
{
|
{
|
||||||
const auto coordinate_list_ptr = data_layout->GetBlockPtr<util::Coordinate>(
|
const auto coordinate_list_ptr = data_layout->GetBlockPtr<util::Coordinate>(
|
||||||
memory_block, storage::DataLayout::COORDINATE_LIST);
|
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)
|
for (unsigned i = 0; i < m_coordinate_list.size(); ++i)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(GetCoordinateOfNode(i).IsValid());
|
BOOST_ASSERT(GetCoordinateOfNode(i).IsValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto osmnodeid_list_ptr = data_layout->GetBlockPtr<std::uint64_t>(
|
const auto osmnodeid_list_ptr = data_layout->GetBlockPtr<OSMNodeID>(
|
||||||
memory_block, storage::DataLayout::OSM_NODE_ID_LIST);
|
memory_block, storage::DataLayout::OSM_NODE_ID_LIST);
|
||||||
m_osmnodeid_list.reset(osmnodeid_list_ptr,
|
m_osmnodeid_list = OSMNodeArrayRef(
|
||||||
data_layout->num_entries[storage::DataLayout::OSM_NODE_ID_LIST]);
|
osmnodeid_list_ptr,
|
||||||
// We (ab)use the number of coordinates here because we know we have the same amount of ids
|
osmnodeid_list_ptr + data_layout->num_entries[storage::DataLayout::COORDINATE_LIST]);
|
||||||
m_osmnodeid_list.set_number_of_entries(
|
|
||||||
data_layout->num_entries[storage::DataLayout::COORDINATE_LIST]);
|
|
||||||
|
|
||||||
const auto travel_mode_list_ptr = data_layout->GetBlockPtr<extractor::TravelMode>(
|
const auto travel_mode_list_ptr = data_layout->GetBlockPtr<extractor::TravelMode>(
|
||||||
memory_block, storage::DataLayout::TRAVEL_MODE);
|
memory_block, storage::DataLayout::TRAVEL_MODE);
|
||||||
@ -467,7 +477,7 @@ class BigRAMBlockDataFacadeBase : public BaseDataFacade
|
|||||||
|
|
||||||
OSMNodeID GetOSMNodeIDOfNode(const unsigned id) const override final
|
OSMNodeID GetOSMNodeIDOfNode(const unsigned id) const override final
|
||||||
{
|
{
|
||||||
return m_osmnodeid_list.at(id);
|
return m_osmnodeid_list[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::vector<NodeID> GetUncompressedForwardGeometry(const EdgeID id) const override final
|
virtual std::vector<NodeID> GetUncompressedForwardGeometry(const EdgeID id) const override final
|
||||||
|
@ -514,7 +514,8 @@ void Storage::LoadData(DataLayout *layout_ptr, char *memory_ptr)
|
|||||||
name_file.readInto(reinterpret_cast<char *>(name_blocks_ptr),
|
name_file.readInto(reinterpret_cast<char *>(name_blocks_ptr),
|
||||||
layout_ptr->GetBlockSize(DataLayout::NAME_BLOCKS));
|
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 temp_count = name_file.readElementCount32();
|
||||||
|
|
||||||
const auto name_char_ptr =
|
const auto name_char_ptr =
|
||||||
|
Loading…
Reference in New Issue
Block a user