Remove osrm namespace indication where possible, wrap out shared_memory_ownership
This commit is contained in:
parent
091a495632
commit
789311abd6
@ -7,7 +7,7 @@
|
||||
#include "util/static_graph.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
@ -19,17 +19,16 @@ namespace customizer
|
||||
using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData;
|
||||
|
||||
struct MultiLevelEdgeBasedGraph
|
||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::Container>
|
||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>
|
||||
{
|
||||
using Base =
|
||||
partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::Container>;
|
||||
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>;
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
struct MultiLevelEdgeBasedGraphView
|
||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::View>
|
||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>
|
||||
{
|
||||
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::View>;
|
||||
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::View>;
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "partition/multi_level_partition.hpp"
|
||||
|
||||
#include "storage/shared_datatype.hpp"
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include "util/exception.hpp"
|
||||
#include "util/exception_utils.hpp"
|
||||
@ -62,7 +62,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH>
|
||||
: public datafacade::AlgorithmDataFacade<algorithm::CH>
|
||||
{
|
||||
private:
|
||||
using QueryGraph = util::StaticGraph<EdgeData, osrm::storage::Ownership::View>;
|
||||
using QueryGraph = util::StaticGraph<EdgeData, storage::Ownership::View>;
|
||||
using GraphNode = QueryGraph::NodeArrayEntry;
|
||||
using GraphEdge = QueryGraph::EdgeArrayEntry;
|
||||
|
||||
@ -200,11 +200,10 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
{
|
||||
private:
|
||||
using super = BaseDataFacade;
|
||||
using IndexBlock = util::RangeTable<16, osrm::storage::Ownership::View>::BlockT;
|
||||
using IndexBlock = util::RangeTable<16, storage::Ownership::View>::BlockT;
|
||||
using RTreeLeaf = super::RTreeLeaf;
|
||||
using SharedRTree = util::StaticRTree<RTreeLeaf,
|
||||
util::vector_view<util::Coordinate>,
|
||||
osrm::storage::Ownership::View>;
|
||||
using SharedRTree =
|
||||
util::StaticRTree<RTreeLeaf, util::vector_view<util::Coordinate>, storage::Ownership::View>;
|
||||
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
|
||||
using RTreeNode = SharedRTree::TreeNode;
|
||||
|
||||
@ -214,7 +213,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
|
||||
unsigned m_check_sum;
|
||||
util::vector_view<util::Coordinate> m_coordinate_list;
|
||||
util::PackedVector<OSMNodeID, osrm::storage::Ownership::View> m_osmnodeid_list;
|
||||
util::PackedVector<OSMNodeID, storage::Ownership::View> m_osmnodeid_list;
|
||||
util::vector_view<GeometryID> m_via_geometry_list;
|
||||
util::vector_view<NameID> m_name_ID_list;
|
||||
util::vector_view<LaneDataID> m_lane_data_id;
|
||||
@ -251,7 +250,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
util::vector_view<util::guidance::EntryClass> 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<util::RangeTable<16, osrm::storage::Ownership::View>> m_bearing_ranges_table;
|
||||
std::shared_ptr<util::RangeTable<16, storage::Ownership::View>> m_bearing_ranges_table;
|
||||
util::vector_view<DiscreteBearing> m_bearing_values_table;
|
||||
|
||||
// allocator that keeps the allocation data
|
||||
@ -503,11 +502,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
util::vector_view<IndexBlock> bearing_blocks(
|
||||
blocks_ptr, data_layout.num_entries[storage::DataLayout::BEARING_BLOCKS]);
|
||||
|
||||
m_bearing_ranges_table =
|
||||
std::make_unique<util::RangeTable<16, osrm::storage::Ownership::View>>(
|
||||
bearing_offsets,
|
||||
bearing_blocks,
|
||||
static_cast<unsigned>(m_bearing_values_table.size()));
|
||||
m_bearing_ranges_table = std::make_unique<util::RangeTable<16, storage::Ownership::View>>(
|
||||
bearing_offsets, bearing_blocks, static_cast<unsigned>(m_bearing_values_table.size()));
|
||||
|
||||
auto entry_class_ptr = data_layout.GetBlockPtr<util::guidance::EntryClass>(
|
||||
memory_block, storage::DataLayout::ENTRY_CLASS);
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "util/shared_memory_vector_wrapper.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
@ -24,22 +24,22 @@ class CompressedEdgeContainer;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl;
|
||||
template <storage::Ownership Ownership> class SegmentDataContainerImpl;
|
||||
}
|
||||
|
||||
namespace io
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership>
|
||||
template <storage::Ownership Ownership>
|
||||
inline void read(const boost::filesystem::path &path,
|
||||
detail::SegmentDataContainerImpl<Ownership> &segment_data);
|
||||
template <osrm::storage::Ownership Ownership>
|
||||
template <storage::Ownership Ownership>
|
||||
inline void write(const boost::filesystem::path &path,
|
||||
const detail::SegmentDataContainerImpl<Ownership> &segment_data);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl
|
||||
template <storage::Ownership Ownership> class SegmentDataContainerImpl
|
||||
{
|
||||
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
|
||||
|
||||
@ -207,8 +207,8 @@ template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl
|
||||
};
|
||||
}
|
||||
|
||||
using SegmentDataView = detail::SegmentDataContainerImpl<osrm::storage::Ownership::View>;
|
||||
using SegmentDataContainer = detail::SegmentDataContainerImpl<osrm::storage::Ownership::Container>;
|
||||
using SegmentDataView = detail::SegmentDataContainerImpl<storage::Ownership::View>;
|
||||
using SegmentDataContainer = detail::SegmentDataContainerImpl<storage::Ownership::Container>;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "storage/io.hpp"
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
@ -27,23 +27,23 @@ namespace partition
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership> class CellStorageImpl;
|
||||
template <storage::Ownership Ownership> class CellStorageImpl;
|
||||
}
|
||||
using CellStorage = detail::CellStorageImpl<osrm::storage::Ownership::Container>;
|
||||
using CellStorageView = detail::CellStorageImpl<osrm::storage::Ownership::View>;
|
||||
using CellStorage = detail::CellStorageImpl<storage::Ownership::Container>;
|
||||
using CellStorageView = detail::CellStorageImpl<storage::Ownership::View>;
|
||||
|
||||
namespace io
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership>
|
||||
template <storage::Ownership Ownership>
|
||||
inline void read(const boost::filesystem::path &path, detail::CellStorageImpl<Ownership> &storage);
|
||||
template <osrm::storage::Ownership Ownership>
|
||||
template <storage::Ownership Ownership>
|
||||
inline void write(const boost::filesystem::path &path,
|
||||
const detail::CellStorageImpl<Ownership> &storage);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership> class CellStorageImpl
|
||||
template <storage::Ownership Ownership> class CellStorageImpl
|
||||
{
|
||||
public:
|
||||
using WeightOffset = std::uint32_t;
|
||||
@ -186,7 +186,7 @@ template <osrm::storage::Ownership Ownership> class CellStorageImpl
|
||||
CellStorageImpl() {}
|
||||
|
||||
template <typename GraphT,
|
||||
typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||
typename = std::enable_if<Ownership == storage::Ownership::Container>>
|
||||
CellStorageImpl(const partition::MultiLevelPartition &partition, const GraphT &base_graph)
|
||||
{
|
||||
// pre-allocate storge for CellData so we can have random access to it by cell id
|
||||
@ -315,7 +315,7 @@ template <osrm::storage::Ownership Ownership> class CellStorageImpl
|
||||
weights.resize(weight_offset + 1, INVALID_EDGE_WEIGHT);
|
||||
}
|
||||
|
||||
template <typename = std::enable_if<Ownership == osrm::storage::Ownership::View>>
|
||||
template <typename = std::enable_if<Ownership == storage::Ownership::View>>
|
||||
CellStorageImpl(Vector<EdgeWeight> weights_,
|
||||
Vector<NodeID> source_boundary_,
|
||||
Vector<NodeID> destination_boundary_,
|
||||
@ -340,7 +340,7 @@ template <osrm::storage::Ownership Ownership> class CellStorageImpl
|
||||
destination_boundary.empty() ? nullptr : destination_boundary.data()};
|
||||
}
|
||||
|
||||
template <typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||
template <typename = std::enable_if<Ownership == storage::Ownership::Container>>
|
||||
Cell GetCell(LevelID level, CellID id)
|
||||
{
|
||||
const auto level_index = LevelIDToIndex(level);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "partition/multi_level_partition.hpp"
|
||||
|
||||
#include "storage/io.hpp"
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@ -16,7 +16,7 @@ namespace partition
|
||||
namespace io
|
||||
{
|
||||
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
inline void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, Ownership> &graph)
|
||||
{
|
||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
||||
@ -27,7 +27,7 @@ inline void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT,
|
||||
reader.DeserializeVector(graph.edge_to_level);
|
||||
}
|
||||
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
inline void write(const boost::filesystem::path &path,
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "partition/multi_level_partition.hpp"
|
||||
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include "util/static_graph.hpp"
|
||||
|
||||
@ -16,18 +16,18 @@ namespace osrm
|
||||
{
|
||||
namespace partition
|
||||
{
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership> class MultiLevelGraph;
|
||||
template <typename EdgeDataT, storage::Ownership Ownership> class MultiLevelGraph;
|
||||
|
||||
namespace io
|
||||
{
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
void write(const boost::filesystem::path &path, const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
}
|
||||
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
template <typename EdgeDataT, storage::Ownership Ownership>
|
||||
class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
|
||||
{
|
||||
private:
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "storage/io.hpp"
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@ -26,16 +26,16 @@ namespace partition
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl;
|
||||
template <storage::Ownership Ownership> class MultiLevelPartitionImpl;
|
||||
}
|
||||
using MultiLevelPartition = detail::MultiLevelPartitionImpl<osrm::storage::Ownership::Container>;
|
||||
using MultiLevelPartitionView = detail::MultiLevelPartitionImpl<osrm::storage::Ownership::View>;
|
||||
using MultiLevelPartition = detail::MultiLevelPartitionImpl<storage::Ownership::Container>;
|
||||
using MultiLevelPartitionView = detail::MultiLevelPartitionImpl<storage::Ownership::View>;
|
||||
|
||||
namespace io
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership>
|
||||
template <storage::Ownership Ownership>
|
||||
void read(const boost::filesystem::path &file, detail::MultiLevelPartitionImpl<Ownership> &mlp);
|
||||
template <osrm::storage::Ownership Ownership>
|
||||
template <storage::Ownership Ownership>
|
||||
void write(const boost::filesystem::path &file,
|
||||
const detail::MultiLevelPartitionImpl<Ownership> &mlp);
|
||||
}
|
||||
@ -43,7 +43,7 @@ void write(const boost::filesystem::path &file,
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl final
|
||||
template <storage::Ownership Ownership> class MultiLevelPartitionImpl final
|
||||
{
|
||||
// we will support at most 16 levels
|
||||
static const constexpr std::uint8_t MAX_NUM_LEVEL = 16;
|
||||
@ -68,7 +68,7 @@ template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl fina
|
||||
// cell_sizes is index by level (starting at 0, the base graph).
|
||||
// However level 0 always needs to have cell size 1, since it is the
|
||||
// basegraph.
|
||||
template <typename = typename std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||
template <typename = typename std::enable_if<Ownership == storage::Ownership::Container>>
|
||||
MultiLevelPartitionImpl(const std::vector<std::vector<CellID>> &partitions,
|
||||
const std::vector<std::uint32_t> &lidx_to_num_cells)
|
||||
: level_data(MakeLevelData(lidx_to_num_cells))
|
||||
@ -76,7 +76,7 @@ template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl fina
|
||||
InitializePartitionIDs(partitions);
|
||||
}
|
||||
|
||||
template <typename = typename std::enable_if<Ownership == osrm::storage::Ownership::View>>
|
||||
template <typename = typename std::enable_if<Ownership == storage::Ownership::View>>
|
||||
MultiLevelPartitionImpl(LevelData level_data,
|
||||
Vector<PartitionID> partition_,
|
||||
Vector<CellID> cell_to_children_)
|
||||
|
@ -25,17 +25,13 @@
|
||||
#include <exception>
|
||||
#include <thread>
|
||||
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
{
|
||||
|
||||
enum class Ownership
|
||||
{
|
||||
Container,
|
||||
View
|
||||
};
|
||||
|
||||
struct OSRMLockFile
|
||||
{
|
||||
boost::filesystem::path operator()()
|
||||
|
17
include/storage/shared_memory_ownership.hpp
Normal file
17
include/storage/shared_memory_ownership.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef SHARED_MEMORY_OWNERSHIP_HPP
|
||||
#define SHARED_MEMORY_OWNERSHIP_HPP
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
{
|
||||
|
||||
enum class Ownership
|
||||
{
|
||||
Container,
|
||||
View
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SHARED_MEMORY_OWNERSHIP_HPP
|
@ -4,7 +4,7 @@
|
||||
#include "util/shared_memory_vector_wrapper.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
@ -22,7 +22,7 @@ namespace util
|
||||
* NOTE: this type is templated for future use, but will require a slight refactor to
|
||||
* configure BITSIZE and ELEMSIZE
|
||||
*/
|
||||
template <typename T, osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
|
||||
template <typename T, storage::Ownership Ownership = storage::Ownership::Container>
|
||||
class PackedVector
|
||||
{
|
||||
static const constexpr std::size_t BITSIZE = 33;
|
||||
@ -123,20 +123,20 @@ class PackedVector
|
||||
|
||||
std::size_t size() const { return num_elements; }
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
void reserve(typename std::enable_if<!enabled, std::size_t>::type capacity)
|
||||
{
|
||||
vec.reserve(elements_to_blocks(capacity));
|
||||
}
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
void reset(typename std::enable_if<enabled, std::uint64_t>::type *ptr,
|
||||
typename std::enable_if<enabled, std::size_t>::type size)
|
||||
{
|
||||
vec.reset(ptr, size);
|
||||
}
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
void set_number_of_entries(typename std::enable_if<enabled, std::size_t>::type count)
|
||||
{
|
||||
num_elements = count;
|
||||
@ -154,38 +154,38 @@ class PackedVector
|
||||
|
||||
signed cursor = -1;
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
void replace_last_elem(typename std::enable_if<enabled, std::uint64_t>::type last_elem)
|
||||
{
|
||||
vec[cursor] = last_elem;
|
||||
}
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
void replace_last_elem(typename std::enable_if<!enabled, std::uint64_t>::type last_elem)
|
||||
{
|
||||
vec.back() = last_elem;
|
||||
}
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
void add_last_elem(typename std::enable_if<enabled, std::uint64_t>::type last_elem)
|
||||
{
|
||||
vec[cursor + 1] = last_elem;
|
||||
cursor++;
|
||||
}
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
void add_last_elem(typename std::enable_if<!enabled, std::uint64_t>::type last_elem)
|
||||
{
|
||||
vec.push_back(last_elem);
|
||||
}
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
std::uint64_t vec_back(typename std::enable_if<enabled>::type * = nullptr)
|
||||
{
|
||||
return vec[cursor];
|
||||
}
|
||||
|
||||
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
|
||||
template <bool enabled = (Ownership == storage::Ownership::View)>
|
||||
std::uint64_t vec_back(typename std::enable_if<!enabled>::type * = nullptr)
|
||||
{
|
||||
return vec.back();
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define RANGE_TABLE_HPP
|
||||
|
||||
#include "storage/io.hpp"
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
#include "util/integer_range.hpp"
|
||||
#include "util/shared_memory_vector_wrapper.hpp"
|
||||
|
||||
@ -19,14 +19,13 @@ namespace util
|
||||
* and otherwise the compiler gets confused.
|
||||
*/
|
||||
|
||||
template <unsigned BLOCK_SIZE = 16,
|
||||
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
|
||||
template <unsigned BLOCK_SIZE = 16, storage::Ownership Ownership = storage::Ownership::Container>
|
||||
class RangeTable;
|
||||
|
||||
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||
template <unsigned BLOCK_SIZE, storage::Ownership Ownership>
|
||||
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, Ownership> &table);
|
||||
|
||||
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||
template <unsigned BLOCK_SIZE, storage::Ownership Ownership>
|
||||
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, Ownership> &table);
|
||||
|
||||
/**
|
||||
@ -38,7 +37,7 @@ std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, Ownership> &ta
|
||||
* But each block consists of an absolute value and BLOCK_SIZE differential values.
|
||||
* So the effective block size is sizeof(unsigned) + BLOCK_SIZE.
|
||||
*/
|
||||
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership> class RangeTable
|
||||
template <unsigned BLOCK_SIZE, storage::Ownership Ownership> class RangeTable
|
||||
{
|
||||
public:
|
||||
using BlockT = std::array<unsigned char, BLOCK_SIZE>;
|
||||
@ -142,7 +141,7 @@ template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership> class RangeTa
|
||||
sum_lengths = lengths_prefix_sum;
|
||||
}
|
||||
|
||||
void Write(osrm::storage::io::FileWriter &filewriter)
|
||||
void Write(storage::io::FileWriter &filewriter)
|
||||
{
|
||||
unsigned number_of_blocks = diff_blocks.size();
|
||||
|
||||
@ -154,7 +153,7 @@ template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership> class RangeTa
|
||||
filewriter.WriteFrom(diff_blocks.data(), number_of_blocks);
|
||||
}
|
||||
|
||||
void Read(osrm::storage::io::FileReader &filereader)
|
||||
void Read(storage::io::FileReader &filereader)
|
||||
{
|
||||
unsigned number_of_blocks = filereader.ReadElementCount32();
|
||||
// read total length
|
||||
@ -215,7 +214,7 @@ template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership> class RangeTa
|
||||
unsigned sum_lengths;
|
||||
};
|
||||
|
||||
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||
template <unsigned BLOCK_SIZE, storage::Ownership Ownership>
|
||||
unsigned RangeTable<BLOCK_SIZE, Ownership>::PrefixSumAtIndex(int index, const BlockT &block) const
|
||||
{
|
||||
// this loop looks inefficent, but a modern compiler
|
||||
@ -229,7 +228,7 @@ unsigned RangeTable<BLOCK_SIZE, Ownership>::PrefixSumAtIndex(int index, const Bl
|
||||
return sum;
|
||||
}
|
||||
|
||||
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||
template <unsigned BLOCK_SIZE, storage::Ownership Ownership>
|
||||
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, Ownership> &table)
|
||||
{
|
||||
// write number of block
|
||||
@ -245,7 +244,7 @@ std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, Ownersh
|
||||
return out;
|
||||
}
|
||||
|
||||
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||
template <unsigned BLOCK_SIZE, storage::Ownership Ownership>
|
||||
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, Ownership> &table)
|
||||
{
|
||||
// read number of block
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "util/log.hpp"
|
||||
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
@ -172,9 +172,9 @@ template <typename DataT> void swap(vector_view<DataT> &lhs, vector_view<DataT>
|
||||
std::swap(lhs.m_size, rhs.m_size);
|
||||
}
|
||||
|
||||
template <typename DataT, osrm::storage::Ownership Ownership> struct ShM
|
||||
template <typename DataT, storage::Ownership Ownership> struct ShM
|
||||
{
|
||||
using vector = typename std::conditional<Ownership == osrm::storage::Ownership::View,
|
||||
using vector = typename std::conditional<Ownership == storage::Ownership::View,
|
||||
vector_view<DataT>,
|
||||
std::vector<DataT>>::type;
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "util/shared_memory_vector_wrapper.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
@ -99,8 +99,7 @@ EntryT edgeToEntry(const OtherEdge &from, std::false_type)
|
||||
|
||||
} // namespace static_graph_details
|
||||
|
||||
template <typename EdgeDataT,
|
||||
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
|
||||
template <typename EdgeDataT, storage::Ownership Ownership = storage::Ownership::Container>
|
||||
class StaticGraph
|
||||
{
|
||||
public:
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "osrm/coordinate.hpp"
|
||||
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@ -54,7 +54,7 @@ namespace util
|
||||
// are computed, this means the internal distance metric doesn not represent meters!
|
||||
template <class EdgeDataT,
|
||||
class CoordinateListT = std::vector<Coordinate>,
|
||||
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container,
|
||||
storage::Ownership Ownership = storage::Ownership::Container,
|
||||
std::uint32_t BRANCHING_FACTOR = 128,
|
||||
std::uint32_t LEAF_PAGE_SIZE = 4096>
|
||||
class StaticRTree
|
||||
@ -159,7 +159,7 @@ class StaticRTree
|
||||
|
||||
boost::iostreams::mapped_file_source m_leaves_region;
|
||||
// read-only view of leaves
|
||||
typename ShM<const LeafNode, osrm::storage::Ownership::View>::vector m_leaves;
|
||||
typename ShM<const LeafNode, storage::Ownership::View>::vector m_leaves;
|
||||
|
||||
public:
|
||||
StaticRTree(const StaticRTree &) = delete;
|
||||
|
@ -29,13 +29,13 @@ constexpr int32_t WORLD_MAX_LON = 180 * COORDINATE_PRECISION;
|
||||
using RTreeLeaf = extractor::EdgeBasedNode;
|
||||
using BenchStaticRTree =
|
||||
util::StaticRTree<RTreeLeaf,
|
||||
util::ShM<util::Coordinate, osrm::storage::Ownership::Container>::vector,
|
||||
osrm::storage::Ownership::Container>;
|
||||
util::ShM<util::Coordinate, storage::Ownership::Container>::vector,
|
||||
storage::Ownership::Container>;
|
||||
|
||||
std::vector<util::Coordinate> loadCoordinates(const boost::filesystem::path &nodes_file)
|
||||
{
|
||||
osrm::storage::io::FileReader nodes_path_file_reader(
|
||||
nodes_file, osrm::storage::io::FileReader::HasNoFingerprint);
|
||||
storage::io::FileReader nodes_path_file_reader(nodes_file,
|
||||
storage::io::FileReader::HasNoFingerprint);
|
||||
|
||||
extractor::QueryNode current_node;
|
||||
unsigned coordinate_count = nodes_path_file_reader.ReadElementCount32();
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "partition/io.hpp"
|
||||
#include "partition/multi_level_partition.hpp"
|
||||
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
|
||||
#include "updater/updater.hpp"
|
||||
|
||||
@ -85,7 +85,7 @@ auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config,
|
||||
auto tidied =
|
||||
partition::prepareEdgesForUsageInGraph<StaticEdgeBasedGraphEdge>(std::move(directed));
|
||||
auto edge_based_graph = std::make_unique<
|
||||
partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::Container>>(
|
||||
partition::MultiLevelGraph<EdgeBasedGraphEdgeData, storage::Ownership::Container>>(
|
||||
mlp, num_nodes, std::move(tidied));
|
||||
|
||||
util::Log() << "Loaded edge based graph for mapping partition ids: "
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "storage/serialization.hpp"
|
||||
#include "storage/shared_datatype.hpp"
|
||||
#include "storage/shared_memory.hpp"
|
||||
#include "storage/shared_memory_ownership.hpp"
|
||||
#include "storage/shared_monitor.hpp"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
#include "util/coordinate.hpp"
|
||||
@ -57,7 +58,7 @@ namespace storage
|
||||
using RTreeLeaf = engine::datafacade::BaseDataFacade::RTreeLeaf;
|
||||
using RTreeNode = util::StaticRTree<RTreeLeaf,
|
||||
util::vector_view<util::Coordinate>,
|
||||
osrm::storage::Ownership::View>::TreeNode;
|
||||
storage::Ownership::View>::TreeNode;
|
||||
using QueryGraph = util::StaticGraph<contractor::QueryEdge::EdgeData>;
|
||||
using EdgeBasedGraph = util::StaticGraph<extractor::EdgeBasedEdge::EdgeData>;
|
||||
|
||||
@ -365,14 +366,13 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
intersection_file.Skip<std::uint32_t>(1); // sum_lengths
|
||||
|
||||
layout.SetBlockSize<unsigned>(DataLayout::BEARING_OFFSETS, bearing_blocks);
|
||||
layout.SetBlockSize<typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
|
||||
layout.SetBlockSize<typename util::RangeTable<16, storage::Ownership::View>::BlockT>(
|
||||
DataLayout::BEARING_BLOCKS, bearing_blocks);
|
||||
|
||||
// No need to read the data
|
||||
intersection_file.Skip<unsigned>(bearing_blocks);
|
||||
intersection_file
|
||||
.Skip<typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
|
||||
bearing_blocks);
|
||||
intersection_file.Skip<typename util::RangeTable<16, storage::Ownership::View>::BlockT>(
|
||||
bearing_blocks);
|
||||
|
||||
const auto num_bearings = intersection_file.ReadElementCount64();
|
||||
|
||||
@ -697,7 +697,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
layout.GetBlockPtr<util::Coordinate, true>(memory_ptr, DataLayout::COORDINATE_LIST);
|
||||
const auto osmnodeid_ptr =
|
||||
layout.GetBlockPtr<std::uint64_t, true>(memory_ptr, DataLayout::OSM_NODE_ID_LIST);
|
||||
util::PackedVector<OSMNodeID, osrm::storage::Ownership::View> osmnodeid_list;
|
||||
util::PackedVector<OSMNodeID, storage::Ownership::View> osmnodeid_list;
|
||||
|
||||
osmnodeid_list.reset(osmnodeid_ptr, layout.num_entries[DataLayout::OSM_NODE_ID_LIST]);
|
||||
|
||||
@ -806,7 +806,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
intersection_file.Skip<std::uint32_t>(1); // sum_lengths
|
||||
|
||||
std::vector<unsigned> bearing_offsets_data(bearing_blocks);
|
||||
std::vector<typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>
|
||||
std::vector<typename util::RangeTable<16, storage::Ownership::View>::BlockT>
|
||||
bearing_blocks_data(bearing_blocks);
|
||||
|
||||
intersection_file.ReadInto(bearing_offsets_data.data(), bearing_blocks);
|
||||
@ -846,9 +846,9 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
|
||||
if (layout.GetBlockSize(DataLayout::BEARING_BLOCKS) > 0)
|
||||
{
|
||||
const auto bearing_blocks_ptr = layout.GetBlockPtr<
|
||||
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT,
|
||||
true>(memory_ptr, DataLayout::BEARING_BLOCKS);
|
||||
const auto bearing_blocks_ptr =
|
||||
layout.GetBlockPtr<typename util::RangeTable<16, storage::Ownership::View>::BlockT,
|
||||
true>(memory_ptr, DataLayout::BEARING_BLOCKS);
|
||||
BOOST_ASSERT(
|
||||
static_cast<std::size_t>(layout.GetBlockSize(DataLayout::BEARING_BLOCKS)) >=
|
||||
std::distance(bearing_blocks_data.begin(), bearing_blocks_data.end()) *
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
using namespace osrm;
|
||||
|
||||
void removeLocks() { osrm::storage::SharedMonitor<osrm::storage::SharedDataTimestamp>::remove(); }
|
||||
void removeLocks() { storage::SharedMonitor<storage::SharedDataTimestamp>::remove(); }
|
||||
|
||||
void deleteRegion(const storage::SharedDataType region)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ void checkWeightsConsistency(
|
||||
const UpdaterConfig &config,
|
||||
const std::vector<osrm::extractor::EdgeBasedEdge> &edge_based_edge_list)
|
||||
{
|
||||
using Reader = osrm::storage::io::FileReader;
|
||||
using Reader = storage::io::FileReader;
|
||||
using OriginalEdgeData = osrm::extractor::OriginalEdgeData;
|
||||
|
||||
extractor::SegmentDataContainer segment_data;
|
||||
|
Loading…
Reference in New Issue
Block a user