Renaming of MemorySetting > Ownership

This commit is contained in:
Pepijn Schoen 2017-04-03 09:51:41 +02:00 committed by Patrick Niklaus
parent d6e56c38d5
commit 16665aeb00
21 changed files with 126 additions and 126 deletions

View File

@ -20,19 +20,19 @@ using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData;
struct MultiLevelEdgeBasedGraph
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::MemorySetting::InternalMemory>
osrm::storage::Ownership::Container>
{
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::MemorySetting::InternalMemory>;
osrm::storage::Ownership::Container>;
using Base::Base;
};
struct MultiLevelEdgeBasedGraphView
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::MemorySetting::SharedMemory>
osrm::storage::Ownership::View>
{
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::MemorySetting::SharedMemory>;
osrm::storage::Ownership::View>;
using Base::Base;
};

View File

@ -62,7 +62,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH>
: public datafacade::AlgorithmDataFacade<algorithm::CH>
{
private:
using QueryGraph = util::StaticGraph<EdgeData, osrm::storage::MemorySetting::SharedMemory>;
using QueryGraph = util::StaticGraph<EdgeData, osrm::storage::Ownership::View>;
using GraphNode = QueryGraph::NodeArrayEntry;
using GraphEdge = QueryGraph::EdgeArrayEntry;
@ -200,11 +200,11 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
{
private:
using super = BaseDataFacade;
using IndexBlock = util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT;
using IndexBlock = util::RangeTable<16, osrm::storage::Ownership::View>::BlockT;
using RTreeLeaf = super::RTreeLeaf;
using SharedRTree = util::StaticRTree<RTreeLeaf,
util::vector_view<util::Coordinate>,
osrm::storage::MemorySetting::SharedMemory>;
osrm::storage::Ownership::View>;
using SharedGeospatialQuery = GeospatialQuery<SharedRTree, BaseDataFacade>;
using RTreeNode = SharedRTree::TreeNode;
@ -214,7 +214,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
unsigned m_check_sum;
util::vector_view<util::Coordinate> m_coordinate_list;
util::PackedVector<OSMNodeID, osrm::storage::MemorySetting::SharedMemory> m_osmnodeid_list;
util::PackedVector<OSMNodeID, osrm::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 +251,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::MemorySetting::SharedMemory>>
std::shared_ptr<util::RangeTable<16, osrm::storage::Ownership::View>>
m_bearing_ranges_table;
util::vector_view<DiscreteBearing> m_bearing_values_table;
@ -505,7 +505,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
blocks_ptr, data_layout.num_entries[storage::DataLayout::BEARING_BLOCKS]);
m_bearing_ranges_table =
std::make_unique<util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>>(
std::make_unique<util::RangeTable<16, osrm::storage::Ownership::View>>(
bearing_offsets,
bearing_blocks,
static_cast<unsigned>(m_bearing_values_table.size()));

View File

@ -24,24 +24,24 @@ class CompressedEdgeContainer;
namespace detail
{
template <osrm::storage::MemorySetting MemorySetting> class SegmentDataContainerImpl;
template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl;
}
namespace io
{
template <osrm::storage::MemorySetting MemorySetting>
template <osrm::storage::Ownership Ownership>
inline void read(const boost::filesystem::path &path,
detail::SegmentDataContainerImpl<MemorySetting> &segment_data);
template <osrm::storage::MemorySetting MemorySetting>
detail::SegmentDataContainerImpl<Ownership> &segment_data);
template <osrm::storage::Ownership Ownership>
inline void write(const boost::filesystem::path &path,
const detail::SegmentDataContainerImpl<MemorySetting> &segment_data);
const detail::SegmentDataContainerImpl<Ownership> &segment_data);
}
namespace detail
{
template <osrm::storage::MemorySetting MemorySetting> class SegmentDataContainerImpl
template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl
{
template <typename T> using Vector = typename util::ShM<T, MemorySetting>::vector;
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
friend CompressedEdgeContainer;
@ -191,11 +191,11 @@ template <osrm::storage::MemorySetting MemorySetting> class SegmentDataContainer
auto GetNumberOfSegments() const { return fwd_weights.size(); }
friend void
io::read<MemorySetting>(const boost::filesystem::path &path,
detail::SegmentDataContainerImpl<MemorySetting> &segment_data);
io::read<Ownership>(const boost::filesystem::path &path,
detail::SegmentDataContainerImpl<Ownership> &segment_data);
friend void
io::write<MemorySetting>(const boost::filesystem::path &path,
const detail::SegmentDataContainerImpl<MemorySetting> &segment_data);
io::write<Ownership>(const boost::filesystem::path &path,
const detail::SegmentDataContainerImpl<Ownership> &segment_data);
private:
Vector<std::uint32_t> index;
@ -209,9 +209,9 @@ template <osrm::storage::MemorySetting MemorySetting> class SegmentDataContainer
}
using SegmentDataView =
detail::SegmentDataContainerImpl<osrm::storage::MemorySetting::SharedMemory>;
detail::SegmentDataContainerImpl<osrm::storage::Ownership::View>;
using SegmentDataContainer =
detail::SegmentDataContainerImpl<osrm::storage::MemorySetting::InternalMemory>;
detail::SegmentDataContainerImpl<osrm::storage::Ownership::Container>;
}
}

