Fix formating

This commit is contained in:
Patrick Niklaus
2018-03-22 18:26:40 +00:00
parent 993f5badf1
commit c0dd5d7c76
39 changed files with 244 additions and 149 deletions
+6 -4
View File
@@ -5,8 +5,8 @@
#include "util/serialization.hpp"
#include "storage/tar.hpp"
#include "storage/serialization.hpp"
#include "storage/tar.hpp"
namespace osrm
{
@@ -39,10 +39,11 @@ inline void readGraph(const boost::filesystem::path &path,
edge_filter.resize(count);
for (const auto index : util::irange<std::size_t>(0, count))
{
storage::serialization::read(reader, "/ch/edge_filter/" + std::to_string(index), edge_filter[index]);
storage::serialization::read(
reader, "/ch/edge_filter/" + std::to_string(index), edge_filter[index]);
}
reader.ReadInto("/ch/connectivity_checksum", connectivity_checksum);
reader.ReadInto("/ch/connectivity_checksum", connectivity_checksum);
}
// writes .osrm.hsgr file
@@ -69,7 +70,8 @@ inline void writeGraph(const boost::filesystem::path &path,
writer.WriteElementCount64("/ch/edge_filter", edge_filter.size());
for (const auto index : util::irange<std::size_t>(0, edge_filter.size()))
{
storage::serialization::write(writer, "/ch/edge_filter/" + std::to_string(index), edge_filter[index]);
storage::serialization::write(
writer, "/ch/edge_filter/" + std::to_string(index), edge_filter[index]);
}
writer.WriteElementCount64("/ch/connectivity_checksum", 1);
@@ -938,7 +938,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
auto found_range = std::equal_range(
m_maneuver_overrides.begin(), m_maneuver_overrides.end(), edge_based_node_id, Comp{});
std::for_each(found_range.first, found_range.second, [&](const auto &override) {
std::for_each(found_range.first, found_range.second, [&](const auto & override) {
std::vector<NodeID> sequence(
m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_begin,
m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_end);
@@ -14,7 +14,6 @@ struct CompressedNodeBasedGraphEdge
NodeID source;
NodeID target;
};
}
}
+2 -4
View File
@@ -128,8 +128,7 @@ inline void readNodes(const boost::filesystem::path &path,
// reads only coordinates from .osrm.nbg_nodes
template <typename CoordinatesT>
inline void readNodeCoordinates(const boost::filesystem::path &path,
CoordinatesT &coordinates)
inline void readNodeCoordinates(const boost::filesystem::path &path, CoordinatesT &coordinates)
{
static_assert(std::is_same<typename CoordinatesT::value_type, util::Coordinate>::value, "");
@@ -482,8 +481,7 @@ void writeRamIndex(const boost::filesystem::path &path, const RTreeT &rtree)
util::serialization::write(writer, "/common/rtree", rtree);
}
template <typename RTreeT>
void readRamIndex(const boost::filesystem::path &path, RTreeT &rtree)
template <typename RTreeT> void readRamIndex(const boost::filesystem::path &path, RTreeT &rtree)
{
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
storage::tar::FileReader reader{path, fingerprint};
@@ -4,9 +4,9 @@
#include "extractor/compressed_edge_container.hpp"
#include "extractor/intersection/coordinate_extractor.hpp"
#include "extractor/intersection/have_identical_names.hpp"
#include "extractor/name_table.hpp"
#include "extractor/restriction_index.hpp"
#include "extractor/turn_lane_types.hpp"
#include "extractor/name_table.hpp"
#include "guidance/intersection.hpp"
@@ -23,12 +23,12 @@ namespace serialization
{
template <storage::Ownership Ownership>
void read(storage::tar::FileReader &reader,
const std::string& name,
const std::string &name,
detail::IntersectionBearingsContainer<Ownership> &turn_data);
template <storage::Ownership Ownership>
void write(storage::tar::FileWriter &writer,
const std::string& name,
const std::string &name,
const detail::IntersectionBearingsContainer<Ownership> &turn_data);
}
+1
View File
@@ -107,6 +107,7 @@ template <storage::Ownership Ownership> class NameTableImpl
friend void serialization::write<Ownership>(storage::tar::FileWriter &writer,
const std::string &name,
const NameTableImpl &index_data);
private:
IndexedData indexed_data;
};
+1 -1
View File
@@ -217,7 +217,7 @@ inline void write(storage::tar::FileWriter &writer,
template <storage::Ownership Ownership>
inline void read(storage::tar::FileReader &reader,
const std::string &name,
detail::NameTableImpl<Ownership> &name_table)
detail::NameTableImpl<Ownership> &name_table)
{
std::string buffer;
util::serialization::read(reader, name, name_table.indexed_data);
+1 -1
View File
@@ -4,11 +4,11 @@
#include "guidance/turn_data_container.hpp"
#include "extractor/compressed_edge_container.hpp"
#include "extractor/name_table.hpp"
#include "extractor/node_data_container.hpp"
#include "extractor/suffix_table.hpp"
#include "extractor/turn_lane_types.hpp"
#include "extractor/way_restriction_map.hpp"
#include "extractor/name_table.hpp"
#include "util/coordinate.hpp"
#include "util/guidance/bearing_class.hpp"
+1 -1
View File
@@ -3,8 +3,8 @@
#include "extractor/intersection/intersection_analysis.hpp"
#include "extractor/intersection/node_based_graph_walker.hpp"
#include "extractor/suffix_table.hpp"
#include "extractor/name_table.hpp"
#include "extractor/suffix_table.hpp"
#include "guidance/constants.hpp"
#include "guidance/intersection.hpp"
+1 -1
View File
@@ -7,8 +7,8 @@
#include "extractor/node_data_container.hpp"
#include "extractor/suffix_table.hpp"
#include "util/node_based_graph.hpp"
#include "util/bearing.hpp"
#include "util/node_based_graph.hpp"
#include "util/guidance/name_announcements.hpp"
+1 -1
View File
@@ -3,8 +3,8 @@
#include "extractor/compressed_edge_container.hpp"
#include "extractor/intersection/coordinate_extractor.hpp"
#include "extractor/query_node.hpp"
#include "extractor/name_table.hpp"
#include "extractor/query_node.hpp"
#include "guidance/intersection.hpp"
#include "guidance/intersection_handler.hpp"
+1 -1
View File
@@ -3,8 +3,8 @@
#include "guidance/turn_data_container.hpp"
#include "storage/tar.hpp"
#include "storage/serialization.hpp"
#include "storage/tar.hpp"
#include <boost/assert.hpp>
+1 -1
View File
@@ -3,9 +3,9 @@
#include "extractor/compressed_edge_container.hpp"
#include "extractor/intersection/intersection_view.hpp"
#include "extractor/name_table.hpp"
#include "extractor/restriction_index.hpp"
#include "extractor/suffix_table.hpp"
#include "extractor/name_table.hpp"
#include "guidance/driveway_handler.hpp"
#include "guidance/intersection.hpp"
+1 -1
View File
@@ -1,8 +1,8 @@
#ifndef OSRM_GUIDANCE_TURN_HANDLER_HPP_
#define OSRM_GUIDANCE_TURN_HANDLER_HPP_
#include "extractor/query_node.hpp"
#include "extractor/name_table.hpp"
#include "extractor/query_node.hpp"
#include "guidance/intersection.hpp"
#include "guidance/intersection_handler.hpp"
+6 -5
View File
@@ -95,9 +95,10 @@ template <storage::Ownership Ownership> class CellStorageImpl
WeightValueT,
boost::random_access_traversal_tag>
{
typedef boost::
iterator_facade<ColumnIterator, WeightValueT, boost::random_access_traversal_tag>
base_t;
typedef boost::iterator_facade<ColumnIterator,
WeightValueT,
boost::random_access_traversal_tag>
base_t;
public:
typedef typename base_t::value_type value_type;
@@ -182,8 +183,8 @@ template <storage::Ownership Ownership> class CellStorageImpl
const NodeID *const all_destinations)
: num_source_nodes{data.num_source_nodes},
num_destination_nodes{data.num_destination_nodes},
weights{all_weights + data.value_offset}, durations{all_durations +
data.value_offset},
weights{all_weights + data.value_offset},
durations{all_durations + data.value_offset},
source_boundary{all_sources + data.source_boundary_offset},
destination_boundary{all_destinations + data.destination_boundary_offset}
{
+5 -5
View File
@@ -3,8 +3,8 @@
#include "partitioner/multi_level_partition.hpp"
#include "storage/tar_fwd.hpp"
#include "storage/shared_memory_ownership.hpp"
#include "storage/tar_fwd.hpp"
#include "util/static_graph.hpp"
#include "util/vector_view.hpp"
@@ -25,13 +25,13 @@ namespace serialization
{
template <typename EdgeDataT, storage::Ownership Ownership>
void read(storage::tar::FileReader &reader,
const std::string& name,
const std::string &name,
MultiLevelGraph<EdgeDataT, Ownership> &graph,
std::uint32_t &connectivity_checksum);
template <typename EdgeDataT, storage::Ownership Ownership>
void write(storage::tar::FileWriter &writer,
const std::string& name,
const std::string &name,
const MultiLevelGraph<EdgeDataT, Ownership> &graph,
const std::uint32_t connectivity_checksum);
}
@@ -205,12 +205,12 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
friend void
serialization::read<EdgeDataT, Ownership>(storage::tar::FileReader &reader,
const std::string& name,
const std::string &name,
MultiLevelGraph<EdgeDataT, Ownership> &graph,
std::uint32_t &connectivity_checksum);
friend void
serialization::write<EdgeDataT, Ownership>(storage::tar::FileWriter &writer,
const std::string& name,
const std::string &name,
const MultiLevelGraph<EdgeDataT, Ownership> &graph,
const std::uint32_t connectivity_checksum);
@@ -7,8 +7,8 @@
#include "util/typedefs.hpp"
#include "util/vector_view.hpp"
#include "storage/tar_fwd.hpp"
#include "storage/shared_memory_ownership.hpp"
#include "storage/tar_fwd.hpp"
#include <algorithm>
#include <array>
@@ -34,9 +34,13 @@ using MultiLevelPartitionView = detail::MultiLevelPartitionImpl<storage::Ownersh
namespace serialization
{
template <storage::Ownership Ownership>
void read(storage::tar::FileReader &reader, const std::string& name, detail::MultiLevelPartitionImpl<Ownership> &mlp);
void read(storage::tar::FileReader &reader,
const std::string &name,
detail::MultiLevelPartitionImpl<Ownership> &mlp);
template <storage::Ownership Ownership>
void write(storage::tar::FileWriter &writer, const std::string& name, const detail::MultiLevelPartitionImpl<Ownership> &mlp);
void write(storage::tar::FileWriter &writer,
const std::string &name,
const detail::MultiLevelPartitionImpl<Ownership> &mlp);
}
namespace detail
@@ -137,10 +141,10 @@ template <storage::Ownership Ownership> class MultiLevelPartitionImpl final
}
friend void serialization::read<Ownership>(storage::tar::FileReader &reader,
const std::string& name,
const std::string &name,
MultiLevelPartitionImpl &mlp);
friend void serialization::write<Ownership>(storage::tar::FileWriter &writer,
const std::string& name,
const std::string &name,
const MultiLevelPartitionImpl &mlp);
private:
+16 -11
View File
@@ -33,21 +33,25 @@ namespace serialization
*/
template <typename T>
inline void read(storage::tar::FileReader &reader, const std::string& name, util::DeallocatingVector<T> &vec)
inline void
read(storage::tar::FileReader &reader, const std::string &name, util::DeallocatingVector<T> &vec)
{
vec.resize(reader.ReadElementCount64(name));
reader.ReadStreaming<T>(name, vec.begin(), vec.size());
}
template <typename T>
inline void write(storage::tar::FileWriter &writer, const std::string& name, const util::DeallocatingVector<T> &vec)
inline void write(storage::tar::FileWriter &writer,
const std::string &name,
const util::DeallocatingVector<T> &vec)
{
writer.WriteElementCount64(name, vec.size());
writer.WriteStreaming<T>(name, vec.begin(), vec.size());
}
#if USE_STXXL_LIBRARY
template <typename T> inline void read(storage::tar::FileReader &reader, const std::string& name, stxxl::vector<T> &vec)
template <typename T>
inline void read(storage::tar::FileReader &reader, const std::string &name, stxxl::vector<T> &vec)
{
auto size = reader.ReadElementCount64(name);
vec.reserve(size);
@@ -55,23 +59,22 @@ template <typename T> inline void read(storage::tar::FileReader &reader, const s
}
template <typename T>
inline void write(storage::tar::FileWriter &writer, const std::string& name, const stxxl::vector<T> &vec)
inline void
write(storage::tar::FileWriter &writer, const std::string &name, const stxxl::vector<T> &vec)
{
writer.WriteElementCount64(name, vec.size());
writer.WriteStreaming<T>(name, vec.begin(), vec.size());
}
#endif
template <typename T>
void read(io::BufferReader &reader, std::vector<T> &data)
template <typename T> void read(io::BufferReader &reader, std::vector<T> &data)
{
const auto count = reader.ReadElementCount64();
data.resize(count);
reader.ReadInto(data.data(), count);
}
template <typename T>
void write(io::BufferWriter &writer, const std::vector<T> &data)
template <typename T> void write(io::BufferWriter &writer, const std::vector<T> &data)
{
const auto count = data.size();
writer.WriteElementCount64(count);
@@ -89,11 +92,11 @@ inline void read(tar::FileReader &reader, const std::string &name, std::string &
{
const auto count = reader.ReadElementCount64(name);
data.resize(count);
reader.ReadInto(name, const_cast<char*>(data.data()), count);
reader.ReadInto(name, const_cast<char *>(data.data()), count);
}
template <typename T>
inline void read(tar::FileReader &reader, const std::string& name, std::vector<T> &data)
inline void read(tar::FileReader &reader, const std::string &name, std::vector<T> &data)
{
const auto count = reader.ReadElementCount64(name);
data.resize(count);
@@ -179,7 +182,9 @@ void writeBoolVector(tar::FileWriter &writer, const std::string &name, const Vec
std::uint64_t number_of_blocks = std::ceil((double)count / CHAR_BIT);
writer.WriteStreaming<unsigned char>(
name, boost::make_function_input_iterator(encode_function, boost::infinite()), number_of_blocks);
name,
boost::make_function_input_iterator(encode_function, boost::infinite()),
number_of_blocks);
}
}
+5 -3
View File
@@ -214,7 +214,8 @@ template <int N, typename T = std::string> struct FixedGroupBlock
template <typename OffsetIterator, typename OutByteIter>
OutByteIter WriteBlockPrefix(OffsetIterator first, OffsetIterator last, OutByteIter out) const
{
constexpr std::size_t MAX_LENGTH = std::numeric_limits<std::make_unsigned_t<ValueType>>::max();
constexpr std::size_t MAX_LENGTH =
std::numeric_limits<std::make_unsigned_t<ValueType>>::max();
auto index = 0;
std::array<ValueType, BLOCK_SIZE> prefix;
@@ -223,12 +224,13 @@ template <int N, typename T = std::string> struct FixedGroupBlock
{
const std::uint32_t data_length = *next - *curr;
if (data_length > MAX_LENGTH)
throw util::exception(boost::format("too large data length %1% > %2%") % data_length % MAX_LENGTH);
throw util::exception(boost::format("too large data length %1% > %2%") %
data_length % MAX_LENGTH);
prefix[index++] = data_length;
}
out = std::copy_n((const char *)prefix.data(), sizeof(ValueType)*BLOCK_SIZE, out);
out = std::copy_n((const char *)prefix.data(), sizeof(ValueType) * BLOCK_SIZE, out);
return out;
}
+17 -9
View File
@@ -2,10 +2,10 @@
#define OSMR_UTIL_SERIALIZATION_HPP
#include "util/dynamic_graph.hpp"
#include "util/indexed_data.hpp"
#include "util/packed_vector.hpp"
#include "util/range_table.hpp"
#include "util/static_graph.hpp"
#include "util/indexed_data.hpp"
#include "util/static_rtree.hpp"
#include "storage/io.hpp"
@@ -101,8 +101,9 @@ inline void write(storage::tar::FileWriter &writer,
}
template <typename BlockPolicy, storage::Ownership Ownership>
inline void
read(storage::tar::FileReader &reader, const std::string &name, detail::IndexedDataImpl<BlockPolicy, Ownership> &index_data)
inline void read(storage::tar::FileReader &reader,
const std::string &name,
detail::IndexedDataImpl<BlockPolicy, Ownership> &index_data)
{
storage::serialization::read(reader, name + "/blocks", index_data.blocks);
storage::serialization::read(reader, name + "/values", index_data.values);
@@ -110,7 +111,8 @@ read(storage::tar::FileReader &reader, const std::string &name, detail::IndexedD
template <typename BlockPolicy, storage::Ownership Ownership>
inline void write(storage::tar::FileWriter &writer,
const std::string &name, const detail::IndexedDataImpl<BlockPolicy, Ownership> &index_data)
const std::string &name,
const detail::IndexedDataImpl<BlockPolicy, Ownership> &index_data)
{
storage::serialization::write(writer, name + "/blocks", index_data.blocks);
storage::serialization::write(writer, name + "/values", index_data.values);
@@ -120,21 +122,27 @@ template <class EdgeDataT,
storage::Ownership Ownership,
std::uint32_t BRANCHING_FACTOR,
std::uint32_t LEAF_PAGE_SIZE>
void read(storage::tar::FileReader &reader, const std::string& name, util::StaticRTree<EdgeDataT, Ownership, BRANCHING_FACTOR, LEAF_PAGE_SIZE> &rtree)
void read(storage::tar::FileReader &reader,
const std::string &name,
util::StaticRTree<EdgeDataT, Ownership, BRANCHING_FACTOR, LEAF_PAGE_SIZE> &rtree)
{
storage::serialization::read(reader, name + "/search_tree", rtree.m_search_tree);
storage::serialization::read(reader, name + "/search_tree_level_starts", rtree.m_tree_level_starts);
storage::serialization::read(
reader, name + "/search_tree_level_starts", rtree.m_tree_level_starts);
}
template <class EdgeDataT,
storage::Ownership Ownership,
std::uint32_t BRANCHING_FACTOR,
std::uint32_t LEAF_PAGE_SIZE>
void write(storage::tar::FileWriter &writer, const std::string& name, const util::StaticRTree<EdgeDataT, Ownership, BRANCHING_FACTOR, LEAF_PAGE_SIZE> &rtree){
void write(storage::tar::FileWriter &writer,
const std::string &name,
const util::StaticRTree<EdgeDataT, Ownership, BRANCHING_FACTOR, LEAF_PAGE_SIZE> &rtree)
{
storage::serialization::write(writer, name + "/search_tree", rtree.m_search_tree);
storage::serialization::write(writer, name + "/search_tree_level_starts", rtree.m_tree_level_starts);
storage::serialization::write(
writer, name + "/search_tree_level_starts", rtree.m_tree_level_starts);
}
}
}
}
+4 -7
View File
@@ -273,10 +273,9 @@ class StaticRTree
explicit StaticRTree(const std::vector<EdgeDataT> &input_data_vector,
const Vector<Coordinate> &coordinate_list,
const boost::filesystem::path &on_disk_file_name)
: m_coordinate_list(coordinate_list), m_objects{mmapFile<EdgeDataT>(
on_disk_file_name,
m_objects_region,
input_data_vector.size() * sizeof(EdgeDataT))}
: m_coordinate_list(coordinate_list),
m_objects{mmapFile<EdgeDataT>(
on_disk_file_name, m_objects_region, input_data_vector.size() * sizeof(EdgeDataT))}
{
const auto element_count = input_data_vector.size();
std::vector<WrappedInputElement> input_wrapper_vector(element_count);
@@ -758,9 +757,7 @@ class StaticRTree
}
friend void serialization::read<EdgeDataT, Ownership, BRANCHING_FACTOR, LEAF_PAGE_SIZE>(
storage::tar::FileReader &reader,
const std::string &name,
StaticRTree &rtree);
storage::tar::FileReader &reader, const std::string &name, StaticRTree &rtree);
friend void serialization::write<EdgeDataT, Ownership, BRANCHING_FACTOR, LEAF_PAGE_SIZE>(
storage::tar::FileWriter &writer, const std::string &name, const StaticRTree &rtree);
+6 -4
View File
@@ -108,7 +108,8 @@ template <typename DataT> class vector_view
std::size_t size() const { return m_size; }
void resize(const size_t size) {
void resize(const size_t size)
{
if (size > m_size)
{
throw util::exception("Trying to resize a view to a larger size.");
@@ -116,7 +117,6 @@ template <typename DataT> class vector_view
m_size = size;
}
bool empty() const { return 0 == size(); }
DataT &operator[](const unsigned index)
@@ -194,12 +194,14 @@ template <> class vector_view<bool>
return m_ptr[bucket] & (1u << offset);
}
void reset(unsigned * ptr, std::size_t size) {
void reset(unsigned *ptr, std::size_t size)
{
m_ptr = ptr;
m_size = size;
}
void resize(const size_t size) {
void resize(const size_t size)
{
if (size > m_size)
{
throw util::exception("Trying to resize a view to a larger size.");