From c7a1576100cb947af0e970644fb3f70dde63a9eb Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Tue, 26 Jul 2016 15:00:58 +0200 Subject: [PATCH] Apply clang-format again --- .../engine/datafacade/internal_datafacade.hpp | 2 +- .../engine/datafacade/shared_datafacade.hpp | 3 +- include/engine/guidance/assemble_steps.hpp | 3 +- .../extractor/extraction_helper_functions.hpp | 5 +- include/extractor/extraction_way.hpp | 2 +- include/extractor/extractor_callbacks.hpp | 7 ++- .../guidance/road_classification.hpp | 19 +++---- .../extractor/guidance/sliproad_handler.hpp | 3 +- include/extractor/guidance/turn_handler.hpp | 3 +- include/extractor/guidance/turn_lane_data.hpp | 2 +- .../extractor/guidance/turn_lane_types.hpp | 2 +- include/extractor/internal_extractor_edge.hpp | 1 - include/extractor/node_based_edge.hpp | 27 +++++----- include/extractor/query_node.hpp | 6 +-- .../extractor/scripting_environment_lua.hpp | 2 +- include/util/debug.hpp | 3 +- include/util/io.hpp | 2 +- include/util/static_rtree.hpp | 6 +-- include/util/strong_typedef.hpp | 52 +++++++++---------- include/util/typedefs.hpp | 3 +- src/contractor/contractor.cpp | 39 ++++++++------ src/engine/api/json_factory.cpp | 3 +- src/engine/guidance/post_processing.cpp | 4 +- src/engine/polyline_compressor.cpp | 6 ++- src/extractor/edge_based_graph_factory.cpp | 5 +- src/extractor/extractor.cpp | 4 +- src/extractor/extractor_callbacks.cpp | 2 +- src/extractor/graph_compressor.cpp | 13 +++-- .../guidance/intersection_handler.cpp | 2 +- src/extractor/guidance/motorway_handler.cpp | 2 +- src/extractor/guidance/sliproad_handler.cpp | 9 ++-- src/extractor/guidance/turn_analysis.cpp | 7 ++- src/extractor/guidance/turn_handler.cpp | 2 +- .../guidance/turn_lane_augmentation.cpp | 3 +- src/extractor/guidance/turn_lane_handler.cpp | 10 ++-- src/extractor/guidance/turn_lane_matcher.cpp | 2 +- src/extractor/raster_source.cpp | 5 +- src/storage/storage.cpp | 4 +- src/tools/contract.cpp | 2 +- src/tools/routed.cpp | 2 +- src/util/coordinate_calculation.cpp | 6 ++- unit_tests/util/packed_vector.cpp | 2 +- 42 files changed, 150 insertions(+), 137 deletions(-) diff --git a/include/engine/datafacade/internal_datafacade.hpp b/include/engine/datafacade/internal_datafacade.hpp index 92c2c7eb7..e7dc965d8 100644 --- a/include/engine/datafacade/internal_datafacade.hpp +++ b/include/engine/datafacade/internal_datafacade.hpp @@ -360,7 +360,7 @@ class InternalDataFacade final : public BaseDataFacade std::vector bearing_classes; // and the actual bearing values std::uint64_t num_bearings; - intersection_stream.read(reinterpret_cast(&num_bearings),sizeof(num_bearings)); + intersection_stream.read(reinterpret_cast(&num_bearings), sizeof(num_bearings)); m_bearing_values_table.resize(num_bearings); intersection_stream.read(reinterpret_cast(&m_bearing_values_table[0]), sizeof(m_bearing_values_table[0]) * num_bearings); diff --git a/include/engine/datafacade/shared_datafacade.hpp b/include/engine/datafacade/shared_datafacade.hpp index 91e2a0286..7872fae76 100644 --- a/include/engine/datafacade/shared_datafacade.hpp +++ b/include/engine/datafacade/shared_datafacade.hpp @@ -840,7 +840,8 @@ class SharedDataFacade final : public BaseDataFacade else return extractor::guidance::TurnLaneDescription( m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id], - m_lane_description_masks.begin() + m_lane_description_offsets[lane_description_id + 1]); + m_lane_description_masks.begin() + + m_lane_description_offsets[lane_description_id + 1]); } }; } diff --git a/include/engine/guidance/assemble_steps.hpp b/include/engine/guidance/assemble_steps.hpp index 2febaea60..98981cdf8 100644 --- a/include/engine/guidance/assemble_steps.hpp +++ b/include/engine/guidance/assemble_steps.hpp @@ -247,7 +247,8 @@ inline std::vector assembleSteps(const datafacade::BaseDataFacade &fa BOOST_ASSERT(steps.back().intersections.front().entry.size() == 1); BOOST_ASSERT(steps.back().maneuver.waypoint_type == WaypointType::Arrive); BOOST_ASSERT(steps.back().intersections.front().lanes.lanes_in_turn == 0); - BOOST_ASSERT(steps.back().intersections.front().lanes.first_lane_from_the_right == INVALID_LANEID); + BOOST_ASSERT(steps.back().intersections.front().lanes.first_lane_from_the_right == + INVALID_LANEID); BOOST_ASSERT(steps.back().intersections.front().lane_description.empty()); return steps; } diff --git a/include/extractor/extraction_helper_functions.hpp b/include/extractor/extraction_helper_functions.hpp index 766d93914..f3240dec9 100644 --- a/include/extractor/extraction_helper_functions.hpp +++ b/include/extractor/extraction_helper_functions.hpp @@ -107,12 +107,11 @@ trimLaneString(std::string lane_string, std::int32_t count_left, std::int32_t co return extractor::guidance::trimLaneString(std::move(lane_string), count_left, count_right); } -inline std::string -applyAccessTokens(const std::string &lane_string, const std::string &access_tokens) +inline std::string applyAccessTokens(const std::string &lane_string, + const std::string &access_tokens) { return extractor::guidance::applyAccessTokens(lane_string, access_tokens); } - } } diff --git a/include/extractor/extraction_way.hpp b/include/extractor/extraction_way.hpp index 0503acad9..9ac9da1c4 100644 --- a/include/extractor/extraction_way.hpp +++ b/include/extractor/extraction_way.hpp @@ -1,8 +1,8 @@ #ifndef EXTRACTION_WAY_HPP #define EXTRACTION_WAY_HPP -#include "extractor/travel_mode.hpp" #include "extractor/guidance/road_classification.hpp" +#include "extractor/travel_mode.hpp" #include "util/guidance/turn_lanes.hpp" #include "util/typedefs.hpp" diff --git a/include/extractor/extractor_callbacks.hpp b/include/extractor/extractor_callbacks.hpp index 2adfb7dc5..8268766f0 100644 --- a/include/extractor/extractor_callbacks.hpp +++ b/include/extractor/extractor_callbacks.hpp @@ -1,8 +1,8 @@ #ifndef EXTRACTOR_CALLBACKS_HPP #define EXTRACTOR_CALLBACKS_HPP -#include "util/typedefs.hpp" #include "extractor/guidance/turn_lane_types.hpp" +#include "util/typedefs.hpp" #include #include @@ -40,7 +40,10 @@ class ExtractorCallbacks using MapKey = std::pair; using MapVal = unsigned; std::unordered_map> string_map; - std::unordered_map lane_description_map; + std::unordered_map + lane_description_map; ExtractionContainers &external_memory; public: diff --git a/include/extractor/guidance/road_classification.hpp b/include/extractor/guidance/road_classification.hpp index baec6162e..08e583cf0 100644 --- a/include/extractor/guidance/road_classification.hpp +++ b/include/extractor/guidance/road_classification.hpp @@ -84,16 +84,10 @@ class RoadClassification bool IsLowPriorityRoadClass() const { return (0 != may_be_ignored); } void SetLowPriorityFlag(const bool new_value) { may_be_ignored = new_value; } - std::uint32_t GetPriority() const - { - return static_cast(road_priority_class); - } + std::uint32_t GetPriority() const { return static_cast(road_priority_class); } RoadPriorityClass::Enum GetClass() const { return road_priority_class; } - void SetClass(const RoadPriorityClass::Enum new_value) - { - road_priority_class = new_value; - } + void SetClass(const RoadPriorityClass::Enum new_value) { road_priority_class = new_value; } bool operator==(const RoadClassification &other) const { @@ -102,10 +96,7 @@ class RoadClassification road_priority_class == other.road_priority_class; } - bool operator!=(const RoadClassification &other ) const - { - return !(*this == other); - } + bool operator!=(const RoadClassification &other) const { return !(*this == other); } std::string ToString() const { @@ -116,7 +107,9 @@ class RoadClassification }; #pragma pack(pop) -static_assert(sizeof(RoadClassification) == 1,"Road Classification should fit a byte. Increasing this has a severe impact on memory."); +static_assert( + sizeof(RoadClassification) == 1, + "Road Classification should fit a byte. Increasing this has a severe impact on memory."); inline bool canBeSeenAsFork(const RoadClassification first, const RoadClassification second) { diff --git a/include/extractor/guidance/sliproad_handler.hpp b/include/extractor/guidance/sliproad_handler.hpp index 09d5ec2c5..cb7034706 100644 --- a/include/extractor/guidance/sliproad_handler.hpp +++ b/include/extractor/guidance/sliproad_handler.hpp @@ -2,8 +2,8 @@ #define OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_ #include "extractor/guidance/intersection.hpp" -#include "extractor/guidance/intersection_handler.hpp" #include "extractor/guidance/intersection_generator.hpp" +#include "extractor/guidance/intersection_handler.hpp" #include "extractor/query_node.hpp" #include "util/name_table.hpp" @@ -42,6 +42,7 @@ class SliproadHandler : public IntersectionHandler Intersection operator()(const NodeID nid, const EdgeID via_eid, Intersection intersection) const override final; + private: const IntersectionGenerator &intersection_generator; }; diff --git a/include/extractor/guidance/turn_handler.hpp b/include/extractor/guidance/turn_handler.hpp index e8858e64c..372e5c5ff 100644 --- a/include/extractor/guidance/turn_handler.hpp +++ b/include/extractor/guidance/turn_handler.hpp @@ -61,7 +61,8 @@ class TurnHandler : public IntersectionHandler handleDistinctConflict(const EdgeID via_edge, ConnectedRoad &left, ConnectedRoad &right) const; // Classification - std::pair findFork(const EdgeID via_edge, const Intersection &intersection) const; + std::pair findFork(const EdgeID via_edge, + const Intersection &intersection) const; Intersection assignLeftTurns(const EdgeID via_edge, Intersection intersection, diff --git a/include/extractor/guidance/turn_lane_data.hpp b/include/extractor/guidance/turn_lane_data.hpp index f1a7d7e12..66aaede6d 100644 --- a/include/extractor/guidance/turn_lane_data.hpp +++ b/include/extractor/guidance/turn_lane_data.hpp @@ -1,8 +1,8 @@ #ifndef OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_ #define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_DATA_HPP_ -#include "util/typedefs.hpp" #include "extractor/guidance/turn_lane_types.hpp" +#include "util/typedefs.hpp" #include #include diff --git a/include/extractor/guidance/turn_lane_types.hpp b/include/extractor/guidance/turn_lane_types.hpp index 3a06a3b10..d32a8e5c0 100644 --- a/include/extractor/guidance/turn_lane_types.hpp +++ b/include/extractor/guidance/turn_lane_types.hpp @@ -10,9 +10,9 @@ #include #include +#include "util/json_container.hpp" #include "util/simple_logger.hpp" #include "util/typedefs.hpp" -#include "util/json_container.hpp" namespace osrm { diff --git a/include/extractor/internal_extractor_edge.hpp b/include/extractor/internal_extractor_edge.hpp index ec95988d9..a915bc2ba 100644 --- a/include/extractor/internal_extractor_edge.hpp +++ b/include/extractor/internal_extractor_edge.hpp @@ -141,7 +141,6 @@ struct InternalExtractorEdge return v; } }; - } } diff --git a/include/extractor/node_based_edge.hpp b/include/extractor/node_based_edge.hpp index 07628cd5b..f1a658b93 100644 --- a/include/extractor/node_based_edge.hpp +++ b/include/extractor/node_based_edge.hpp @@ -112,20 +112,19 @@ inline bool NodeBasedEdge::operator<(const NodeBasedEdge &other) const return source < other.source; } -inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM( - OSMNodeID source, - OSMNodeID target, - NodeID name_id, - EdgeWeight weight, - bool forward, - bool backward, - bool roundabout, - bool access_restricted, - bool startpoint, - TravelMode travel_mode, - bool is_split, - const LaneDescriptionID lane_description_id, - guidance::RoadClassification road_classification) +inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source, + OSMNodeID target, + NodeID name_id, + EdgeWeight weight, + bool forward, + bool backward, + bool roundabout, + bool access_restricted, + bool startpoint, + TravelMode travel_mode, + bool is_split, + const LaneDescriptionID lane_description_id, + guidance::RoadClassification road_classification) : NodeBasedEdge(SPECIAL_NODEID, SPECIAL_NODEID, name_id, diff --git a/include/extractor/query_node.hpp b/include/extractor/query_node.hpp index f66d9c513..53c7adad7 100644 --- a/include/extractor/query_node.hpp +++ b/include/extractor/query_node.hpp @@ -5,8 +5,8 @@ #include "util/coordinate.hpp" -#include #include +#include namespace osrm { @@ -15,8 +15,8 @@ namespace extractor struct QueryNode { - using key_type = OSMNodeID; // type of NodeID - using value_type = std::int32_t; // type of lat,lons + using key_type = OSMNodeID; // type of NodeID + using value_type = std::int32_t; // type of lat,lons explicit QueryNode(const util::FixedLongitude lon_, const util::FixedLatitude lat_, diff --git a/include/extractor/scripting_environment_lua.hpp b/include/extractor/scripting_environment_lua.hpp index 908a4d5d2..c55a4b67c 100644 --- a/include/extractor/scripting_environment_lua.hpp +++ b/include/extractor/scripting_environment_lua.hpp @@ -48,7 +48,7 @@ class LuaScriptingEnvironment final : public ScriptingEnvironment explicit LuaScriptingEnvironment(const std::string &file_name); ~LuaScriptingEnvironment() override = default; - const ProfileProperties& GetProfileProperties() override; + const ProfileProperties &GetProfileProperties() override; LuaScriptingContext &GetLuaContext(); diff --git a/include/util/debug.hpp b/include/util/debug.hpp index 9dab0f3c7..89d3565e4 100644 --- a/include/util/debug.hpp +++ b/include/util/debug.hpp @@ -54,7 +54,7 @@ inline void print(const std::vector &steps) } } -inline void print( const extractor::guidance::Intersection & intersection ) +inline void print(const extractor::guidance::Intersection &intersection) { std::cout << " Intersection:\n"; for (const auto &road : intersection) @@ -62,7 +62,6 @@ inline void print( const extractor::guidance::Intersection & intersection ) std::cout << std::flush; } - inline void print(const extractor::guidance::lanes::LaneDataVector &turn_lane_data) { std::cout << " Tags:\n"; diff --git a/include/util/io.hpp b/include/util/io.hpp index cb4473dd4..e208f7c25 100644 --- a/include/util/io.hpp +++ b/include/util/io.hpp @@ -151,7 +151,7 @@ bool serializeVector(std::ofstream &out_stream, const stxxl::vector template bool deserializeAdjacencyArray(const std::string &filename, std::vector &offsets, - std::vector& data) + std::vector &data) { std::ifstream in_stream(filename, std::ios::binary); diff --git a/include/util/static_rtree.hpp b/include/util/static_rtree.hpp index 96cf01ed2..fb4da056f 100644 --- a/include/util/static_rtree.hpp +++ b/include/util/static_rtree.hpp @@ -192,9 +192,9 @@ class StaticRTree Coordinate current_centroid = coordinate_calculation::centroid( m_coordinate_list[current_element.u], m_coordinate_list[current_element.v]); - current_centroid.lat = - FixedLatitude{static_cast(COORDINATE_PRECISION * - web_mercator::latToY(toFloating(current_centroid.lat)))}; + current_centroid.lat = FixedLatitude{static_cast( + COORDINATE_PRECISION * + web_mercator::latToY(toFloating(current_centroid.lat)))}; current_wrapper.m_hilbert_value = hilbertCode(current_centroid); } diff --git a/include/util/strong_typedef.hpp b/include/util/strong_typedef.hpp index 0d45a2d41..02b1d622b 100644 --- a/include/util/strong_typedef.hpp +++ b/include/util/strong_typedef.hpp @@ -40,32 +40,32 @@ namespace osrm * etc. Also clarifies what this random "int" value is * being used for. */ -#define OSRM_STRONG_TYPEDEF(From, To) \ - struct To final \ - { \ - static_assert(std::is_arithmetic(), ""); \ - From __value; \ - friend std::ostream &operator<<(std::ostream &stream, const To &inst); \ - \ - explicit operator From &() { return __value; } \ - explicit operator From() const { return __value; } \ - To operator+(const To rhs_) const { return To{__value + static_cast(rhs_)}; } \ - To operator-(const To rhs_) const { return To{__value - static_cast(rhs_)}; } \ - To operator*(const To rhs_) const { return To{__value * static_cast(rhs_)}; } \ - To operator/(const To rhs_) const { return To{__value / static_cast(rhs_)}; } \ - bool operator<(const To z_) const { return __value < static_cast(z_); } \ - bool operator>(const To z_) const { return __value > static_cast(z_); } \ - bool operator<=(const To z_) const { return __value <= static_cast(z_); } \ - bool operator>=(const To z_) const { return __value >= static_cast(z_); } \ - bool operator==(const To z_) const { return __value == static_cast(z_); } \ - bool operator!=(const To z_) const { return __value != static_cast(z_); } \ - }; \ - static_assert(std::is_trivial(), #To " is not a trivial type"); \ - static_assert(std::is_standard_layout(), #To " is not a standart layout"); \ - static_assert(std::is_pod(), #To " is not a POD layout"); \ - inline std::ostream &operator<<(std::ostream &stream, const To &inst) \ - { \ - return stream << inst.__value; \ +#define OSRM_STRONG_TYPEDEF(From, To) \ + struct To final \ + { \ + static_assert(std::is_arithmetic(), ""); \ + From __value; \ + friend std::ostream &operator<<(std::ostream &stream, const To &inst); \ + \ + explicit operator From &() { return __value; } \ + explicit operator From() const { return __value; } \ + To operator+(const To rhs_) const { return To{__value + static_cast(rhs_)}; } \ + To operator-(const To rhs_) const { return To{__value - static_cast(rhs_)}; } \ + To operator*(const To rhs_) const { return To{__value * static_cast(rhs_)}; } \ + To operator/(const To rhs_) const { return To{__value / static_cast(rhs_)}; } \ + bool operator<(const To z_) const { return __value < static_cast(z_); } \ + bool operator>(const To z_) const { return __value > static_cast(z_); } \ + bool operator<=(const To z_) const { return __value <= static_cast(z_); } \ + bool operator>=(const To z_) const { return __value >= static_cast(z_); } \ + bool operator==(const To z_) const { return __value == static_cast(z_); } \ + bool operator!=(const To z_) const { return __value != static_cast(z_); } \ + }; \ + static_assert(std::is_trivial(), #To " is not a trivial type"); \ + static_assert(std::is_standard_layout(), #To " is not a standart layout"); \ + static_assert(std::is_pod(), #To " is not a POD layout"); \ + inline std::ostream &operator<<(std::ostream &stream, const To &inst) \ + { \ + return stream << inst.__value; \ } #define OSRM_STRONG_TYPEDEF_HASHABLE(From, To) \ diff --git a/include/util/typedefs.hpp b/include/util/typedefs.hpp index 2ffb57771..f4440c423 100644 --- a/include/util/typedefs.hpp +++ b/include/util/typedefs.hpp @@ -64,7 +64,8 @@ static const LaneID INVALID_LANEID = std::numeric_limits::max(); using LaneDataID = std::uint16_t; static const LaneDataID INVALID_LANE_DATAID = std::numeric_limits::max(); using LaneDescriptionID = std::uint16_t; -static const LaneDescriptionID INVALID_LANE_DESCRIPTIONID = std::numeric_limits::max(); +static const LaneDescriptionID INVALID_LANE_DESCRIPTIONID = + std::numeric_limits::max(); using BearingClassID = std::uint32_t; static const BearingClassID INVALID_BEARING_CLASSID = std::numeric_limits::max(); diff --git a/src/contractor/contractor.cpp b/src/contractor/contractor.cpp index e77a6b0a9..13bd739d0 100644 --- a/src/contractor/contractor.cpp +++ b/src/contractor/contractor.cpp @@ -261,9 +261,8 @@ parse_segment_lookup_from_csv_files(const std::vector &segment_spee if (!ok || it != last) throw util::exception{"Segment speed file " + filename + " malformed"}; - SegmentSpeedSource val{ - {OSMNodeID{from_node_id}, OSMNodeID{to_node_id}}, - {speed, static_cast(file_id)}}; + SegmentSpeedSource val{{OSMNodeID{from_node_id}, OSMNodeID{to_node_id}}, + {speed, static_cast(file_id)}}; local.push_back(std::move(val)); } @@ -382,7 +381,7 @@ EdgeID Contractor::LoadEdgeExpandedGraph( using boost::interprocess::mapped_region; using boost::interprocess::read_only; - const file_mapping mapping{ filename.c_str(), read_only }; + const file_mapping mapping{filename.c_str(), read_only}; mapped_region region{mapping, read_only}; region.advise(mapped_region::advice_sequential); return region; @@ -409,19 +408,21 @@ EdgeID Contractor::LoadEdgeExpandedGraph( return boost::interprocess::mapped_region(); }(); - // Set the struct packing to 1 byte word sizes. This prevents any padding. We only use - // this struct once, so any alignment penalty is trivial. If this is *not* done, then - // the struct will be padded out by an extra 4 bytes, and sizeof() will mean we read - // too much data from the original file. - #pragma pack(push, r1, 1) - struct EdgeBasedGraphHeader { +// Set the struct packing to 1 byte word sizes. This prevents any padding. We only use +// this struct once, so any alignment penalty is trivial. If this is *not* done, then +// the struct will be padded out by an extra 4 bytes, and sizeof() will mean we read +// too much data from the original file. +#pragma pack(push, r1, 1) + struct EdgeBasedGraphHeader + { util::FingerPrint fingerprint; std::uint64_t number_of_edges; EdgeID max_edge_id; }; - #pragma pack(pop, r1) +#pragma pack(pop, r1) - const EdgeBasedGraphHeader graph_header = *(reinterpret_cast(edge_based_graph_region.get_address())); + const EdgeBasedGraphHeader graph_header = + *(reinterpret_cast(edge_based_graph_region.get_address())); const util::FingerPrint fingerprint_valid = util::FingerPrint::GetValid(); graph_header.fingerprint.TestContractor(fingerprint_valid); @@ -737,14 +738,17 @@ EdgeID Contractor::LoadEdgeExpandedGraph( tbb::parallel_invoke(maybe_save_geometries, save_datasource_indexes, save_datastore_names); - auto penaltyblock = - reinterpret_cast(edge_penalty_region.get_address()); + auto penaltyblock = reinterpret_cast( + edge_penalty_region.get_address()); auto edge_segment_byte_ptr = reinterpret_cast(edge_segment_region.get_address()); auto edge_based_edge_ptr = reinterpret_cast( - reinterpret_cast(edge_based_graph_region.get_address()) + sizeof(EdgeBasedGraphHeader)); + reinterpret_cast(edge_based_graph_region.get_address()) + + sizeof(EdgeBasedGraphHeader)); const auto edge_based_edge_last = reinterpret_cast( - reinterpret_cast(edge_based_graph_region.get_address()) + sizeof(EdgeBasedGraphHeader) + sizeof(extractor::EdgeBasedEdge) * graph_header.number_of_edges); + reinterpret_cast(edge_based_graph_region.get_address()) + + sizeof(EdgeBasedGraphHeader) + + sizeof(extractor::EdgeBasedEdge) * graph_header.number_of_edges); while (edge_based_edge_ptr != edge_based_edge_last) { @@ -777,7 +781,8 @@ EdgeID Contractor::LoadEdgeExpandedGraph( { if (speed_iter->speed_source.speed > 0) { - auto new_segment_weight = distanceAndSpeedToWeight(segmentblocks[i].segment_length, speed_iter->speed_source.speed); + auto new_segment_weight = distanceAndSpeedToWeight( + segmentblocks[i].segment_length, speed_iter->speed_source.speed); new_weight += new_segment_weight; } else diff --git a/src/engine/api/json_factory.cpp b/src/engine/api/json_factory.cpp index 70579b7d9..7d0dfdf83 100644 --- a/src/engine/api/json_factory.cpp +++ b/src/engine/api/json_factory.cpp @@ -83,7 +83,8 @@ util::json::Array lanesFromIntersection(const guidance::Intersection &intersecti util::json::Object lane; lane.values["indications"] = extractor::guidance::TurnLaneType::toJsonArray(lane_desc); if (lane_id >= intersection.lanes.first_lane_from_the_right && - lane_id < intersection.lanes.first_lane_from_the_right + intersection.lanes.lanes_in_turn) + lane_id < + intersection.lanes.first_lane_from_the_right + intersection.lanes.lanes_in_turn) lane.values["valid"] = util::json::True(); else lane.values["valid"] = util::json::False(); diff --git a/src/engine/guidance/post_processing.cpp b/src/engine/guidance/post_processing.cpp index c05546a3f..05752669b 100644 --- a/src/engine/guidance/post_processing.cpp +++ b/src/engine/guidance/post_processing.cpp @@ -1,5 +1,5 @@ -#include "extractor/guidance/turn_instruction.hpp" #include "engine/guidance/post_processing.hpp" +#include "extractor/guidance/turn_instruction.hpp" #include "engine/guidance/assemble_steps.hpp" #include "engine/guidance/lane_processing.hpp" @@ -1161,7 +1161,7 @@ std::vector collapseUseLane(std::vector steps) { const auto previous = getPreviousIndex(step_index); steps[previous] = elongate(steps[previous], steps[step_index]); - //elongate(steps[step_index-1], steps[step_index]); + // elongate(steps[step_index-1], steps[step_index]); invalidateStep(steps[step_index]); } } diff --git a/src/engine/polyline_compressor.cpp b/src/engine/polyline_compressor.cpp index 701dac091..1dc9b7045 100644 --- a/src/engine/polyline_compressor.cpp +++ b/src/engine/polyline_compressor.cpp @@ -116,8 +116,10 @@ std::vector decodePolyline(const std::string &geometry_string) lng += dlng; util::Coordinate p; - p.lat = util::FixedLatitude{static_cast(lat * detail::POLYLINE_TO_COORDINATE)}; - p.lon = util::FixedLongitude{static_cast(lng * detail::POLYLINE_TO_COORDINATE)}; + p.lat = + util::FixedLatitude{static_cast(lat * detail::POLYLINE_TO_COORDINATE)}; + p.lon = + util::FixedLongitude{static_cast(lng * detail::POLYLINE_TO_COORDINATE)}; new_coordinates.push_back(p); } diff --git a/src/extractor/edge_based_graph_factory.cpp b/src/extractor/edge_based_graph_factory.cpp index 5c0673039..08b941d97 100644 --- a/src/extractor/edge_based_graph_factory.cpp +++ b/src/extractor/edge_based_graph_factory.cpp @@ -1,5 +1,5 @@ -#include "extractor/edge_based_edge.hpp" #include "extractor/edge_based_graph_factory.hpp" +#include "extractor/edge_based_edge.hpp" #include "util/coordinate.hpp" #include "util/coordinate_calculation.hpp" #include "util/exception.hpp" @@ -422,7 +422,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges( distance += profile_properties.traffic_signal_penalty; } - const int32_t turn_penalty = scripting_environment.GetTurnPenalty(180. - turn.angle); + const int32_t turn_penalty = + scripting_environment.GetTurnPenalty(180. - turn.angle); const auto turn_instruction = turn.instruction; if (turn_instruction.direction_modifier == guidance::DirectionModifier::UTurn) diff --git a/src/extractor/extractor.cpp b/src/extractor/extractor.cpp index 25e7c7666..e282c798e 100644 --- a/src/extractor/extractor.cpp +++ b/src/extractor/extractor.cpp @@ -83,7 +83,8 @@ int Extractor::run(ScriptingEnvironment &scripting_environment) tbb::task_scheduler_init init(number_of_threads); util::SimpleLogger().Write() << "Input file: " << config.input_path.filename().string(); - if (!config.profile_path.empty()) { + if (!config.profile_path.empty()) + { util::SimpleLogger().Write() << "Profile: " << config.profile_path.filename().string(); } util::SimpleLogger().Write() << "Threads: " << number_of_threads; @@ -151,7 +152,6 @@ int Extractor::run(ScriptingEnvironment &scripting_environment) resulting_ways, resulting_restrictions); - number_of_nodes += resulting_nodes.size(); // put parsed objects thru extractor callbacks for (const auto &result : resulting_nodes) diff --git a/src/extractor/extractor_callbacks.cpp b/src/extractor/extractor_callbacks.cpp index 0aa506c44..83cb358d0 100644 --- a/src/extractor/extractor_callbacks.cpp +++ b/src/extractor/extractor_callbacks.cpp @@ -1,8 +1,8 @@ +#include "extractor/extractor_callbacks.hpp" #include "extractor/external_memory_node.hpp" #include "extractor/extraction_containers.hpp" #include "extractor/extraction_node.hpp" #include "extractor/extraction_way.hpp" -#include "extractor/extractor_callbacks.hpp" #include "extractor/guidance/road_classification.hpp" #include "extractor/restriction.hpp" diff --git a/src/extractor/graph_compressor.cpp b/src/extractor/graph_compressor.cpp index 18af7fdb4..55554a235 100644 --- a/src/extractor/graph_compressor.cpp +++ b/src/extractor/graph_compressor.cpp @@ -160,7 +160,8 @@ void GraphCompressor::Compress(const std::unordered_set &barrier_nodes, * turn-lanes. Without this,we would have to treat any turn-lane beginning/ending just * like a barrier. */ - const auto selectLaneID = [](const LaneDescriptionID front, const LaneDescriptionID back) { + const auto selectLaneID = [](const LaneDescriptionID front, + const LaneDescriptionID back) { // A lane has tags: u - (front) - v - (back) - w // During contraction, we keep only one of the tags. Usually the one closer to the // intersection is preferred. If its empty, however, we keep the non-empty one @@ -168,10 +169,12 @@ void GraphCompressor::Compress(const std::unordered_set &barrier_nodes, return front; return back; }; - graph.GetEdgeData(forward_e1).lane_description_id = selectLaneID( - graph.GetEdgeData(forward_e1).lane_description_id, fwd_edge_data2.lane_description_id); - graph.GetEdgeData(reverse_e1).lane_description_id = selectLaneID( - graph.GetEdgeData(reverse_e1).lane_description_id, rev_edge_data2.lane_description_id); + graph.GetEdgeData(forward_e1).lane_description_id = + selectLaneID(graph.GetEdgeData(forward_e1).lane_description_id, + fwd_edge_data2.lane_description_id); + graph.GetEdgeData(reverse_e1).lane_description_id = + selectLaneID(graph.GetEdgeData(reverse_e1).lane_description_id, + rev_edge_data2.lane_description_id); // remove e2's (if bidir, otherwise only one) graph.DeleteEdge(node_v, forward_e2); diff --git a/src/extractor/guidance/intersection_handler.cpp b/src/extractor/guidance/intersection_handler.cpp index 1af73e5be..4a821665c 100644 --- a/src/extractor/guidance/intersection_handler.cpp +++ b/src/extractor/guidance/intersection_handler.cpp @@ -1,5 +1,5 @@ -#include "extractor/guidance/constants.hpp" #include "extractor/guidance/intersection_handler.hpp" +#include "extractor/guidance/constants.hpp" #include "extractor/guidance/toolkit.hpp" #include "util/guidance/toolkit.hpp" diff --git a/src/extractor/guidance/motorway_handler.cpp b/src/extractor/guidance/motorway_handler.cpp index 8cea47c48..253a1c2ad 100644 --- a/src/extractor/guidance/motorway_handler.cpp +++ b/src/extractor/guidance/motorway_handler.cpp @@ -1,5 +1,5 @@ -#include "extractor/guidance/constants.hpp" #include "extractor/guidance/motorway_handler.hpp" +#include "extractor/guidance/constants.hpp" #include "extractor/guidance/road_classification.hpp" #include "extractor/guidance/toolkit.hpp" diff --git a/src/extractor/guidance/sliproad_handler.cpp b/src/extractor/guidance/sliproad_handler.cpp index 27dc0b14c..e63ab4f5d 100644 --- a/src/extractor/guidance/sliproad_handler.cpp +++ b/src/extractor/guidance/sliproad_handler.cpp @@ -1,6 +1,6 @@ +#include "extractor/guidance/sliproad_handler.hpp" #include "extractor/guidance/constants.hpp" #include "extractor/guidance/intersection_scenario_three_way.hpp" -#include "extractor/guidance/sliproad_handler.hpp" #include "extractor/guidance/toolkit.hpp" #include "util/guidance/toolkit.hpp" @@ -74,8 +74,7 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection) const auto check_valid = [this, source_edge_data](const ConnectedRoad &road) { const auto road_edge_data = node_based_graph.GetEdgeData(road.turn.eid); // Test to see if the source edge and the one we're looking at are the same road - return road_edge_data.road_classification == - source_edge_data.road_classification && + return road_edge_data.road_classification == source_edge_data.road_classification && road_edge_data.name_id != EMPTY_NAMEID && road_edge_data.name_id == source_edge_data.name_id && road.entry_allowed; }; @@ -143,8 +142,8 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection) } else { - const auto skip_traffic_light_intersection = - intersection_generator(node_based_graph.GetTarget(candidate_in), candidate_road.turn.eid); + const auto skip_traffic_light_intersection = intersection_generator( + node_based_graph.GetTarget(candidate_in), candidate_road.turn.eid); if (skip_traffic_light_intersection.size() == 2 && node_based_graph.GetTarget( skip_traffic_light_intersection[1].turn.eid) == diff --git a/src/extractor/guidance/turn_analysis.cpp b/src/extractor/guidance/turn_analysis.cpp index e849b5875..69d989f32 100644 --- a/src/extractor/guidance/turn_analysis.cpp +++ b/src/extractor/guidance/turn_analysis.cpp @@ -1,6 +1,6 @@ -#include "extractor/guidance/road_classification.hpp" -#include "extractor/guidance/constants.hpp" #include "extractor/guidance/turn_analysis.hpp" +#include "extractor/guidance/constants.hpp" +#include "extractor/guidance/road_classification.hpp" #include "util/coordinate.hpp" #include "util/coordinate_calculation.hpp" @@ -86,8 +86,7 @@ Intersection TurnAnalysis::assignTurnTypes(const NodeID from_nid, intersection = sliproad_handler(from_nid, via_eid, std::move(intersection)); // Turn On Ramps Into Off Ramps, if we come from a motorway-like road - if (node_based_graph.GetEdgeData(via_eid) - .road_classification.IsMotorwayClass()) + if (node_based_graph.GetEdgeData(via_eid).road_classification.IsMotorwayClass()) { std::for_each(intersection.begin(), intersection.end(), [](ConnectedRoad &road) { if (road.turn.instruction.type == TurnType::OnRamp) diff --git a/src/extractor/guidance/turn_handler.cpp b/src/extractor/guidance/turn_handler.cpp index fac9f1255..e86276ebc 100644 --- a/src/extractor/guidance/turn_handler.cpp +++ b/src/extractor/guidance/turn_handler.cpp @@ -1,7 +1,7 @@ +#include "extractor/guidance/turn_handler.hpp" #include "extractor/guidance/constants.hpp" #include "extractor/guidance/intersection_scenario_three_way.hpp" #include "extractor/guidance/toolkit.hpp" -#include "extractor/guidance/turn_handler.hpp" #include "util/guidance/toolkit.hpp" diff --git a/src/extractor/guidance/turn_lane_augmentation.cpp b/src/extractor/guidance/turn_lane_augmentation.cpp index eee972c9f..e7fb7561a 100644 --- a/src/extractor/guidance/turn_lane_augmentation.cpp +++ b/src/extractor/guidance/turn_lane_augmentation.cpp @@ -268,7 +268,8 @@ LaneDataVector handleNoneValueAtSimpleTurn(LaneDataVector lane_data, ((intersection[0].entry_allowed && lane_data.back().tag != TurnLaneType::uturn) ? 1 : 0); // TODO check for impossible turns to see whether the turn lane is at the correct place - const std::size_t none_index = std::distance(lane_data.begin(), findTag(TurnLaneType::none, lane_data)); + const std::size_t none_index = + std::distance(lane_data.begin(), findTag(TurnLaneType::none, lane_data)); BOOST_ASSERT(none_index != lane_data.size()); // we have to create multiple turns if (connection_count > lane_data.size()) diff --git a/src/extractor/guidance/turn_lane_handler.cpp b/src/extractor/guidance/turn_lane_handler.cpp index e1d254474..852f91521 100644 --- a/src/extractor/guidance/turn_lane_handler.cpp +++ b/src/extractor/guidance/turn_lane_handler.cpp @@ -1,7 +1,7 @@ +#include "extractor/guidance/turn_lane_handler.hpp" #include "extractor/guidance/constants.hpp" #include "extractor/guidance/turn_discovery.hpp" #include "extractor/guidance/turn_lane_augmentation.hpp" -#include "extractor/guidance/turn_lane_handler.hpp" #include "extractor/guidance/turn_lane_matcher.hpp" #include "util/simple_logger.hpp" #include "util/typedefs.hpp" @@ -63,8 +63,8 @@ Intersection TurnLaneHandler::assignTurnLanes(const NodeID at, Intersection intersection, LaneDataIdMap &id_map) const { - //if only a uturn exists, there is nothing we can do - if( intersection.size() == 1 ) + // if only a uturn exists, there is nothing we can do + if (intersection.size() == 1) return intersection; const auto &data = node_based_graph.GetEdgeData(via_edge); @@ -77,7 +77,9 @@ Intersection TurnLaneHandler::assignTurnLanes(const NodeID at, turn_lane_masks.begin() + turn_lane_offsets[data.lane_description_id + 1]) : TurnLaneDescription(); - BOOST_ASSERT( turn_lane_description.empty() || turn_lane_description.size() == (turn_lane_offsets[data.lane_description_id+1] - turn_lane_offsets[data.lane_description_id])); + BOOST_ASSERT(turn_lane_description.empty() || + turn_lane_description.size() == (turn_lane_offsets[data.lane_description_id + 1] - + turn_lane_offsets[data.lane_description_id])); // going straight, due to traffic signals, we can have uncompressed geometry if (intersection.size() == 2 && diff --git a/src/extractor/guidance/turn_lane_matcher.cpp b/src/extractor/guidance/turn_lane_matcher.cpp index 7b0d41355..5dffafb40 100644 --- a/src/extractor/guidance/turn_lane_matcher.cpp +++ b/src/extractor/guidance/turn_lane_matcher.cpp @@ -1,5 +1,5 @@ -#include "extractor/guidance/toolkit.hpp" #include "extractor/guidance/turn_lane_matcher.hpp" +#include "extractor/guidance/toolkit.hpp" #include "util/guidance/toolkit.hpp" #include diff --git a/src/extractor/raster_source.cpp b/src/extractor/raster_source.cpp index ee54b4adf..9570ca4fb 100644 --- a/src/extractor/raster_source.cpp +++ b/src/extractor/raster_source.cpp @@ -154,8 +154,9 @@ SourceContainer::GetRasterInterpolateFromSource(unsigned int source_id, double l BOOST_ASSERT(lon > -180); const auto &found = LoadedSources[source_id]; - return found.GetRasterInterpolate(static_cast(util::toFixed(util::FloatLongitude{lon})), - static_cast(util::toFixed(util::FloatLatitude{lat}))); + return found.GetRasterInterpolate( + static_cast(util::toFixed(util::FloatLongitude{lon})), + static_cast(util::toFixed(util::FloatLatitude{lat}))); } } } diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index 119549db9..3f27284aa 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -1,3 +1,4 @@ +#include "storage/storage.hpp" #include "contractor/query_edge.hpp" #include "extractor/compressed_edge_container.hpp" #include "extractor/guidance/turn_instruction.hpp" @@ -8,7 +9,6 @@ #include "storage/shared_barriers.hpp" #include "storage/shared_datatype.hpp" #include "storage/shared_memory.hpp" -#include "storage/storage.hpp" #include "engine/datafacade/datafacade_base.hpp" #include "util/coordinate.hpp" #include "util/exception.hpp" @@ -375,7 +375,7 @@ int Storage::Run() } std::uint64_t num_bearings; - intersection_stream.read(reinterpret_cast(&num_bearings),sizeof(num_bearings)); + intersection_stream.read(reinterpret_cast(&num_bearings), sizeof(num_bearings)); std::vector bearing_class_table(num_bearings); intersection_stream.read(reinterpret_cast(&bearing_class_table[0]), diff --git a/src/tools/contract.cpp b/src/tools/contract.cpp index 81beb4abd..bfd3d2df9 100644 --- a/src/tools/contract.cpp +++ b/src/tools/contract.cpp @@ -85,7 +85,7 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig .run(), option_variables); } - catch(boost::program_options::error& e) + catch (boost::program_options::error &e) { util::SimpleLogger().Write(logWARNING) << "[error] " << e.what(); return return_code::fail; diff --git a/src/tools/routed.cpp b/src/tools/routed.cpp index e29c331c7..a18fe2e23 100644 --- a/src/tools/routed.cpp +++ b/src/tools/routed.cpp @@ -130,7 +130,7 @@ inline unsigned generateServerProgramOptions(const int argc, .run(), option_variables); } - catch(boost::program_options::error& e) + catch (boost::program_options::error &e) { util::SimpleLogger().Write(logWARNING) << "[error] " << e.what(); return INIT_FAILED; diff --git a/src/util/coordinate_calculation.cpp b/src/util/coordinate_calculation.cpp index 029129bfb..9dff34a1c 100644 --- a/src/util/coordinate_calculation.cpp +++ b/src/util/coordinate_calculation.cpp @@ -284,8 +284,10 @@ Coordinate interpolateLinear(double factor, const Coordinate from, const Coordin const auto to_lon = static_cast(to.lon); const auto to_lat = static_cast(to.lat); - FixedLongitude interpolated_lon{static_cast(from_lon + factor * (to_lon - from_lon))}; - FixedLatitude interpolated_lat{static_cast(from_lat + factor * (to_lat - from_lat))}; + FixedLongitude interpolated_lon{ + static_cast(from_lon + factor * (to_lon - from_lon))}; + FixedLatitude interpolated_lat{ + static_cast(from_lat + factor * (to_lat - from_lat))}; return {std::move(interpolated_lon), std::move(interpolated_lat)}; } diff --git a/unit_tests/util/packed_vector.cpp b/unit_tests/util/packed_vector.cpp index e95bc03a7..adb58d4f1 100644 --- a/unit_tests/util/packed_vector.cpp +++ b/unit_tests/util/packed_vector.cpp @@ -19,7 +19,7 @@ BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test) for (std::size_t i = 0; i < num_test_cases; i++) { - OSMNodeID r {static_cast(rand() % 2147483647)}; // max 33-bit uint + OSMNodeID r{static_cast(rand() % 2147483647)}; // max 33-bit uint packed_ids.push_back(r); original_ids.push_back(r);