View File

@ -27,24 +27,24 @@ namespace partition
{
namespace detail
{
template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl;
template <osrm::storage::Ownership Ownership> class CellStorageImpl;
}
using CellStorage = detail::CellStorageImpl<osrm::storage::MemorySetting::InternalMemory>;
using CellStorageView = detail::CellStorageImpl<osrm::storage::MemorySetting::SharedMemory>;
using CellStorage = detail::CellStorageImpl<osrm::storage::Ownership::Container>;
using CellStorageView = detail::CellStorageImpl<osrm::storage::Ownership::View>;
namespace io
{
template <osrm::storage::MemorySetting MemorySetting>
template <osrm::storage::Ownership Ownership>
inline void read(const boost::filesystem::path &path,
detail::CellStorageImpl<MemorySetting> &storage);
template <osrm::storage::MemorySetting MemorySetting>
detail::CellStorageImpl<Ownership> &storage);
template <osrm::storage::Ownership Ownership>
inline void write(const boost::filesystem::path &path,
const detail::CellStorageImpl<MemorySetting> &storage);
const detail::CellStorageImpl<Ownership> &storage);
}
namespace detail
{
template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
template <osrm::storage::Ownership Ownership> class CellStorageImpl
{
public:
using WeightOffset = std::uint32_t;
@ -66,7 +66,7 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
};
private:
template <typename T> using Vector = typename util::ShM<T, MemorySetting>::vector;
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
// Implementation of the cell view. We need a template parameter here
// because we need to derive a read-only and read-write view from this.
@ -188,7 +188,7 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
template <
typename GraphT,
typename = std::enable_if<MemorySetting == osrm::storage::MemorySetting::InternalMemory>>
typename = std::enable_if<Ownership == osrm::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
@ -318,7 +318,7 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
}
template <
typename = std::enable_if<MemorySetting == osrm::storage::MemorySetting::SharedMemory>>
typename = std::enable_if<Ownership == osrm::storage::Ownership::View>>
CellStorageImpl(Vector<EdgeWeight> weights_,
Vector<NodeID> source_boundary_,
Vector<NodeID> destination_boundary_,
@ -344,7 +344,7 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
}
template <
typename = std::enable_if<MemorySetting == osrm::storage::MemorySetting::InternalMemory>>
typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
Cell GetCell(LevelID level, CellID id)
{
const auto level_index = LevelIDToIndex(level);
@ -356,10 +356,10 @@ template <osrm::storage::MemorySetting MemorySetting> class CellStorageImpl
cells[cell_index], weights.data(), source_boundary.data(), destination_boundary.data()};
}
friend void io::read<MemorySetting>(const boost::filesystem::path &path,
detail::CellStorageImpl<MemorySetting> &storage);
friend void io::write<MemorySetting>(const boost::filesystem::path &path,
const detail::CellStorageImpl<MemorySetting> &storage);
friend void io::read<Ownership>(const boost::filesystem::path &path,
detail::CellStorageImpl<Ownership> &storage);
friend void io::write<Ownership>(const boost::filesystem::path &path,
const detail::CellStorageImpl<Ownership> &storage);
private:
Vector<EdgeWeight> weights;

View File

