moved basic type definitions to osrm namespace

This commit is contained in:
Michael Krasnyk
2017-03-07 13:57:55 +01:00
committed by Patrick Niklaus
parent faaf82c837
commit ec3cda32fa
9 changed files with 46 additions and 52 deletions
+3 -6
View File
@@ -20,10 +20,7 @@ class CellCustomizer
CellCustomizer(const partition::MultiLevelPartition &partition) : partition(partition) {}
template <typename GraphT>
void Customize(const GraphT &graph,
partition::CellStorage &cells,
partition::LevelID level,
partition::CellID id)
void Customize(const GraphT &graph, partition::CellStorage &cells, LevelID level, CellID id)
{
auto cell = cells.GetCell(level, id);
auto destinations = cell.GetDestinationNodes();
@@ -87,8 +84,8 @@ class CellCustomizer
void RelaxNode(const GraphT &graph,
const partition::CellStorage &cells,
Heap &heap,
partition::LevelID level,
partition::CellID id,
LevelID level,
CellID id,
NodeID node,
EdgeWeight weight) const
{
@@ -1110,19 +1110,19 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD>
*data_layout.GetBlockPtr<partition::MultiLevelPartitionView::LevelData>(
memory_block, storage::DataLayout::MLD_LEVEL_DATA);
auto mld_partition_ptr = data_layout.GetBlockPtr<partition::PartitionID>(
auto mld_partition_ptr = data_layout.GetBlockPtr<PartitionID>(
memory_block, storage::DataLayout::MLD_PARTITION);
auto partition_entries_count =
data_layout.GetBlockEntries(storage::DataLayout::MLD_PARTITION);
util::ShM<partition::PartitionID, true>::vector partition(mld_partition_ptr,
partition_entries_count);
util::ShM<PartitionID, true>::vector partition(mld_partition_ptr,
partition_entries_count);
auto mld_chilren_ptr = data_layout.GetBlockPtr<partition::CellID>(
auto mld_chilren_ptr = data_layout.GetBlockPtr<CellID>(
memory_block, storage::DataLayout::MLD_CELL_TO_CHILDREN);
auto children_entries_count =
data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_TO_CHILDREN);
util::ShM<partition::CellID, true>::vector cell_to_children(mld_chilren_ptr,
children_entries_count);
util::ShM<CellID, true>::vector cell_to_children(mld_chilren_ptr,
children_entries_count);
mld_partition =
partition::MultiLevelPartitionView{level_data, partition, cell_to_children};
+8 -9
View File
@@ -177,7 +177,7 @@ template <bool UseShareMemory> class CellStorageImpl
}
};
std::size_t LevelIDToIndex(partition::LevelID level) const { return level - 1; }
std::size_t LevelIDToIndex(LevelID level) const { return level - 1; }
public:
using Cell = CellImpl<EdgeWeight>;
@@ -190,7 +190,7 @@ template <bool UseShareMemory> class CellStorageImpl
{
// pre-allocate storge for CellData so we can have random access to it by cell id
unsigned number_of_cells = 0;
for (partition::LevelID level = 1u; level < partition.GetNumberOfLevels(); ++level)
for (LevelID level = 1u; level < partition.GetNumberOfLevels(); ++level)
{
level_to_cell_offset.push_back(number_of_cells);
number_of_cells += partition.GetNumberOfCells(level);
@@ -198,12 +198,12 @@ template <bool UseShareMemory> class CellStorageImpl
level_to_cell_offset.push_back(number_of_cells);
cells.resize(number_of_cells);
std::vector<std::pair<partition::CellID, NodeID>> level_source_boundary;
std::vector<std::pair<partition::CellID, NodeID>> level_destination_boundary;
std::vector<std::pair<CellID, NodeID>> level_source_boundary;
std::vector<std::pair<CellID, NodeID>> level_destination_boundary;
std::size_t number_of_unconneced = 0;
for (partition::LevelID level = 1u; level < partition.GetNumberOfLevels(); ++level)
for (LevelID level = 1u; level < partition.GetNumberOfLevels(); ++level)
{
auto level_offset = level_to_cell_offset[LevelIDToIndex(level)];
@@ -212,7 +212,7 @@ template <bool UseShareMemory> class CellStorageImpl
for (auto node = 0u; node < base_graph.GetNumberOfNodes(); ++node)
{
const partition::CellID cell_id = partition.GetCell(level, node);
const CellID cell_id = partition.GetCell(level, node);
bool is_source_node = false;
bool is_destination_node = false;
bool is_boundary_node = false;
@@ -324,7 +324,7 @@ template <bool UseShareMemory> class CellStorageImpl
{
}
ConstCell GetCell(partition::LevelID level, partition::CellID id) const
ConstCell GetCell(LevelID level, CellID id) const
{
const auto level_index = LevelIDToIndex(level);
BOOST_ASSERT(level_index < level_to_cell_offset.size());
@@ -335,8 +335,7 @@ template <bool UseShareMemory> class CellStorageImpl
cells[cell_index], weights.data(), source_boundary.data(), destination_boundary.data()};
}
template <typename = std::enable_if<!UseShareMemory>>
Cell GetCell(partition::LevelID level, partition::CellID id)
template <typename = std::enable_if<!UseShareMemory>> Cell GetCell(LevelID level, CellID id)
{
const auto level_index = LevelIDToIndex(level);
BOOST_ASSERT(level_index < level_to_cell_offset.size());
+1 -2
View File
@@ -1,8 +1,8 @@
#ifndef OSRM_PARTITION_IO_HPP
#define OSRM_PARTITION_IO_HPP
#include "partition/multi_level_partition.hpp"
#include "partition/cell_storage.hpp"
#include "partition/multi_level_partition.hpp"
#include "storage/io.hpp"
@@ -44,7 +44,6 @@ template <> inline void write(const boost::filesystem::path &path, const CellSto
writer.SerializeVector(storage.cells);
writer.SerializeVector(storage.level_to_cell_offset);
}
}
}
}
@@ -40,12 +40,6 @@ void write(const boost::filesystem::path &file,
const detail::MultiLevelPartitionImpl<UseShareMemory> &mlp);
}
using LevelID = std::uint8_t;
using CellID = std::uint32_t;
using PartitionID = std::uint64_t;
static constexpr CellID INVALID_CELL_ID = std::numeric_limits<CellID>::max();
namespace detail
{
+8 -1
View File
@@ -61,7 +61,6 @@ using EdgeWeight = std::int32_t;
using TurnPenalty = std::int16_t; // turn penalty in 100ms units
static const std::size_t INVALID_INDEX = std::numeric_limits<std::size_t>::max();
using BisectionID = std::uint32_t;
using LaneID = std::uint8_t;
static const LaneID INVALID_LANEID = std::numeric_limits<LaneID>::max();
@@ -99,6 +98,14 @@ static const EdgeWeight MAXIMAL_EDGE_DURATION_INT_30 = (1 << 29) - 1;
using DatasourceID = std::uint8_t;
using BisectionID = std::uint32_t;
using LevelID = std::uint8_t;
using CellID = std::uint32_t;
using PartitionID = std::uint64_t;
static constexpr auto INVALID_LEVEL_ID = std::numeric_limits<LevelID>::max();
static constexpr auto INVALID_CELL_ID = std::numeric_limits<CellID>::max();
struct SegmentID
{
SegmentID(const NodeID id_, const bool enabled_) : id{id_}, enabled{enabled_}