Remove osrm namespace indication where possible, wrap out shared_memory_ownership

This commit is contained in:
Pepijn Schoen
2017-04-04 09:52:00 +02:00
committed by Patrick Niklaus
parent 091a495632
commit 789311abd6
19 changed files with 114 additions and 108 deletions
+10 -10
View File
@@ -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);
+3 -3
View File
@@ -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)
{
+5 -5
View File
@@ -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:
+9 -9
View File
@@ -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_)