@ -16,9 +16,9 @@ namespace partition
namespace io
{
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
inline void read(const boost::filesystem::path &path,
MultiLevelGraph<EdgeDataT, MemorySetting> &graph)
MultiLevelGraph<EdgeDataT, Ownership> &graph)
{
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
@ -28,9 +28,9 @@ inline void read(const boost::filesystem::path &path,
reader.DeserializeVector(graph.edge_to_level);
}
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
inline void write(const boost::filesystem::path &path,
const MultiLevelGraph<EdgeDataT, MemorySetting> &graph)
const MultiLevelGraph<EdgeDataT, Ownership> &graph)
{
const auto fingerprint = storage::io::FileWriter::GenerateFingerprint;
storage::io::FileWriter writer{path, fingerprint};

View File

@ -16,24 +16,24 @@ namespace osrm
{
namespace partition
{
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting> class MultiLevelGraph;
template <typename EdgeDataT, osrm::storage::Ownership Ownership> class MultiLevelGraph;
namespace io
{
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, MemorySetting> &graph);
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, Ownership> &graph);
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
void write(const boost::filesystem::path &path,
const MultiLevelGraph<EdgeDataT, MemorySetting> &graph);
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
}
template <typename EdgeDataT, osrm::storage::MemorySetting MemorySetting>
class MultiLevelGraph : public util::StaticGraph<EdgeDataT, MemorySetting>
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
{
private:
using SuperT = util::StaticGraph<EdgeDataT, MemorySetting>;
template <typename T> using Vector = typename util::ShM<T, MemorySetting>::vector;
using SuperT = util::StaticGraph<EdgeDataT, Ownership>;
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
public:
// We limit each node to have 255 edges
@ -192,11 +192,11 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, MemorySetting>
}
friend void
io::read<EdgeDataT, MemorySetting>(const boost::filesystem::path &path,
MultiLevelGraph<EdgeDataT, MemorySetting> &graph);
io::read<EdgeDataT, Ownership>(const boost::filesystem::path &path,
MultiLevelGraph<EdgeDataT, Ownership> &graph);
friend void
io::write<EdgeDataT, MemorySetting>(const boost::filesystem::path &path,
const MultiLevelGraph<EdgeDataT, MemorySetting> &graph);
io::write<EdgeDataT, Ownership>(const boost::filesystem::path &path,
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
Vector<EdgeOffset> node_to_edge_offset;
};

View File

@ -26,32 +26,32 @@ namespace partition
{
namespace detail
{
template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionImpl;
template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl;
}
using MultiLevelPartition =
detail::MultiLevelPartitionImpl<osrm::storage::MemorySetting::InternalMemory>;
detail::MultiLevelPartitionImpl<osrm::storage::Ownership::Container>;
using MultiLevelPartitionView =
detail::MultiLevelPartitionImpl<osrm::storage::MemorySetting::SharedMemory>;
detail::MultiLevelPartitionImpl<osrm::storage::Ownership::View>;
namespace io
{
template <osrm::storage::MemorySetting MemorySetting>
void read(const boost::filesystem::path &file, detail::MultiLevelPartitionImpl<MemorySetting> &mlp);
template <osrm::storage::MemorySetting MemorySetting>
template <osrm::storage::Ownership Ownership>
void read(const boost::filesystem::path &file, detail::MultiLevelPartitionImpl<Ownership> &mlp);
template <osrm::storage::Ownership Ownership>
void write(const boost::filesystem::path &file,
const detail::MultiLevelPartitionImpl<MemorySetting> &mlp);
const detail::MultiLevelPartitionImpl<Ownership> &mlp);
}
namespace detail
{
template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionImpl final
template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl final
{
// we will support at most 16 levels
static const constexpr std::uint8_t MAX_NUM_LEVEL = 16;
static const constexpr std::uint8_t NUM_PARTITION_BITS = sizeof(PartitionID) * CHAR_BIT;
template <typename T> using Vector = typename util::ShM<T, MemorySetting>::vector;
template <typename T> using Vector = typename util::ShM<T, Ownership>::vector;
public:
// Contains all data necessary to describe the level hierarchy
@ -70,8 +70,8 @@ template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionI
// 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<MemorySetting ==
osrm::storage::MemorySetting::InternalMemory>>
template <typename = typename std::enable_if<Ownership ==
osrm::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))
@ -79,8 +79,8 @@ template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionI
InitializePartitionIDs(partitions);
}
template <typename = typename std::enable_if<MemorySetting ==
osrm::storage::MemorySetting::SharedMemory>>
template <typename = typename std::enable_if<Ownership ==
osrm::storage::Ownership::View>>
MultiLevelPartitionImpl(LevelData level_data,
Vector<PartitionID> partition_,
Vector<CellID> cell_to_children_)
@ -138,9 +138,9 @@ template <osrm::storage::MemorySetting MemorySetting> class MultiLevelPartitionI
return cell_to_children[offset + cell + 1];
}
friend void io::read<MemorySetting>(const boost::filesystem::path &file,
friend void io::read<Ownership>(const boost::filesystem::path &file,
MultiLevelPartitionImpl &mlp);
friend void io::write<MemorySetting>(const boost::filesystem::path &file,
friend void io::write<Ownership>(const boost::filesystem::path &file,
const MultiLevelPartitionImpl &mlp);
private:

View File

@ -30,10 +30,10 @@ namespace osrm
namespace storage
{
enum class MemorySetting
enum class Ownership
{
SharedMemory,
InternalMemory
Container,
View
};
struct OSRMLockFile

View File

@ -23,7 +23,7 @@ namespace util
* configure BITSIZE and ELEMSIZE
*/
template <typename T,
osrm::storage::MemorySetting MemorySetting = osrm::storage::MemorySetting::InternalMemory>
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
class PackedVector
{
static const constexpr std::size_t BITSIZE = 33;
@ -124,20 +124,20 @@ class PackedVector
std::size_t size() const { return num_elements; }
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
void reserve(typename std::enable_if<!enabled, std::size_t>::type capacity)
{
vec.reserve(elements_to_blocks(capacity));
}
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::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 = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
void set_number_of_entries(typename std::enable_if<enabled, std::size_t>::type count)
{
num_elements = count;
@ -149,44 +149,44 @@ class PackedVector
}
private:
typename util::ShM<std::uint64_t, MemorySetting>::vector vec;
typename util::ShM<std::uint64_t, Ownership>::vector vec;
std::size_t num_elements = 0;
signed cursor = -1;
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::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 = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::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 = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::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 = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::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 = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
std::uint64_t vec_back(typename std::enable_if<enabled>::type * = nullptr)
{
return vec[cursor];
}
template <bool enabled = (MemorySetting == osrm::storage::MemorySetting::SharedMemory)>
template <bool enabled = (Ownership == osrm::storage::Ownership::View)>
std::uint64_t vec_back(typename std::enable_if<!enabled>::type * = nullptr)
{
return vec.back();

View File

@ -20,14 +20,14 @@ namespace util
*/
template <unsigned BLOCK_SIZE = 16,
osrm::storage::MemorySetting MemorySetting = osrm::storage::MemorySetting::InternalMemory>
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
class RangeTable;
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, MemorySetting> &table);
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, Ownership> &table);
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, MemorySetting> &table);
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, Ownership> &table);
/**
* Stores adjacent ranges in a compressed format.
@ -38,12 +38,12 @@ std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, MemorySetting>
* 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::MemorySetting MemorySetting> class RangeTable
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership> class RangeTable
{
public:
using BlockT = std::array<unsigned char, BLOCK_SIZE>;
using BlockContainerT = typename ShM<BlockT, MemorySetting>::vector;
using OffsetContainerT = typename ShM<unsigned, MemorySetting>::vector;
using BlockContainerT = typename ShM<BlockT, Ownership>::vector;
using OffsetContainerT = typename ShM<unsigned, Ownership>::vector;
using RangeT = range<unsigned>;
friend std::ostream &operator<<<>(std::ostream &out, const RangeTable &table);
@ -215,8 +215,8 @@ template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting> class
unsigned sum_lengths;
};
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
unsigned RangeTable<BLOCK_SIZE, MemorySetting>::PrefixSumAtIndex(int index,
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
unsigned RangeTable<BLOCK_SIZE, Ownership>::PrefixSumAtIndex(int index,
const BlockT &block) const
{
// this loop looks inefficent, but a modern compiler
@ -230,8 +230,8 @@ unsigned RangeTable<BLOCK_SIZE, MemorySetting>::PrefixSumAtIndex(int index,
return sum;
}
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, MemorySetting> &table)
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, Ownership> &table)
{
// write number of block
const unsigned number_of_blocks = table.diff_blocks.size();
@ -246,8 +246,8 @@ std::ostream &operator<<(std::ostream &out, const RangeTable<BLOCK_SIZE, MemoryS
return out;
}
template <unsigned BLOCK_SIZE, osrm::storage::MemorySetting MemorySetting>
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, MemorySetting> &table)
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
std::istream &operator>>(std::istream &in, RangeTable<BLOCK_SIZE, Ownership> &table)
{
// read number of block
unsigned number_of_blocks;

View File

@ -175,10 +175,10 @@ void swap(vector_view<DataT> &lhs, vector_view<DataT> &rhs) noexcept
std::swap(lhs.m_size, rhs.m_size);
}
template <typename DataT, osrm::storage::MemorySetting MemorySetting> struct ShM
template <typename DataT, osrm::storage::Ownership Ownership> struct ShM
{
using vector =
typename std::conditional<MemorySetting == osrm::storage::MemorySetting::SharedMemory,
typename std::conditional<Ownership == osrm::storage::Ownership::View,
vector_view<DataT>,
std::vector<DataT>>::type;
};

View File

@ -100,7 +100,7 @@ EntryT edgeToEntry(const OtherEdge &from, std::false_type)
} // namespace static_graph_details
template <typename EdgeDataT,
osrm::storage::MemorySetting MemorySetting = osrm::storage::MemorySetting::InternalMemory>
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
class StaticGraph
{
public:
@ -126,8 +126,8 @@ class StaticGraph
InitializeFromSortedEdgeRange(nodes, edges.begin(), edges.end());
}
StaticGraph(typename util::ShM<NodeArrayEntry, MemorySetting>::vector node_array_,
typename util::ShM<EdgeArrayEntry, MemorySetting>::vector edge_array_)
StaticGraph(typename util::ShM<NodeArrayEntry, Ownership>::vector node_array_,
typename util::ShM<EdgeArrayEntry, Ownership>::vector edge_array_)
: node_array(std::move(node_array_)), edge_array(std::move(edge_array_))
{
BOOST_ASSERT(!node_array.empty());
@ -262,8 +262,8 @@ class StaticGraph
NodeIterator number_of_nodes;
EdgeIterator number_of_edges;
typename ShM<NodeArrayEntry, MemorySetting>::vector node_array;
typename ShM<EdgeArrayEntry, MemorySetting>::vector edge_array;
typename ShM<NodeArrayEntry, Ownership>::vector node_array;
typename ShM<EdgeArrayEntry, Ownership>::vector edge_array;
};
} // namespace util

View File

@ -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::MemorySetting MemorySetting = osrm::storage::MemorySetting::InternalMemory,
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container,
std::uint32_t BRANCHING_FACTOR = 128,
std::uint32_t LEAF_PAGE_SIZE = 4096>
class StaticRTree
@ -154,12 +154,12 @@ class StaticRTree
Coordinate fixed_projected_coordinate;
};
typename ShM<TreeNode, MemorySetting>::vector m_search_tree;
typename ShM<TreeNode, Ownership>::vector m_search_tree;
const CoordinateListT &m_coordinate_list;
boost::iostreams::mapped_file_source m_leaves_region;
// read-only view of leaves
typename ShM<const LeafNode, osrm::storage::MemorySetting::SharedMemory>::vector m_leaves;
typename ShM<const LeafNode, osrm::storage::Ownership::View>::vector m_leaves;
public:
StaticRTree(const StaticRTree &) = delete;

View File

@ -29,8 +29,8 @@ constexpr int32_t WORLD_MAX_LON = 180 * COORDINATE_PRECISION;
using RTreeLeaf = extractor::EdgeBasedNode;
using BenchStaticRTree = util::StaticRTree<
RTreeLeaf,
util::ShM<util::Coordinate, osrm::storage::MemorySetting::InternalMemory>::vector,
osrm::storage::MemorySetting::InternalMemory>;
util::ShM<util::Coordinate, osrm::storage::Ownership::Container>::vector,
osrm::storage::Ownership::Container>;
std::vector<util::Coordinate> loadCoordinates(const boost::filesystem::path &nodes_file)
{

View File

@ -86,7 +86,7 @@ auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config,
partition::prepareEdgesForUsageInGraph<StaticEdgeBasedGraphEdge>(std::move(directed));
auto edge_based_graph =
std::make_unique<partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::MemorySetting::InternalMemory>>(
osrm::storage::Ownership::Container>>(
mlp, num_nodes, std::move(tidied));
util::Log() << "Loaded edge based graph for mapping partition ids: "

View File

@ -57,7 +57,7 @@ namespace storage
using RTreeLeaf = engine::datafacade::BaseDataFacade::RTreeLeaf;
using RTreeNode = util::StaticRTree<RTreeLeaf,
util::vector_view<util::Coordinate>,
osrm::storage::MemorySetting::SharedMemory>::TreeNode;
osrm::storage::Ownership::View>::TreeNode;
using QueryGraph = util::StaticGraph<contractor::QueryEdge::EdgeData>;
using EdgeBasedGraph = util::StaticGraph<extractor::EdgeBasedEdge::EdgeData>;
@ -366,13 +366,13 @@ void Storage::PopulateLayout(DataLayout &layout)
layout.SetBlockSize<unsigned>(DataLayout::BEARING_OFFSETS, bearing_blocks);
layout.SetBlockSize<
typename util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT>(
typename util::RangeTable<16, osrm::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::MemorySetting::SharedMemory>::BlockT>(
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
bearing_blocks);
const auto num_bearings = intersection_file.ReadElementCount64();
@ -698,7 +698,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::MemorySetting::SharedMemory> osmnodeid_list;
util::PackedVector<OSMNodeID, osrm::storage::Ownership::View> osmnodeid_list;
osmnodeid_list.reset(osmnodeid_ptr, layout.num_entries[DataLayout::OSM_NODE_ID_LIST]);
@ -808,7 +808,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
std::vector<unsigned> bearing_offsets_data(bearing_blocks);
std::vector<
typename util::RangeTable<16, osrm::storage::MemorySetting::SharedMemory>::BlockT>
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>
bearing_blocks_data(bearing_blocks);
intersection_file.ReadInto(bearing_offsets_data.data(), bearing_blocks);
@ -849,7 +849,7 @@ 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::MemorySetting::SharedMemory>::BlockT,
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT,
true>(memory_ptr, DataLayout::BEARING_BLOCKS);
BOOST_ASSERT(
static_cast<std::size_t>(layout.GetBlockSize(DataLayout::BEARING_BLOCKS)) >=

View File

@ -38,7 +38,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
edges.push_back(Edge{m.target, m.start, m.weight, false, true});
}
std::sort(edges.begin(), edges.end());
return partition::MultiLevelGraph<EdgeData, osrm::storage::MemorySetting::InternalMemory>(
return partition::MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
mlp, max_id + 1, edges);
}
}

View File

@ -38,7 +38,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
edges.push_back(Edge{m.target, m.source, false, true});
}
std::sort(edges.begin(), edges.end());
return MultiLevelGraph<EdgeData, osrm::storage::MemorySetting::InternalMemory>(
return MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
mlp, max_id + 1, edges);
}
}

View File

@ -12,7 +12,7 @@ using namespace osrm::util;
// Verify that the packed vector behaves as expected
BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test)
{
PackedVector<OSMNodeID, osrm::storage::MemorySetting::InternalMemory> packed_ids;
PackedVector<OSMNodeID, osrm::storage::Ownership::Container> packed_ids;
std::vector<OSMNodeID> original_ids;
const constexpr std::size_t num_test_cases = 399;
@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test)
BOOST_AUTO_TEST_CASE(packed_vector_capacity_test)
{
PackedVector<OSMNodeID, osrm::storage::MemorySetting::InternalMemory> packed_vec;
PackedVector<OSMNodeID, osrm::storage::Ownership::Container> packed_vec;
const std::size_t original_size = packed_vec.capacity();
std::vector<OSMNodeID> dummy_vec;

View File

@ -13,7 +13,7 @@ using namespace osrm;
using namespace osrm::util;
constexpr unsigned BLOCK_SIZE = 16;
typedef RangeTable<BLOCK_SIZE, osrm::storage::MemorySetting::InternalMemory> TestRangeTable;
typedef RangeTable<BLOCK_SIZE, osrm::storage::Ownership::Container> TestRangeTable;
void ConstructionTest(stxxl::vector<unsigned> lengths, std::vector<unsigned> offsets)
{

View File

@ -42,12 +42,12 @@ constexpr uint32_t TEST_LEAF_NODE_SIZE = 64;
using TestData = extractor::EdgeBasedNode;
using TestStaticRTree = StaticRTree<TestData,
std::vector<Coordinate>,
osrm::storage::MemorySetting::InternalMemory,
osrm::storage::Ownership::Container,
TEST_BRANCHING_FACTOR,
TEST_LEAF_NODE_SIZE>;
using MiniStaticRTree = StaticRTree<TestData,
std::vector<Coordinate>,
osrm::storage::MemorySetting::InternalMemory,
osrm::storage::Ownership::Container,
2,
128>;
@ -279,7 +279,7 @@ BOOST_FIXTURE_TEST_CASE(construct_tiny, TestRandomGraphFixture_10_30)
{
using TinyTestTree = StaticRTree<TestData,
std::vector<Coordinate>,
osrm::storage::MemorySetting::InternalMemory,
osrm::storage::Ownership::Container,
2,
64>;
construction_test<TinyTestTree>("test_tiny", this);