clang-format

This commit is contained in:
Pepijn Schoen
2017-04-03 10:28:46 +02:00
committed by Patrick Niklaus
parent 16665aeb00
commit 091a495632
15 changed files with 55 additions and 90 deletions
+5 -8
View File
@@ -19,20 +19,17 @@ namespace customizer
using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData;
struct MultiLevelEdgeBasedGraph
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::Ownership::Container>
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::Container>
{
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::Ownership::Container>;
using Base =
partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::Container>;
using Base::Base;
};
struct MultiLevelEdgeBasedGraphView
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::Ownership::View>
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::View>
{
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
osrm::storage::Ownership::View>;
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::View>;
using Base::Base;
};
@@ -251,8 +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::Ownership::View>>
m_bearing_ranges_table;
std::shared_ptr<util::RangeTable<16, osrm::storage::Ownership::View>> m_bearing_ranges_table;
util::vector_view<DiscreteBearing> m_bearing_values_table;
// allocator that keeps the allocation data
+5 -8
View File
@@ -190,12 +190,11 @@ template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl
auto GetNumberOfGeometries() const { return index.size() - 1; }
auto GetNumberOfSegments() const { return fwd_weights.size(); }
friend void
io::read<Ownership>(const boost::filesystem::path &path,
detail::SegmentDataContainerImpl<Ownership> &segment_data);
friend void io::read<Ownership>(const boost::filesystem::path &path,
detail::SegmentDataContainerImpl<Ownership> &segment_data);
friend void
io::write<Ownership>(const boost::filesystem::path &path,
const detail::SegmentDataContainerImpl<Ownership> &segment_data);
const detail::SegmentDataContainerImpl<Ownership> &segment_data);
private:
Vector<std::uint32_t> index;
@@ -208,10 +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<osrm::storage::Ownership::View>;
using SegmentDataContainer = detail::SegmentDataContainerImpl<osrm::storage::Ownership::Container>;
}
}
+7 -11
View File
@@ -35,8 +35,7 @@ using CellStorageView = detail::CellStorageImpl<osrm::storage::Ownership::View>;
namespace io
{
template <osrm::storage::Ownership Ownership>
inline void read(const boost::filesystem::path &path,
detail::CellStorageImpl<Ownership> &storage);
inline void read(const boost::filesystem::path &path, detail::CellStorageImpl<Ownership> &storage);
template <osrm::storage::Ownership Ownership>
inline void write(const boost::filesystem::path &path,
const detail::CellStorageImpl<Ownership> &storage);
@@ -186,9 +185,8 @@ template <osrm::storage::Ownership Ownership> class CellStorageImpl
CellStorageImpl() {}
template <
typename GraphT,
typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
template <typename GraphT,
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
@@ -317,8 +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 == osrm::storage::Ownership::View>>
CellStorageImpl(Vector<EdgeWeight> weights_,
Vector<NodeID> source_boundary_,
Vector<NodeID> destination_boundary_,
@@ -343,8 +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 == osrm::storage::Ownership::Container>>
Cell GetCell(LevelID level, CellID id)
{
const auto level_index = LevelIDToIndex(level);
@@ -357,9 +353,9 @@ template <osrm::storage::Ownership Ownership> class CellStorageImpl
}
friend void io::read<Ownership>(const boost::filesystem::path &path,
detail::CellStorageImpl<Ownership> &storage);
detail::CellStorageImpl<Ownership> &storage);
friend void io::write<Ownership>(const boost::filesystem::path &path,
const detail::CellStorageImpl<Ownership> &storage);
const detail::CellStorageImpl<Ownership> &storage);
private:
Vector<EdgeWeight> weights;
+1 -2
View File
@@ -17,8 +17,7 @@ namespace io
{
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
inline void read(const boost::filesystem::path &path,
MultiLevelGraph<EdgeDataT, Ownership> &graph)
inline void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, Ownership> &graph)
{
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
storage::io::FileReader reader{path, fingerprint};
+5 -8
View File
@@ -24,8 +24,7 @@ template <typename EdgeDataT, osrm::storage::Ownership Ownership>
void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, Ownership> &graph);
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
void write(const boost::filesystem::path &path,
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
void write(const boost::filesystem::path &path, const MultiLevelGraph<EdgeDataT, Ownership> &graph);
}
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
@@ -191,12 +190,10 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
node_to_edge_offset.push_back(mlp.GetNumberOfLevels());
}
friend void
io::read<EdgeDataT, Ownership>(const boost::filesystem::path &path,
MultiLevelGraph<EdgeDataT, Ownership> &graph);
friend void
io::write<EdgeDataT, Ownership>(const boost::filesystem::path &path,
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
friend void io::read<EdgeDataT, Ownership>(const boost::filesystem::path &path,
MultiLevelGraph<EdgeDataT, Ownership> &graph);
friend void io::write<EdgeDataT, Ownership>(const boost::filesystem::path &path,
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
Vector<EdgeOffset> node_to_edge_offset;
};
+6 -10
View File
@@ -28,10 +28,8 @@ namespace detail
{
template <osrm::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<osrm::storage::Ownership::Container>;
using MultiLevelPartitionView = detail::MultiLevelPartitionImpl<osrm::storage::Ownership::View>;
namespace io
{
@@ -70,8 +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 == 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 +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 == osrm::storage::Ownership::View>>
MultiLevelPartitionImpl(LevelData level_data,
Vector<PartitionID> partition_,
Vector<CellID> cell_to_children_)
@@ -139,9 +135,9 @@ template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl fina
}
friend void io::read<Ownership>(const boost::filesystem::path &file,
MultiLevelPartitionImpl &mlp);
MultiLevelPartitionImpl &mlp);
friend void io::write<Ownership>(const boost::filesystem::path &file,
const MultiLevelPartitionImpl &mlp);
const MultiLevelPartitionImpl &mlp);
private:
auto MakeLevelData(const std::vector<std::uint32_t> &lidx_to_num_cells)
+1 -2
View File
@@ -22,8 +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, osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
class PackedVector
{
static const constexpr std::size_t BITSIZE = 33;
+1 -2
View File
@@ -216,8 +216,7 @@ template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership> class RangeTa
};
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
unsigned RangeTable<BLOCK_SIZE, Ownership>::PrefixSumAtIndex(int index,
const BlockT &block) const
unsigned RangeTable<BLOCK_SIZE, Ownership>::PrefixSumAtIndex(int index, const BlockT &block) const
{
// this loop looks inefficent, but a modern compiler
// will emit nice SIMD here, at least for sensible block sizes. (I checked.)
+6 -10
View File
@@ -128,8 +128,7 @@ template <typename DataT> class vector_view
auto data() const { return m_ptr; }
template <typename T>
friend void swap(vector_view<T> &, vector_view<T> &) noexcept;
template <typename T> friend void swap(vector_view<T> &, vector_view<T> &) noexcept;
};
template <> class vector_view<bool>
@@ -163,13 +162,11 @@ template <> class vector_view<bool>
bool operator[](const unsigned index) const { return at(index); }
template <typename T>
friend void swap(vector_view<T> &, vector_view<T> &) noexcept;
template <typename T> friend void swap(vector_view<T> &, vector_view<T> &) noexcept;
};
// Both vector_view<T> and the vector_view<bool> specializations share this impl.
template <typename DataT>
void swap(vector_view<DataT> &lhs, vector_view<DataT> &rhs) noexcept
template <typename DataT> void swap(vector_view<DataT> &lhs, vector_view<DataT> &rhs) noexcept
{
std::swap(lhs.m_ptr, rhs.m_ptr);
std::swap(lhs.m_size, rhs.m_size);
@@ -177,10 +174,9 @@ void swap(vector_view<DataT> &lhs, vector_view<DataT> &rhs) noexcept
template <typename DataT, osrm::storage::Ownership Ownership> struct ShM
{
using vector =
typename std::conditional<Ownership == osrm::storage::Ownership::View,
vector_view<DataT>,
std::vector<DataT>>::type;
using vector = typename std::conditional<Ownership == osrm::storage::Ownership::View,
vector_view<DataT>,
std::vector<DataT>>::type;
};
}
}