Fix formating
This commit is contained in:
		
							parent
							
								
									d94017dfae
								
							
						
					
					
						commit
						4ec7ca29f1
					
				| @ -68,8 +68,7 @@ class Contractor | ||||
|     void WriteCoreNodeMarker(std::vector<bool> &&is_core_node) const; | ||||
|     void WriteNodeLevels(std::vector<float> &&node_levels) const; | ||||
|     void ReadNodeLevels(std::vector<float> &contraction_order) const; | ||||
|     void | ||||
|     WriteContractedGraph(unsigned number_of_edge_based_nodes, | ||||
|     void WriteContractedGraph(unsigned number_of_edge_based_nodes, | ||||
|                               util::DeallocatingVector<QueryEdge> contracted_edge_list); | ||||
|     void FindComponents(unsigned max_edge_id, | ||||
|                         const util::DeallocatingVector<extractor::EdgeBasedEdge> &edges, | ||||
|  | ||||
| @ -3,10 +3,8 @@ | ||||
| 
 | ||||
| #include "contractor/query_edge.hpp" | ||||
| 
 | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/static_graph.hpp" | ||||
| 
 | ||||
| #include <tuple> | ||||
| #include "util/typedefs.hpp" | ||||
| 
 | ||||
| namespace osrm | ||||
| { | ||||
| @ -15,12 +13,12 @@ namespace contractor | ||||
| 
 | ||||
| namespace detail | ||||
| { | ||||
| template <storage::Ownership Ownership> using QueryGraph = util::StaticGraph<typename QueryEdge::EdgeData, Ownership>; | ||||
| template <storage::Ownership Ownership> | ||||
| using QueryGraph = util::StaticGraph<typename QueryEdge::EdgeData, Ownership>; | ||||
| } | ||||
| 
 | ||||
| using QueryGraph = detail::QueryGraph<storage::Ownership::Container>; | ||||
| using QueryGraphView = detail::QueryGraph<storage::Ownership::View>; | ||||
| 
 | ||||
| } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -17,11 +17,11 @@ | ||||
| #include "extractor/restriction_map.hpp" | ||||
| 
 | ||||
| #include "util/deallocating_vector.hpp" | ||||
| #include "util/packed_vector.hpp" | ||||
| #include "util/guidance/bearing_class.hpp" | ||||
| #include "util/guidance/entry_class.hpp" | ||||
| #include "util/name_table.hpp" | ||||
| #include "util/node_based_graph.hpp" | ||||
| #include "util/packed_vector.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| 
 | ||||
| #include "storage/io.hpp" | ||||
|  | ||||
| @ -126,7 +126,8 @@ inline void writeTurnData(const boost::filesystem::path &path, | ||||
| 
 | ||||
| // reads .osrm.tls
 | ||||
| template <storage::Ownership Ownership> | ||||
| inline void readTurnLaneDescriptions(const boost::filesystem::path &path, | ||||
| inline void readTurnLaneDescriptions( | ||||
|     const boost::filesystem::path &path, | ||||
|     util::ViewOrVector<std::uint32_t, Ownership> &turn_offsets, | ||||
|     util::ViewOrVector<extractor::guidance::TurnLaneType::Mask, Ownership> &turn_masks) | ||||
| { | ||||
| @ -139,7 +140,8 @@ inline void readTurnLaneDescriptions(const boost::filesystem::path &path, | ||||
| 
 | ||||
| // writes .osrm.tls
 | ||||
| template <storage::Ownership Ownership> | ||||
| inline void writeTurnLaneDescriptions(const boost::filesystem::path &path, | ||||
| inline void writeTurnLaneDescriptions( | ||||
|     const boost::filesystem::path &path, | ||||
|     const util::ViewOrVector<std::uint32_t, Ownership> &turn_offsets, | ||||
|     const util::ViewOrVector<extractor::guidance::TurnLaneType::Mask, Ownership> &turn_masks) | ||||
| { | ||||
| @ -149,7 +151,6 @@ inline void writeTurnLaneDescriptions(const boost::filesystem::path &path, | ||||
|     storage::serialization::write(writer, turn_offsets); | ||||
|     storage::serialization::write(writer, turn_masks); | ||||
| } | ||||
| 
 | ||||
| } | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -2,9 +2,9 @@ | ||||
| #define OSRM_EXTRACTOR_GUIDANCE_MERGEABLE_ROADS | ||||
| 
 | ||||
| #include "extractor/guidance/intersection.hpp" | ||||
| #include "util/coordinate.hpp" | ||||
| #include "util/node_based_graph.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/coordinate.hpp" | ||||
| 
 | ||||
| #include <cstdint> | ||||
| #include <functional> | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| #ifndef OSRM_EXTRACTOR_SEGMENT_DATA_CONTAINER_HPP_ | ||||
| #define OSRM_EXTRACTOR_SEGMENT_DATA_CONTAINER_HPP_ | ||||
| 
 | ||||
| #include "util/vector_view.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| 
 | ||||
| #include "storage/shared_memory_ownership.hpp" | ||||
| 
 | ||||
|  | ||||
| @ -6,8 +6,8 @@ | ||||
| #include "util/assert.hpp" | ||||
| #include "util/for_each_range.hpp" | ||||
| #include "util/log.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| 
 | ||||
| #include "storage/io.hpp" | ||||
| #include "storage/shared_memory_ownership.hpp" | ||||
|  | ||||
| @ -36,7 +36,8 @@ inline void writeGraph(const boost::filesystem::path &path, | ||||
| 
 | ||||
| // read .osrm.partition file
 | ||||
| template <storage::Ownership Ownership> | ||||
| inline void readPartition(const boost::filesystem::path &path, detail::MultiLevelPartitionImpl<Ownership> &mlp) | ||||
| inline void readPartition(const boost::filesystem::path &path, | ||||
|                           detail::MultiLevelPartitionImpl<Ownership> &mlp) | ||||
| { | ||||
|     const auto fingerprint = storage::io::FileReader::VerifyFingerprint; | ||||
|     storage::io::FileReader reader{path, fingerprint}; | ||||
| @ -46,7 +47,8 @@ inline void readPartition(const boost::filesystem::path &path, detail::MultiLeve | ||||
| 
 | ||||
| // writes .osrm.partition file
 | ||||
| template <storage::Ownership Ownership> | ||||
| inline void writePartition(const boost::filesystem::path &path, const detail::MultiLevelPartitionImpl<Ownership> &mlp) | ||||
| inline void writePartition(const boost::filesystem::path &path, | ||||
|                            const detail::MultiLevelPartitionImpl<Ownership> &mlp) | ||||
| { | ||||
|     const auto fingerprint = storage::io::FileWriter::GenerateFingerprint; | ||||
|     storage::io::FileWriter writer{path, fingerprint}; | ||||
| @ -56,7 +58,8 @@ inline void writePartition(const boost::filesystem::path &path, const detail::Mu | ||||
| 
 | ||||
| // reads .osrm.cells file
 | ||||
| template <storage::Ownership Ownership> | ||||
| inline void readCells(const boost::filesystem::path &path, detail::CellStorageImpl<Ownership> &storage) | ||||
| inline void readCells(const boost::filesystem::path &path, | ||||
|                       detail::CellStorageImpl<Ownership> &storage) | ||||
| { | ||||
|     const auto fingerprint = storage::io::FileReader::VerifyFingerprint; | ||||
|     storage::io::FileReader reader{path, fingerprint}; | ||||
| @ -66,7 +69,8 @@ inline void readCells(const boost::filesystem::path &path, detail::CellStorageIm | ||||
| 
 | ||||
| // writes .osrm.cells file
 | ||||
| template <storage::Ownership Ownership> | ||||
| inline void writeCells(const boost::filesystem::path &path, const detail::CellStorageImpl<Ownership> &storage) | ||||
| inline void writeCells(const boost::filesystem::path &path, | ||||
|                        const detail::CellStorageImpl<Ownership> &storage) | ||||
| { | ||||
|     const auto fingerprint = storage::io::FileWriter::GenerateFingerprint; | ||||
|     storage::io::FileWriter writer{path, fingerprint}; | ||||
|  | ||||
| @ -4,8 +4,8 @@ | ||||
| #include "util/exception.hpp" | ||||
| #include "util/for_each_pair.hpp" | ||||
| #include "util/msb.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| 
 | ||||
| #include "storage/io.hpp" | ||||
| #include "storage/shared_memory_ownership.hpp" | ||||
| @ -336,7 +336,8 @@ inline MultiLevelPartitionImpl<storage::Ownership::Container>::MultiLevelPartiti | ||||
| } | ||||
| 
 | ||||
| template <> | ||||
| inline MultiLevelPartitionImpl<storage::Ownership::View>::MultiLevelPartitionImpl() : level_data(nullptr) | ||||
| inline MultiLevelPartitionImpl<storage::Ownership::View>::MultiLevelPartitionImpl() | ||||
|     : level_data(nullptr) | ||||
| { | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -29,7 +29,7 @@ template <typename T> void write(io::FileWriter &writer, const std::vector<T> &d | ||||
| template <typename T> void read(io::FileReader &reader, util::vector_view<T> &data) | ||||
| { | ||||
|     const auto count = reader.ReadElementCount64(); | ||||
|     data.resize(count); | ||||
|     BOOST_ASSERT(data.size() == count); | ||||
|     reader.ReadInto(data.data(), count); | ||||
| } | ||||
| 
 | ||||
| @ -39,7 +39,6 @@ template <typename T> void write(io::FileWriter &writer, const util::vector_view | ||||
|     writer.WriteElementCount64(count); | ||||
|     return writer.WriteFrom(data.data(), count); | ||||
| } | ||||
| 
 | ||||
| } | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -239,6 +239,10 @@ class DeallocatingVector | ||||
|         bucket_list.emplace_back(new ElementT[ELEMENTS_PER_BLOCK]); | ||||
|     } | ||||
| 
 | ||||
|     // copying is not safe since this would only do a shallow copy
 | ||||
|     DeallocatingVector(DeallocatingVector &other) = delete; | ||||
|     DeallocatingVector &operator=(DeallocatingVector &other) = delete; | ||||
| 
 | ||||
|     DeallocatingVector(DeallocatingVector &&other) | ||||
|     { | ||||
|         bucket_list = std::move(other.bucket_list); | ||||
|  | ||||
| @ -36,8 +36,7 @@ template <typename EdgeDataT, bool UseSharedMemory> | ||||
| void read(storage::io::FileReader &reader, DynamicGraph<EdgeDataT> &graph); | ||||
| 
 | ||||
| template <typename EdgeDataT, bool UseSharedMemory> | ||||
| void write(storage::io::FileWriter &writer, | ||||
|            const DynamicGraph<EdgeDataT> &graph); | ||||
| void write(storage::io::FileWriter &writer, const DynamicGraph<EdgeDataT> &graph); | ||||
| } | ||||
| 
 | ||||
| template <typename EdgeDataT> class DynamicGraph | ||||
|  | ||||
| @ -9,8 +9,8 @@ | ||||
| #include "util/exception.hpp" | ||||
| #include "util/fingerprint.hpp" | ||||
| #include "util/log.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/packed_vector.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| 
 | ||||
| #include <boost/assert.hpp> | ||||
| #include <boost/filesystem.hpp> | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| #ifndef PACKED_VECTOR_HPP | ||||
| #define PACKED_VECTOR_HPP | ||||
| 
 | ||||
| #include "util/vector_view.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| 
 | ||||
| #include "storage/io.hpp" | ||||
| #include "storage/shared_memory_ownership.hpp" | ||||
|  | ||||
| @ -1,9 +1,9 @@ | ||||
| #ifndef OSMR_UTIL_SERIALIZATION_HPP | ||||
| #define OSMR_UTIL_SERIALIZATION_HPP | ||||
| 
 | ||||
| #include "util/dynamic_graph.hpp" | ||||
| #include "util/packed_vector.hpp" | ||||
| #include "util/static_graph.hpp" | ||||
| #include "util/dynamic_graph.hpp" | ||||
| 
 | ||||
| #include "storage/io.hpp" | ||||
| #include "storage/serialization.hpp" | ||||
| @ -15,40 +15,35 @@ namespace util | ||||
| namespace serialization | ||||
| { | ||||
| template <typename T, storage::Ownership Ownership> | ||||
| inline void read(storage::io::FileReader &reader, | ||||
|                  detail::PackedVector<T, Ownership> &vec) | ||||
| inline void read(storage::io::FileReader &reader, detail::PackedVector<T, Ownership> &vec) | ||||
| { | ||||
|     vec.num_elements = reader.ReadOne<std::uint64_t>(); | ||||
|     storage::serialization::read(reader, vec.vec); | ||||
| } | ||||
| 
 | ||||
| template <typename T, storage::Ownership Ownership> | ||||
| inline void write(storage::io::FileWriter &writer, | ||||
|                  const detail::PackedVector<T, Ownership> &vec) | ||||
| inline void write(storage::io::FileWriter &writer, const detail::PackedVector<T, Ownership> &vec) | ||||
| { | ||||
|     writer.WriteOne(vec.num_elements); | ||||
|     storage::serialization::write(writer, vec.vec); | ||||
| } | ||||
| 
 | ||||
| template <typename EdgeDataT, storage::Ownership Ownership> | ||||
| inline void read(storage::io::FileReader &reader, | ||||
|                  StaticGraph<EdgeDataT, Ownership> &graph) | ||||
| inline void read(storage::io::FileReader &reader, StaticGraph<EdgeDataT, Ownership> &graph) | ||||
| { | ||||
|     storage::serialization::read(reader, graph.node_array); | ||||
|     storage::serialization::read(reader, graph.edge_array); | ||||
| } | ||||
| 
 | ||||
| template <typename EdgeDataT, storage::Ownership Ownership> | ||||
| inline void write(storage::io::FileWriter &writer, | ||||
|                  const StaticGraph<EdgeDataT, Ownership> &graph) | ||||
| inline void write(storage::io::FileWriter &writer, const StaticGraph<EdgeDataT, Ownership> &graph) | ||||
| { | ||||
|     storage::serialization::write(writer, graph.node_array); | ||||
|     storage::serialization::write(writer, graph.edge_array); | ||||
| } | ||||
| 
 | ||||
| template <typename EdgeDataT> | ||||
| inline void read(storage::io::FileReader &reader, | ||||
|                  DynamicGraph<EdgeDataT> &graph) | ||||
| inline void read(storage::io::FileReader &reader, DynamicGraph<EdgeDataT> &graph) | ||||
| { | ||||
|     storage::serialization::read(reader, graph.node_array); | ||||
|     auto num_edges = reader.ReadElementCount64(); | ||||
| @ -62,8 +57,7 @@ inline void read(storage::io::FileReader &reader, | ||||
| } | ||||
| 
 | ||||
| template <typename EdgeDataT> | ||||
| inline void write(storage::io::FileWriter &writer, | ||||
|                  const DynamicGraph<EdgeDataT> &graph) | ||||
| inline void write(storage::io::FileWriter &writer, const DynamicGraph<EdgeDataT> &graph) | ||||
| { | ||||
|     storage::serialization::write(writer, graph.node_array); | ||||
|     writer.WriteElementCount64(graph.number_of_edges); | ||||
| @ -72,7 +66,6 @@ inline void write(storage::io::FileWriter &writer, | ||||
|         writer.WriteOne(graph.edge_list[index]); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| } | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -4,8 +4,8 @@ | ||||
| #include "util/graph_traits.hpp" | ||||
| #include "util/integer_range.hpp" | ||||
| #include "util/percent.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| 
 | ||||
| #include "storage/shared_memory_ownership.hpp" | ||||
| 
 | ||||
| @ -272,7 +272,9 @@ class StaticGraph | ||||
|             unsigned offset = std::distance(begin, iter); | ||||
|             node_array.push_back(NodeArrayEntry{offset}); | ||||
|         } | ||||
|         BOOST_ASSERT_MSG(iter == end, ("Still " + std::to_string(std::distance(iter, end)) + " edges left.").c_str()); | ||||
|         BOOST_ASSERT_MSG( | ||||
|             iter == end, | ||||
|             ("Still " + std::to_string(std::distance(iter, end)) + " edges left.").c_str()); | ||||
|         BOOST_ASSERT(node_array.size() == number_of_nodes + 1); | ||||
| 
 | ||||
|         edge_array.resize(number_of_edges); | ||||
|  | ||||
| @ -9,8 +9,8 @@ | ||||
| #include "util/hilbert_value.hpp" | ||||
| #include "util/integer_range.hpp" | ||||
| #include "util/rectangle.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| #include "util/typedefs.hpp" | ||||
| #include "util/vector_view.hpp" | ||||
| #include "util/web_mercator.hpp" | ||||
| 
 | ||||
| #include "osrm/coordinate.hpp" | ||||
|  | ||||
| @ -29,8 +29,9 @@ class VectorViewIterator : public boost::iterator_facade<VectorViewIterator<Data | ||||
|                                                          DataT, | ||||
|                                                          boost::random_access_traversal_tag> | ||||
| { | ||||
|     typedef boost:: | ||||
|         iterator_facade<VectorViewIterator<DataT>, DataT, boost::random_access_traversal_tag> | ||||
|     typedef boost::iterator_facade<VectorViewIterator<DataT>, | ||||
|                                    DataT, | ||||
|                                    boost::random_access_traversal_tag> | ||||
|         base_t; | ||||
| 
 | ||||
|   public: | ||||
| @ -85,17 +86,6 @@ template <typename DataT> class vector_view | ||||
|         m_size = size; | ||||
|     } | ||||
| 
 | ||||
|     // for a vector-like interface
 | ||||
|     void resize(std::size_t size) const | ||||
|     { | ||||
|         if (m_size != size) | ||||
|         { | ||||
|             throw util::exception("Invalid resize " + std::to_string(size) + | ||||
|                                   " on immutable vector view of size " + std::to_string(m_size) + | ||||
|                                   "."); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     DataT &at(const std::size_t index) { return m_ptr[index]; } | ||||
| 
 | ||||
|     const DataT &at(const std::size_t index) const { return m_ptr[index]; } | ||||
| @ -168,15 +158,6 @@ template <> class vector_view<bool> | ||||
| 
 | ||||
|     void reset(unsigned *, std::size_t size) { m_size = size; } | ||||
| 
 | ||||
|     // for ensuring a vector compatible interface
 | ||||
|     void resize(std::size_t size) const | ||||
|     { | ||||
|         if (m_size != size) | ||||
|         { | ||||
|             throw util::exception("Invalid resize on immutable shared memory vector."); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     std::size_t size() const { return m_size; } | ||||
| 
 | ||||
|     bool empty() const { return 0 == size(); } | ||||
|  | ||||
| @ -95,9 +95,7 @@ util::Coordinate CoordinateExtractor::ExtractRepresentativeCoordinate( | ||||
| { | ||||
|     // check if the coordinate is equal to the interseciton coordinate
 | ||||
|     const auto not_same_as_start = [&](const util::Coordinate coordinate) { | ||||
|         return node_coordinates[traversed_in_reverse | ||||
|                                     ? to_node | ||||
|                                     : intersection_node] != coordinate; | ||||
|         return node_coordinates[traversed_in_reverse ? to_node : intersection_node] != coordinate; | ||||
|     }; | ||||
|     // this is only used for debug purposes in assertions. We don't want warnings about it
 | ||||
|     (void)not_same_as_start; | ||||
|  | ||||
| @ -14,8 +14,7 @@ namespace extractor | ||||
| namespace guidance | ||||
| { | ||||
| 
 | ||||
| IntersectionNormalizer::IntersectionNormalizer( | ||||
|     const util::NodeBasedDynamicGraph &node_based_graph, | ||||
| IntersectionNormalizer::IntersectionNormalizer(const util::NodeBasedDynamicGraph &node_based_graph, | ||||
|                                                const std::vector<util::Coordinate> &coordinates, | ||||
|                                                const util::NameTable &name_table, | ||||
|                                                const SuffixTable &street_name_suffix_table, | ||||
|  | ||||
| @ -34,11 +34,9 @@ TurnAnalysis::TurnAnalysis(const util::NodeBasedDynamicGraph &node_based_graph, | ||||
|                            const util::NameTable &name_table, | ||||
|                            const SuffixTable &street_name_suffix_table, | ||||
|                            const ProfileProperties &profile_properties) | ||||
|     : node_based_graph(node_based_graph), intersection_generator(node_based_graph, | ||||
|                                                                  restriction_map, | ||||
|                                                                  barrier_nodes, | ||||
|                                                                  coordinates, | ||||
|                                                                  compressed_edge_container), | ||||
|     : node_based_graph(node_based_graph), | ||||
|       intersection_generator( | ||||
|           node_based_graph, restriction_map, barrier_nodes, coordinates, compressed_edge_container), | ||||
|       intersection_normalizer(node_based_graph, | ||||
|                               coordinates, | ||||
|                               name_table, | ||||
|  | ||||
| @ -42,7 +42,8 @@ std::size_t loadGraph(const std::string &path, | ||||
| 
 | ||||
|     auto nop = boost::make_function_output_iterator([](auto) {}); | ||||
| 
 | ||||
|     const auto number_of_nodes = util::loadNodesFromFile(file_reader, nop, nop, coordinate_list, osm_node_ids); | ||||
|     const auto number_of_nodes = | ||||
|         util::loadNodesFromFile(file_reader, nop, nop, coordinate_list, osm_node_ids); | ||||
| 
 | ||||
|     util::loadEdgesFromFile(file_reader, edge_list); | ||||
| 
 | ||||
| @ -75,9 +76,10 @@ struct FeatureWriter | ||||
|         out << "{\"type\":\"FeatureCollection\",\"features\":["; | ||||
|     } | ||||
| 
 | ||||
|     void | ||||
|     AddLine(const util::Coordinate from, const util::Coordinate to,  | ||||
|             const OSMNodeID from_id, const OSMNodeID to_id, | ||||
|     void AddLine(const util::Coordinate from, | ||||
|                  const util::Coordinate to, | ||||
|                  const OSMNodeID from_id, | ||||
|                  const OSMNodeID to_id, | ||||
|                  const std::string &type) | ||||
|     { | ||||
|         const auto from_lon = static_cast<double>(util::toFloating(from.lon)); | ||||
| @ -189,7 +191,11 @@ int main(int argc, char *argv[]) | ||||
|                     auto same_component = source_component_id == target_component_id; | ||||
|                     std::string type = same_component ? "inner" : "border"; | ||||
| 
 | ||||
|                     writer.AddLine(coordinate_list[source], coordinate_list[target], osm_node_ids[source], osm_node_ids[target], type); | ||||
|                     writer.AddLine(coordinate_list[source], | ||||
|                                    coordinate_list[target], | ||||
|                                    osm_node_ids[source], | ||||
|                                    osm_node_ids[target], | ||||
|                                    type); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user