From 7c30ea32bf428fe861a790dbc10a5cacb887e109 Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Thu, 3 Mar 2016 14:26:13 +0100 Subject: [PATCH] Runs scripts/format.sh --- example/example.cpp | 2 +- include/contractor/graph_contractor.hpp | 15 +-- include/engine/api/match_parameters.hpp | 15 ++- include/engine/api/nearest_api.hpp | 19 +-- include/engine/api/route_parameters.hpp | 9 +- include/engine/api/table_api.hpp | 23 ++-- include/engine/api/tile_parameters.hpp | 6 +- include/engine/api/trip_parameters.hpp | 3 +- include/engine/datafacade/datafacade_base.hpp | 2 +- .../engine/datafacade/internal_datafacade.hpp | 24 ++-- .../engine/datafacade/shared_datafacade.hpp | 33 +++-- include/engine/geospatial_query.hpp | 32 +++-- include/engine/guidance/assemble_leg.hpp | 1 + include/engine/guidance/assemble_route.hpp | 29 +++-- include/engine/guidance/assemble_steps.hpp | 54 +++----- include/engine/guidance/route.hpp | 10 +- include/engine/guidance/route_leg.hpp | 1 - include/engine/guidance/route_step.hpp | 1 - .../map_matching/matching_confidence.hpp | 6 +- include/engine/map_matching/sub_matching.hpp | 1 - include/engine/plugins/trip.hpp | 1 - .../routing_algorithms/many_to_many.hpp | 8 +- .../routing_algorithms/map_matching.hpp | 6 +- .../routing_algorithms/routing_base.hpp | 4 +- .../routing_algorithms/shortest_path.hpp | 10 +- include/engine/status.hpp | 1 - .../extractor/compressed_edge_container.hpp | 11 +- include/extractor/guidance/toolkit.hpp | 16 +-- include/osrm/engine_config.hpp | 3 +- include/osrm/json_container.hpp | 2 +- include/osrm/match_parameters.hpp | 2 +- include/osrm/nearest_parameters.hpp | 2 +- include/osrm/route_parameters.hpp | 2 +- include/osrm/status.hpp | 2 +- include/osrm/table_parameters.hpp | 2 +- include/osrm/trip_parameters.hpp | 2 +- .../server/api/base_parameters_grammar.hpp | 30 +++-- .../server/api/match_parameter_grammar.hpp | 7 +- .../server/api/nearest_parameter_grammar.hpp | 3 +- .../server/api/route_parameters_grammar.hpp | 3 +- .../server/api/table_parameter_grammar.hpp | 9 +- include/server/api/tile_parameter_grammar.hpp | 23 ++-- include/server/api/trip_parameter_grammar.hpp | 3 +- include/server/api/url_parser.hpp | 3 +- include/server/service/utils.hpp | 2 - include/server/service_handler.hpp | 1 - include/storage/storage.hpp | 7 +- include/util/rectangle.hpp | 8 +- src/engine/api/json_factory.cpp | 10 +- src/engine/plugins/viaroute.cpp | 4 +- src/engine/polyline_compressor.cpp | 11 +- src/extractor/compressed_edge_container.cpp | 12 +- src/extractor/extractor.cpp | 3 +- src/extractor/extractor_callbacks.cpp | 20 ++- src/extractor/graph_compressor.cpp | 11 +- src/server/request_handler.cpp | 27 ++-- src/server/request_parser.cpp | 3 +- src/server/service/match_service.cpp | 2 +- src/server/service/nearest_service.cpp | 2 +- src/server/service_handler.cpp | 3 +- src/storage/storage.cpp | 9 +- src/tools/components.cpp | 13 +- src/tools/extract.cpp | 14 ++- src/tools/io-benchmark.cpp | 31 ++--- src/tools/springclean.cpp | 8 +- unit_tests/mocks/mock_datafacade.hpp | 77 +++++++----- unit_tests/server/parameters_parser.cpp | 116 +++++++++++------- unit_tests/util/io.cpp | 3 +- unit_tests/util/static_graph.cpp | 4 +- unit_tests/util/static_rtree.cpp | 14 ++- 70 files changed, 457 insertions(+), 399 deletions(-) diff --git a/example/example.cpp b/example/example.cpp index 2bb1392ba..b2f1a1543 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -38,7 +38,7 @@ int main(int argc, const char *argv[]) try // The following shows how to use the Route service; configure this service RouteParameters params; - // Rout in monaco + // Route in monaco params.coordinates.push_back({util::FloatLongitude(7.419758), util::FloatLatitude(43.731142)}); params.coordinates.push_back({util::FloatLongitude(7.419505), util::FloatLatitude(43.736825)}); diff --git a/include/contractor/graph_contractor.hpp b/include/contractor/graph_contractor.hpp index 541d9e74b..26be61d6b 100644 --- a/include/contractor/graph_contractor.hpp +++ b/include/contractor/graph_contractor.hpp @@ -142,9 +142,9 @@ class GraphContractor template GraphContractor(int nodes, - ContainerT &input_edge_list, - std::vector &&node_levels_, - std::vector &&node_weights_) + ContainerT &input_edge_list, + std::vector &&node_levels_, + std::vector &&node_weights_) : node_levels(std::move(node_levels_)), node_weights(std::move(node_weights_)) { std::vector edges; @@ -239,7 +239,8 @@ class GraphContractor } } } - util::SimpleLogger().Write() << "merged " << edges.size() - edge << " edges out of " << edges.size(); + util::SimpleLogger().Write() << "merged " << edges.size() - edge << " edges out of " + << edges.size(); edges.resize(edge); contractor_graph = std::make_shared(nodes, edges); edges.clear(); @@ -696,7 +697,7 @@ class GraphContractor // New Node discovered -> Add to Heap + Node Info Storage if (!heap.WasInserted(to)) { - heap.Insert(to, to_distance, ContractorHeapData {current_hop, false}); + heap.Insert(to, to_distance, ContractorHeapData{current_hop, false}); } // Found a shorter Path -> Update distance else if (to_distance < heap.GetKey(to)) @@ -803,7 +804,7 @@ class GraphContractor } heap.Clear(); - heap.Insert(source, 0, ContractorHeapData {}); + heap.Insert(source, 0, ContractorHeapData{}); int max_distance = 0; unsigned number_of_targets = 0; @@ -858,7 +859,7 @@ class GraphContractor max_distance = std::max(max_distance, path_distance); if (!heap.WasInserted(target)) { - heap.Insert(target, INVALID_EDGE_WEIGHT, ContractorHeapData {0, true}); + heap.Insert(target, INVALID_EDGE_WEIGHT, ContractorHeapData{0, true}); ++number_of_targets; } } diff --git a/include/engine/api/match_parameters.hpp b/include/engine/api/match_parameters.hpp index 884157d3d..ddefb1197 100644 --- a/include/engine/api/match_parameters.hpp +++ b/include/engine/api/match_parameters.hpp @@ -15,13 +15,16 @@ namespace api struct MatchParameters : public RouteParameters { MatchParameters() - : RouteParameters(false, false, RouteParameters::GeometriesType::Polyline, RouteParameters::OverviewType::Simplified, {}) + : RouteParameters(false, + false, + RouteParameters::GeometriesType::Polyline, + RouteParameters::OverviewType::Simplified, + {}) { } - template - MatchParameters(std::vector timestamps_, - Args... args_) + template + MatchParameters(std::vector timestamps_, Args... args_) : RouteParameters{std::forward(args_)...}, timestamps{std::move(timestamps_)} { } @@ -29,10 +32,10 @@ struct MatchParameters : public RouteParameters std::vector timestamps; bool IsValid() const { - return RouteParameters::IsValid() && (timestamps.empty() || timestamps.size() == coordinates.size()); + return RouteParameters::IsValid() && + (timestamps.empty() || timestamps.size() == coordinates.size()); } }; - } } } diff --git a/include/engine/api/nearest_api.hpp b/include/engine/api/nearest_api.hpp index a530c2e30..50cb1be1c 100644 --- a/include/engine/api/nearest_api.hpp +++ b/include/engine/api/nearest_api.hpp @@ -26,20 +26,23 @@ class NearestAPI final : public BaseAPI { } - void MakeResponse(const std::vector> &phantom_nodes, util::json::Object& response) const + void MakeResponse(const std::vector> &phantom_nodes, + util::json::Object &response) const { BOOST_ASSERT(phantom_nodes.size() == 1); BOOST_ASSERT(parameters.coordinates.size() == 1); util::json::Array waypoints; waypoints.values.resize(phantom_nodes.front().size()); - std::transform(phantom_nodes.front().begin(), - phantom_nodes.front().end(), waypoints.values.begin(), [this](const PhantomNodeWithDistance& phantom_with_distance) - { - auto waypoint = MakeWaypoint(parameters.coordinates.front(), phantom_with_distance.phantom_node); - waypoint.values["distance"] = phantom_with_distance.distance; - return waypoint; - }); + std::transform(phantom_nodes.front().begin(), phantom_nodes.front().end(), + waypoints.values.begin(), + [this](const PhantomNodeWithDistance &phantom_with_distance) + { + auto waypoint = MakeWaypoint(parameters.coordinates.front(), + phantom_with_distance.phantom_node); + waypoint.values["distance"] = phantom_with_distance.distance; + return waypoint; + }); response.values["code"] = "ok"; response.values["waypoints"] = std::move(waypoints); diff --git a/include/engine/api/route_parameters.hpp b/include/engine/api/route_parameters.hpp index 1f18dcc4a..ccb0e49f2 100644 --- a/include/engine/api/route_parameters.hpp +++ b/include/engine/api/route_parameters.hpp @@ -28,14 +28,15 @@ struct RouteParameters : public BaseParameters RouteParameters() = default; - template + template RouteParameters(const bool steps_, const bool alternative_, const GeometriesType geometries_, const OverviewType overview_, - std::vector> uturns_, Args... args_) - : BaseParameters{std::forward(args_)...}, steps{steps_}, alternative{alternative_}, geometries{geometries_}, - overview{overview_}, uturns{std::move(uturns_)} + std::vector> uturns_, + Args... args_) + : BaseParameters{std::forward(args_)...}, steps{steps_}, alternative{alternative_}, + geometries{geometries_}, overview{overview_}, uturns{std::move(uturns_)} { } diff --git a/include/engine/api/table_api.hpp b/include/engine/api/table_api.hpp index 7f89c695d..4f29eb540 100644 --- a/include/engine/api/table_api.hpp +++ b/include/engine/api/table_api.hpp @@ -37,7 +37,8 @@ class TableAPI final : public BaseAPI util::json::Object &response) const { auto number_of_sources = parameters.sources.size(); - auto number_of_destinations = parameters.destinations.size();; + auto number_of_destinations = parameters.destinations.size(); + ; // symmetric case if (parameters.sources.empty()) @@ -60,7 +61,8 @@ class TableAPI final : public BaseAPI response.values["destinations"] = MakeWaypoints(phantoms, parameters.destinations); } - response.values["durations"] = MakeTable(durations, number_of_sources, number_of_destinations); + response.values["durations"] = + MakeTable(durations, number_of_sources, number_of_destinations); response.values["code"] = "ok"; } @@ -105,14 +107,15 @@ class TableAPI final : public BaseAPI auto row_begin_iterator = values.begin() + (row * number_of_columns); auto row_end_iterator = values.begin() + ((row + 1) * number_of_columns); json_row.values.resize(number_of_columns); - std::transform(row_begin_iterator, row_end_iterator, json_row.values.begin(), [](const EdgeWeight duration) - { - if (duration == INVALID_EDGE_WEIGHT) - { - return util::json::Value(util::json::Null()); - } - return util::json::Value(util::json::Number(duration / 10.)); - }); + std::transform(row_begin_iterator, row_end_iterator, json_row.values.begin(), + [](const EdgeWeight duration) + { + if (duration == INVALID_EDGE_WEIGHT) + { + return util::json::Value(util::json::Null()); + } + return util::json::Value(util::json::Number(duration / 10.)); + }); json_table.values.push_back(std::move(json_row)); } return json_table; diff --git a/include/engine/api/tile_parameters.hpp b/include/engine/api/tile_parameters.hpp index 5b82debcf..4d19ad53b 100644 --- a/include/engine/api/tile_parameters.hpp +++ b/include/engine/api/tile_parameters.hpp @@ -15,12 +15,8 @@ struct TileParameters final unsigned z; // FIXME check if x and y work with z - bool IsValid() - { - return z < 20; - }; + bool IsValid() { return z < 20; }; }; - } } } diff --git a/include/engine/api/trip_parameters.hpp b/include/engine/api/trip_parameters.hpp index 408fbf7fd..2bbca5d51 100644 --- a/include/engine/api/trip_parameters.hpp +++ b/include/engine/api/trip_parameters.hpp @@ -14,9 +14,8 @@ namespace api struct TripParameters : public RouteParameters { - //bool IsValid() const; Falls back to base class + // bool IsValid() const; Falls back to base class }; - } } } diff --git a/include/engine/datafacade/datafacade_base.hpp b/include/engine/datafacade/datafacade_base.hpp index 25be82293..8da09f405 100644 --- a/include/engine/datafacade/datafacade_base.hpp +++ b/include/engine/datafacade/datafacade_base.hpp @@ -74,7 +74,7 @@ class BaseDataFacade // Gets the weight values for each segment in an uncompressed geometry. // Should always be 1 shorter than GetUncompressedGeometry virtual void GetUncompressedWeights(const EdgeID id, - std::vector &result_weights) const = 0; + std::vector &result_weights) const = 0; virtual extractor::guidance::TurnInstruction GetTurnInstructionForEdgeID(const unsigned id) const = 0; diff --git a/include/engine/datafacade/internal_datafacade.hpp b/include/engine/datafacade/internal_datafacade.hpp index fbe699766..1ce06f21c 100644 --- a/include/engine/datafacade/internal_datafacade.hpp +++ b/include/engine/datafacade/internal_datafacade.hpp @@ -208,7 +208,8 @@ class InternalDataFacade final : public BaseDataFacade if (number_of_compressed_geometries > 0) { geometry_stream.read((char *)&(m_geometry_list[0]), - number_of_compressed_geometries * sizeof(extractor::CompressedEdgeContainer::CompressedEdge)); + number_of_compressed_geometries * + sizeof(extractor::CompressedEdgeContainer::CompressedEdge)); } } @@ -217,7 +218,8 @@ class InternalDataFacade final : public BaseDataFacade BOOST_ASSERT_MSG(!m_coordinate_list->empty(), "coordinates must be loaded before r-tree"); m_static_rtree.reset(new InternalRTree(ram_index_path, file_index_path, m_coordinate_list)); - m_geospatial_query.reset(new InternalGeospatialQuery(*m_static_rtree, m_coordinate_list, *this)); + m_geospatial_query.reset( + new InternalGeospatialQuery(*m_static_rtree, m_coordinate_list, *this)); } void LoadStreetNames(const boost::filesystem::path &names_file) @@ -553,19 +555,27 @@ class InternalDataFacade final : public BaseDataFacade result_nodes.clear(); result_nodes.reserve(end - begin); - std::for_each(m_geometry_list.begin() + begin, m_geometry_list.begin() + end, [&](const osrm::extractor::CompressedEdgeContainer::CompressedEdge &edge){ result_nodes.emplace_back(edge.node_id); }); + std::for_each(m_geometry_list.begin() + begin, m_geometry_list.begin() + end, + [&](const osrm::extractor::CompressedEdgeContainer::CompressedEdge &edge) + { + result_nodes.emplace_back(edge.node_id); + }); } - virtual void GetUncompressedWeights(const EdgeID id, - std::vector &result_weights) const override final + virtual void + GetUncompressedWeights(const EdgeID id, + std::vector &result_weights) const override final { const unsigned begin = m_geometry_indices.at(id); const unsigned end = m_geometry_indices.at(id + 1); result_weights.clear(); result_weights.reserve(end - begin); - std::for_each(m_geometry_list.begin() + begin, m_geometry_list.begin() + end, [&](const osrm::extractor::CompressedEdgeContainer::CompressedEdge &edge){ result_weights.emplace_back(edge.weight); }); - + std::for_each(m_geometry_list.begin() + begin, m_geometry_list.begin() + end, + [&](const osrm::extractor::CompressedEdgeContainer::CompressedEdge &edge) + { + result_weights.emplace_back(edge.weight); + }); } std::string GetTimestamp() const override final { return m_timestamp; } diff --git a/include/engine/datafacade/shared_datafacade.hpp b/include/engine/datafacade/shared_datafacade.hpp index d0bdfbbf8..530b0784d 100644 --- a/include/engine/datafacade/shared_datafacade.hpp +++ b/include/engine/datafacade/shared_datafacade.hpp @@ -218,10 +218,10 @@ class SharedDataFacade final : public BaseDataFacade auto geometries_list_ptr = data_layout->GetBlockPtr( - shared_memory, storage::SharedDataLayout::GEOMETRIES_LIST); - typename util::ShM::vector geometry_list( - geometries_list_ptr, - data_layout->num_entries[storage::SharedDataLayout::GEOMETRIES_LIST]); + shared_memory, storage::SharedDataLayout::GEOMETRIES_LIST); + typename util::ShM::vector + geometry_list(geometries_list_ptr, + data_layout->num_entries[storage::SharedDataLayout::GEOMETRIES_LIST]); m_geometry_list = std::move(geometry_list); } @@ -239,7 +239,8 @@ class SharedDataFacade final : public BaseDataFacade } data_timestamp_ptr = static_cast( storage::makeSharedMemory(storage::CURRENT_REGIONS, - sizeof(storage::SharedDataTimestamp), false, false)->Ptr()); + sizeof(storage::SharedDataTimestamp), false, false) + ->Ptr()); CURRENT_LAYOUT = storage::LAYOUT_NONE; CURRENT_DATA = storage::DATA_NONE; CURRENT_TIMESTAMP = 0; @@ -310,8 +311,8 @@ class SharedDataFacade final : public BaseDataFacade LoadNames(); LoadCoreInformation(); - util::SimpleLogger().Write() - << "number of geometries: " << m_coordinate_list->size(); + util::SimpleLogger().Write() << "number of geometries: " + << m_coordinate_list->size(); for (unsigned i = 0; i < m_coordinate_list->size(); ++i) { if (!GetCoordinateOfNode(i).IsValid()) @@ -381,19 +382,27 @@ class SharedDataFacade final : public BaseDataFacade result_nodes.clear(); result_nodes.reserve(end - begin); - std::for_each(m_geometry_list.begin() + begin, m_geometry_list.begin() + end, [&](const osrm::extractor::CompressedEdgeContainer::CompressedEdge &edge){ result_nodes.emplace_back(edge.node_id); }); + std::for_each(m_geometry_list.begin() + begin, m_geometry_list.begin() + end, + [&](const osrm::extractor::CompressedEdgeContainer::CompressedEdge &edge) + { + result_nodes.emplace_back(edge.node_id); + }); } - virtual void GetUncompressedWeights(const EdgeID id, - std::vector &result_weights) const override final + virtual void + GetUncompressedWeights(const EdgeID id, + std::vector &result_weights) const override final { const unsigned begin = m_geometry_indices.at(id); const unsigned end = m_geometry_indices.at(id + 1); result_weights.clear(); result_weights.reserve(end - begin); - std::for_each(m_geometry_list.begin() + begin, m_geometry_list.begin() + end, [&](const osrm::extractor::CompressedEdgeContainer::CompressedEdge &edge){ result_weights.emplace_back(edge.weight); }); - + std::for_each(m_geometry_list.begin() + begin, m_geometry_list.begin() + end, + [&](const osrm::extractor::CompressedEdgeContainer::CompressedEdge &edge) + { + result_weights.emplace_back(edge.weight); + }); } virtual unsigned GetGeometryIndexForEdgeID(const unsigned id) const override final diff --git a/include/engine/geospatial_query.hpp b/include/engine/geospatial_query.hpp index fb99ad4e0..7b6c015fd 100644 --- a/include/engine/geospatial_query.hpp +++ b/include/engine/geospatial_query.hpp @@ -28,7 +28,9 @@ template class GeospatialQuery using CoordinateList = typename RTreeT::CoordinateList; public: - GeospatialQuery(RTreeT &rtree_, std::shared_ptr coordinates_, DataFacadeT &datafacade_) + GeospatialQuery(RTreeT &rtree_, + std::shared_ptr coordinates_, + DataFacadeT &datafacade_) : rtree(rtree_), coordinates(std::move(coordinates_)), datafacade(datafacade_) { } @@ -352,10 +354,11 @@ template class GeospatialQuery int forward_offset = 0, forward_weight = 0; int reverse_offset = 0, reverse_weight = 0; - if (data.forward_packed_geometry_id != SPECIAL_EDGEID) { + if (data.forward_packed_geometry_id != SPECIAL_EDGEID) + { std::vector forward_weight_vector; datafacade.GetUncompressedWeights(data.forward_packed_geometry_id, - forward_weight_vector); + forward_weight_vector); for (std::size_t i = 0; i < data.fwd_segment_position; i++) { forward_offset += forward_weight_vector[i]; @@ -363,32 +366,37 @@ template class GeospatialQuery forward_weight = forward_weight_vector[data.fwd_segment_position]; } - if (data.reverse_packed_geometry_id != SPECIAL_EDGEID) { + if (data.reverse_packed_geometry_id != SPECIAL_EDGEID) + { std::vector reverse_weight_vector; datafacade.GetUncompressedWeights(data.reverse_packed_geometry_id, reverse_weight_vector); BOOST_ASSERT(data.fwd_segment_position < reverse_weight_vector.size()); - for (std::size_t i = 0; i < reverse_weight_vector.size() - data.fwd_segment_position - 1; i++) + for (std::size_t i = 0; + i < reverse_weight_vector.size() - data.fwd_segment_position - 1; i++) { reverse_offset += reverse_weight_vector[i]; } - reverse_weight = reverse_weight_vector[reverse_weight_vector.size() - - data.fwd_segment_position - 1]; + reverse_weight = + reverse_weight_vector[reverse_weight_vector.size() - data.fwd_segment_position - 1]; } ratio = std::min(1.0, std::max(0.0, ratio)); - if (SPECIAL_NODEID != data.forward_edge_based_node_id) { + if (SPECIAL_NODEID != data.forward_edge_based_node_id) + { forward_weight *= ratio; } - if (SPECIAL_NODEID != data.reverse_edge_based_node_id) { + if (SPECIAL_NODEID != data.reverse_edge_based_node_id) + { reverse_weight *= 1.0 - ratio; } - auto transformed = PhantomNodeWithDistance{PhantomNode{data, forward_weight, forward_offset, - reverse_weight, reverse_offset, point_on_segment}, - current_perpendicular_distance}; + auto transformed = + PhantomNodeWithDistance{PhantomNode{data, forward_weight, forward_offset, + reverse_weight, reverse_offset, point_on_segment}, + current_perpendicular_distance}; return transformed; } diff --git a/include/engine/guidance/assemble_leg.hpp b/include/engine/guidance/assemble_leg.hpp index fc91aac7b..318e5da4e 100644 --- a/include/engine/guidance/assemble_leg.hpp +++ b/include/engine/guidance/assemble_leg.hpp @@ -134,6 +134,7 @@ RouteLeg assembleLeg(const DataFacadeT &facade, // `forward_weight`: duration of (d,t) // `forward_offset`: duration of (c, d) // + // TODO discuss, this should not be the case after danpats fixes // The PathData will contain entries of b, c and d. But only c will contain // a duration value since its the only point associated with a turn. // As such we want to slice of the duration for (a,s) and add the duration for diff --git a/include/engine/guidance/assemble_route.hpp b/include/engine/guidance/assemble_route.hpp index 360d8e4d6..7d71d4623 100644 --- a/include/engine/guidance/assemble_route.hpp +++ b/include/engine/guidance/assemble_route.hpp @@ -13,22 +13,21 @@ namespace engine { namespace guidance { - inline Route assembleRoute(const std::vector &route_legs) - { - auto distance = std::accumulate(route_legs.begin(), - route_legs.end(), 0., - [](const double sum, const RouteLeg &leg) - { - return sum + leg.distance; - }); - auto duration = std::accumulate(route_legs.begin(), route_legs.end(), 0., - [](const double sum, const RouteLeg &leg) - { - return sum + leg.duration; - }); +inline Route assembleRoute(const std::vector &route_legs) +{ + auto distance = std::accumulate(route_legs.begin(), route_legs.end(), 0., + [](const double sum, const RouteLeg &leg) + { + return sum + leg.distance; + }); + auto duration = std::accumulate(route_legs.begin(), route_legs.end(), 0., + [](const double sum, const RouteLeg &leg) + { + return sum + leg.duration; + }); - return Route{duration, distance}; - } + return Route{duration, distance}; +} } // namespace guidance } // namespace engine diff --git a/include/engine/guidance/assemble_steps.hpp b/include/engine/guidance/assemble_steps.hpp index 787bc29fe..bc459ebdc 100644 --- a/include/engine/guidance/assemble_steps.hpp +++ b/include/engine/guidance/assemble_steps.hpp @@ -104,26 +104,18 @@ std::vector assembleSteps(const DataFacadeT &facade, { const auto name = facade.get_name_for_id(path_point.name_id); const auto distance = leg_geometry.segment_distances[segment_index]; - steps.push_back(RouteStep{path_point.name_id, - name, - path_point.duration_until_turn / 10.0, - distance, - path_point.travel_mode, - maneuver, - leg_geometry.FrontIndex(segment_index), - leg_geometry.BackIndex(segment_index) + 1}); + steps.push_back(RouteStep{ + path_point.name_id, name, path_point.duration_until_turn / 10.0, distance, + path_point.travel_mode, maneuver, leg_geometry.FrontIndex(segment_index), + leg_geometry.BackIndex(segment_index) + 1}); maneuver = detail::stepManeuverFromGeometry( path_point.turn_instruction, leg_geometry, segment_index, path_point.exit); segment_index++; } } const auto distance = leg_geometry.segment_distances[segment_index]; - steps.push_back(RouteStep{target_node.name_id, - facade.get_name_for_id(target_node.name_id), - target_duration, - distance, - target_mode, - maneuver, + steps.push_back(RouteStep{target_node.name_id, facade.get_name_for_id(target_node.name_id), + target_duration, distance, target_mode, maneuver, leg_geometry.FrontIndex(segment_index), leg_geometry.BackIndex(segment_index) + 1}); } @@ -134,20 +126,15 @@ std::vector assembleSteps(const DataFacadeT &facade, // |-------------t target_duration // x---*---*---*---z compressed edge // |-------| duration - StepManeuver maneuver = {source_node.location, - 0., - 0., + StepManeuver maneuver = {source_node.location, 0., 0., extractor::guidance::TurnInstruction{ extractor::guidance::TurnType::Location, initial_modifier}, INVALID_EXIT_NR}; - steps.push_back(RouteStep{source_node.name_id, - facade.get_name_for_id(source_node.name_id), + steps.push_back(RouteStep{source_node.name_id, facade.get_name_for_id(source_node.name_id), target_duration - source_duration, - leg_geometry.segment_distances[segment_index], - source_mode, - std::move(maneuver), - leg_geometry.FrontIndex(segment_index), + leg_geometry.segment_distances[segment_index], source_mode, + std::move(maneuver), leg_geometry.FrontIndex(segment_index), leg_geometry.BackIndex(segment_index) + 1}); } @@ -159,20 +146,13 @@ std::vector assembleSteps(const DataFacadeT &facade, target_location.get())) : extractor::guidance::DirectionModifier::UTurn; // This step has length zero, the only reason we need it is the target location - steps.push_back( - RouteStep{target_node.name_id, - facade.get_name_for_id(target_node.name_id), - 0., - 0., - target_mode, - StepManeuver{target_node.location, - 0., - 0., - extractor::guidance::TurnInstruction{ - extractor::guidance::TurnType::Location, final_modifier}, - INVALID_EXIT_NR}, - leg_geometry.locations.size(), - leg_geometry.locations.size()}); + steps.push_back(RouteStep{ + target_node.name_id, facade.get_name_for_id(target_node.name_id), 0., 0., target_mode, + StepManeuver{target_node.location, 0., 0., + extractor::guidance::TurnInstruction{extractor::guidance::TurnType::Location, + final_modifier}, + INVALID_EXIT_NR}, + leg_geometry.locations.size(), leg_geometry.locations.size()}); return steps; } diff --git a/include/engine/guidance/route.hpp b/include/engine/guidance/route.hpp index e75162cd0..bde2d5fca 100644 --- a/include/engine/guidance/route.hpp +++ b/include/engine/guidance/route.hpp @@ -1,16 +1,18 @@ #ifndef ROUTE_HPP #define ROUTE_HPP -namespace osrm { -namespace engine { -namespace guidance { +namespace osrm +{ +namespace engine +{ +namespace guidance +{ struct Route { double duration; double distance; }; - } } } diff --git a/include/engine/guidance/route_leg.hpp b/include/engine/guidance/route_leg.hpp index 3e449ee5b..5ecca4faa 100644 --- a/include/engine/guidance/route_leg.hpp +++ b/include/engine/guidance/route_leg.hpp @@ -22,7 +22,6 @@ struct RouteLeg std::string summary; std::vector steps; }; - } } } diff --git a/include/engine/guidance/route_step.hpp b/include/engine/guidance/route_step.hpp index ac5a65d0b..0b3f21159 100644 --- a/include/engine/guidance/route_step.hpp +++ b/include/engine/guidance/route_step.hpp @@ -31,7 +31,6 @@ struct RouteStep std::size_t geometry_begin; std::size_t geometry_end; }; - } } } diff --git a/include/engine/map_matching/matching_confidence.hpp b/include/engine/map_matching/matching_confidence.hpp index c4a31cc85..03613b048 100644 --- a/include/engine/map_matching/matching_confidence.hpp +++ b/include/engine/map_matching/matching_confidence.hpp @@ -14,11 +14,11 @@ namespace map_matching struct MatchingConfidence { -private: + private: using ClassifierT = BayesClassifier; using TraceClassification = ClassifierT::ClassificationT; -public: + public: MatchingConfidence() : // the values were derived from fitting a laplace distribution // to the values of manually classified traces @@ -47,8 +47,8 @@ public: BOOST_ASSERT(label_with_confidence.first == ClassifierT::ClassLabel::NEGATIVE); return 1 - label_with_confidence.second; } -private: + private: ClassifierT classifier; }; } diff --git a/include/engine/map_matching/sub_matching.hpp b/include/engine/map_matching/sub_matching.hpp index 79d3061b1..22c180312 100644 --- a/include/engine/map_matching/sub_matching.hpp +++ b/include/engine/map_matching/sub_matching.hpp @@ -18,7 +18,6 @@ struct SubMatching std::vector indices; double confidence; }; - } } } diff --git a/include/engine/plugins/trip.hpp b/include/engine/plugins/trip.hpp index 76e1bc5cd..cf368840b 100644 --- a/include/engine/plugins/trip.hpp +++ b/include/engine/plugins/trip.hpp @@ -47,7 +47,6 @@ class TripPlugin final : public BasePlugin Status HandleRequest(const api::TripParameters ¶meters, util::json::Object &json_result); }; - } } } diff --git a/include/engine/routing_algorithms/many_to_many.hpp b/include/engine/routing_algorithms/many_to_many.hpp index 85855576b..d61db7039 100644 --- a/include/engine/routing_algorithms/many_to_many.hpp +++ b/include/engine/routing_algorithms/many_to_many.hpp @@ -50,8 +50,10 @@ class ManyToManyRouting final const std::vector &source_indices, const std::vector &target_indices) const { - const auto number_of_sources = source_indices.empty() ? phantom_nodes.size() : source_indices.size(); - const auto number_of_targets = target_indices.empty() ? phantom_nodes.size() : target_indices.size(); + const auto number_of_sources = + source_indices.empty() ? phantom_nodes.size() : source_indices.size(); + const auto number_of_targets = + target_indices.empty() ? phantom_nodes.size() : target_indices.size(); const auto number_of_entries = number_of_sources * number_of_targets; std::vector result_table(number_of_entries, std::numeric_limits::max()); @@ -90,7 +92,7 @@ class ManyToManyRouting final // for each source do forward search unsigned row_idx = 0; - const auto search_source_phantom = [&](const PhantomNode& phantom) + const auto search_source_phantom = [&](const PhantomNode &phantom) { query_heap.Clear(); // insert target(s) at distance 0 diff --git a/include/engine/routing_algorithms/map_matching.hpp b/include/engine/routing_algorithms/map_matching.hpp index 36721dedb..9a0da8866 100644 --- a/include/engine/routing_algorithms/map_matching.hpp +++ b/include/engine/routing_algorithms/map_matching.hpp @@ -244,7 +244,8 @@ class MapMatching final : public BasicRoutingInterface(0u, prev_viterbi.size())) @@ -274,8 +275,7 @@ class MapMatching final : public BasicRoutingInterface class BasicRoutingInterface SearchEngineData::QueryHeap &reverse_core_heap, const PhantomNode &source_phantom, const PhantomNode &target_phantom, - int duration_upper_bound=INVALID_EDGE_WEIGHT) const + int duration_upper_bound = INVALID_EDGE_WEIGHT) const { BOOST_ASSERT(forward_heap.Empty()); BOOST_ASSERT(reverse_heap.Empty()); @@ -821,7 +821,7 @@ template class BasicRoutingInterface SearchEngineData::QueryHeap &reverse_heap, const PhantomNode &source_phantom, const PhantomNode &target_phantom, - int duration_upper_bound=INVALID_EDGE_WEIGHT) const + int duration_upper_bound = INVALID_EDGE_WEIGHT) const { BOOST_ASSERT(forward_heap.Empty()); BOOST_ASSERT(reverse_heap.Empty()); diff --git a/include/engine/routing_algorithms/shortest_path.hpp b/include/engine/routing_algorithms/shortest_path.hpp index 1cb761f4f..0e41f1284 100644 --- a/include/engine/routing_algorithms/shortest_path.hpp +++ b/include/engine/routing_algorithms/shortest_path.hpp @@ -243,7 +243,8 @@ class ShortestPathRouting final const std::vector> &uturn_indicators, InternalRouteResult &raw_route_data) const { - BOOST_ASSERT(uturn_indicators.empty() || uturn_indicators.size() == phantom_nodes_vector.size() + 1); + BOOST_ASSERT(uturn_indicators.empty() || + uturn_indicators.size() == phantom_nodes_vector.size() + 1); engine_working_data.InitializeOrClearFirstThreadLocalStorage( super::facade->GetNumberOfNodes()); engine_working_data.InitializeOrClearSecondThreadLocalStorage( @@ -285,8 +286,11 @@ class ShortestPathRouting final const auto &source_phantom = phantom_node_pair.source_phantom; const auto &target_phantom = phantom_node_pair.target_phantom; - const bool use_uturn_default = !use_uturn_indicators || !uturn_indicators[current_leg + 1]; - const bool allow_u_turn_at_via = (use_uturn_default && UTURN_DEFAULT) || (!use_uturn_default && *uturn_indicators[current_leg + 1]); + const bool use_uturn_default = + !use_uturn_indicators || !uturn_indicators[current_leg + 1]; + const bool allow_u_turn_at_via = + (use_uturn_default && UTURN_DEFAULT) || + (!use_uturn_default && *uturn_indicators[current_leg + 1]); bool search_to_forward_node = target_phantom.forward_node_id != SPECIAL_NODEID; bool search_to_reverse_node = target_phantom.reverse_node_id != SPECIAL_NODEID; diff --git a/include/engine/status.hpp b/include/engine/status.hpp index ed636c266..17e93a96c 100644 --- a/include/engine/status.hpp +++ b/include/engine/status.hpp @@ -11,7 +11,6 @@ enum class Status Ok, Error }; - } } diff --git a/include/extractor/compressed_edge_container.hpp b/include/extractor/compressed_edge_container.hpp index 0ab194bc7..662c18e5d 100644 --- a/include/extractor/compressed_edge_container.hpp +++ b/include/extractor/compressed_edge_container.hpp @@ -18,9 +18,9 @@ class CompressedEdgeContainer public: struct CompressedEdge { - public: - NodeID node_id; // refers to an internal node-based-node - EdgeWeight weight; // the weight of the edge leading to this node + public: + NodeID node_id; // refers to an internal node-based-node + EdgeWeight weight; // the weight of the edge leading to this node }; using EdgeBucket = std::vector; @@ -32,9 +32,8 @@ class CompressedEdgeContainer const EdgeWeight weight1, const EdgeWeight weight2); - void AddUncompressedEdge(const EdgeID edgei_id, - const NodeID target_node, - const EdgeWeight weight); + void + AddUncompressedEdge(const EdgeID edgei_id, const NodeID target_node, const EdgeWeight weight); bool HasEntryForID(const EdgeID edge_id) const; void PrintStatistics() const; diff --git a/include/extractor/guidance/toolkit.hpp b/include/extractor/guidance/toolkit.hpp index f43930f00..1c9e0bd4e 100644 --- a/include/extractor/guidance/toolkit.hpp +++ b/include/extractor/guidance/toolkit.hpp @@ -27,8 +27,8 @@ namespace detail const constexpr double DESIRED_SEGMENT_LENGTH = 10.0; const constexpr bool shiftable_ccw[] = {false, true, true, false, false, true, true, false}; const constexpr bool shiftable_cw[] = {false, false, true, true, false, false, true, true}; -const constexpr uint8_t modifier_bounds[detail::num_direction_modifiers] = { - 0, 36, 93, 121, 136, 163, 220, 255}; +const constexpr uint8_t modifier_bounds[detail::num_direction_modifiers] = {0, 36, 93, 121, + 136, 163, 220, 255}; const constexpr double discrete_angle_step_size = 360. / 256.; template @@ -294,14 +294,10 @@ inline DirectionModifier getTurnDirection(const double angle) // swaps left <-> right modifier types inline DirectionModifier mirrorDirectionModifier(const DirectionModifier modifier) { - const constexpr DirectionModifier results[] = {DirectionModifier::UTurn, - DirectionModifier::SharpLeft, - DirectionModifier::Left, - DirectionModifier::SlightLeft, - DirectionModifier::Straight, - DirectionModifier::SlightRight, - DirectionModifier::Right, - DirectionModifier::SharpRight}; + const constexpr DirectionModifier results[] = { + DirectionModifier::UTurn, DirectionModifier::SharpLeft, DirectionModifier::Left, + DirectionModifier::SlightLeft, DirectionModifier::Straight, DirectionModifier::SlightRight, + DirectionModifier::Right, DirectionModifier::SharpRight}; return results[modifier]; } diff --git a/include/osrm/engine_config.hpp b/include/osrm/engine_config.hpp index 6c10e9441..9214ee248 100644 --- a/include/osrm/engine_config.hpp +++ b/include/osrm/engine_config.hpp @@ -5,8 +5,7 @@ namespace osrm { - using engine::EngineConfig; +using engine::EngineConfig; } #endif - diff --git a/include/osrm/json_container.hpp b/include/osrm/json_container.hpp index 1b0787713..c633ef1d5 100644 --- a/include/osrm/json_container.hpp +++ b/include/osrm/json_container.hpp @@ -3,6 +3,6 @@ #include "util/json_container.hpp" namespace osrm { - namespace json = osrm::util::json; +namespace json = osrm::util::json; } #endif diff --git a/include/osrm/match_parameters.hpp b/include/osrm/match_parameters.hpp index 3a54a5997..5b2dfa93c 100644 --- a/include/osrm/match_parameters.hpp +++ b/include/osrm/match_parameters.hpp @@ -5,7 +5,7 @@ namespace osrm { - using engine::api::MatchParameters; +using engine::api::MatchParameters; } #endif diff --git a/include/osrm/nearest_parameters.hpp b/include/osrm/nearest_parameters.hpp index 673f5fa19..5309fec3b 100644 --- a/include/osrm/nearest_parameters.hpp +++ b/include/osrm/nearest_parameters.hpp @@ -5,7 +5,7 @@ namespace osrm { - using engine::api::NearestParameters; +using engine::api::NearestParameters; } #endif diff --git a/include/osrm/route_parameters.hpp b/include/osrm/route_parameters.hpp index c348f6d16..b54de9fd8 100644 --- a/include/osrm/route_parameters.hpp +++ b/include/osrm/route_parameters.hpp @@ -5,7 +5,7 @@ namespace osrm { - using engine::api::RouteParameters; +using engine::api::RouteParameters; } #endif diff --git a/include/osrm/status.hpp b/include/osrm/status.hpp index 184a18760..f09da90d9 100644 --- a/include/osrm/status.hpp +++ b/include/osrm/status.hpp @@ -5,7 +5,7 @@ namespace osrm { - using engine::Status; +using engine::Status; } #endif diff --git a/include/osrm/table_parameters.hpp b/include/osrm/table_parameters.hpp index 09a9b9b6c..21360a5f5 100644 --- a/include/osrm/table_parameters.hpp +++ b/include/osrm/table_parameters.hpp @@ -5,7 +5,7 @@ namespace osrm { - using engine::api::TableParameters; +using engine::api::TableParameters; } #endif diff --git a/include/osrm/trip_parameters.hpp b/include/osrm/trip_parameters.hpp index e279063ea..3d32545a9 100644 --- a/include/osrm/trip_parameters.hpp +++ b/include/osrm/trip_parameters.hpp @@ -5,7 +5,7 @@ namespace osrm { - using engine::api::TripParameters; +using engine::api::TripParameters; } #endif diff --git a/include/server/api/base_parameters_grammar.hpp b/include/server/api/base_parameters_grammar.hpp index a6cec6ded..44f0ae17d 100644 --- a/include/server/api/base_parameters_grammar.hpp +++ b/include/server/api/base_parameters_grammar.hpp @@ -33,22 +33,26 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar using Iterator = std::string::iterator; using RadiusesT = std::vector>; - BaseParametersGrammar(qi::rule &root_rule_, - engine::api::BaseParameters ¶meters_) + BaseParametersGrammar(qi::rule &root_rule_, engine::api::BaseParameters ¶meters_) : BaseParametersGrammar::base_type(root_rule_), base_parameters(parameters_) { - const auto add_bearing = [this](boost::optional> bearing_range) { + const auto add_bearing = + [this](boost::optional> bearing_range) + { boost::optional bearing; if (bearing_range) { - bearing = engine::api::BaseParameters::Bearing {boost::fusion::at_c<0>(*bearing_range), boost::fusion::at_c<1>(*bearing_range)}; + bearing = engine::api::BaseParameters::Bearing{ + boost::fusion::at_c<0>(*bearing_range), boost::fusion::at_c<1>(*bearing_range)}; } base_parameters.bearings.push_back(std::move(bearing)); }; - const auto set_radiuses = [this](RadiusesT& radiuses) { + const auto set_radiuses = [this](RadiusesT &radiuses) + { base_parameters.radiuses = std::move(radiuses); }; - const auto add_hint = [this](const std::string& hint_string) { + const auto add_hint = [this](const std::string &hint_string) + { if (hint_string.size() > 0) { base_parameters.hints.push_back(engine::Hint::FromBase64(hint_string)); @@ -56,9 +60,9 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar }; const auto add_coordinate = [this](const boost::fusion::vector &lonLat) { - base_parameters.coordinates.emplace_back( - util::Coordinate(util::FixedLongitude(boost::fusion::at_c<0>(lonLat) * COORDINATE_PRECISION), - util::FixedLatitude(boost::fusion::at_c<1>(lonLat) * COORDINATE_PRECISION))); + base_parameters.coordinates.emplace_back(util::Coordinate( + util::FixedLongitude(boost::fusion::at_c<0>(lonLat) * COORDINATE_PRECISION), + util::FixedLatitude(boost::fusion::at_c<1>(lonLat) * COORDINATE_PRECISION))); }; const auto polyline_to_coordinates = [this](const std::string &polyline) { @@ -70,7 +74,9 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar base64_char = qi::char_("a-zA-Z0-9--_"); radiuses_rule = qi::lit("radiuses=") >> -qi::double_ % ";"; - hints_rule = qi::lit("hints=") >> qi::as_string[qi::repeat(engine::ENCODED_HINT_SIZE)[base64_char]][add_hint] % ";"; + hints_rule = + qi::lit("hints=") >> + qi::as_string[qi::repeat(engine::ENCODED_HINT_SIZE)[base64_char]][add_hint] % ";"; bearings_rule = qi::lit("bearings=") >> (-(qi::short_ >> ',' >> qi::short_))[add_bearing] % ";"; polyline_rule = qi::as_string[qi::lit("polyline(") >> +polyline_chars >> @@ -81,11 +87,11 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar base_rule = bearings_rule | radiuses_rule[set_radiuses] | hints_rule; } -protected: + protected: qi::rule base_rule; qi::rule query_rule; -private: + private: engine::api::BaseParameters &base_parameters; qi::rule bearings_rule; qi::rule hints_rule; diff --git a/include/server/api/match_parameter_grammar.hpp b/include/server/api/match_parameter_grammar.hpp index cda0506af..7628e871a 100644 --- a/include/server/api/match_parameter_grammar.hpp +++ b/include/server/api/match_parameter_grammar.hpp @@ -68,9 +68,10 @@ struct MatchParametersGrammar final : public BaseParametersGrammar qi::lit("overview=full")[set_full_type] | qi::lit("overview=false")[set_false_type]; timestamps_rule = qi::lit("timestamps=") >> qi::uint_ % ";"; - match_rule = steps_rule[set_steps] | geometries_rule | - overview_rule | timestamps_rule[set_timestamps]; - root_rule = query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (match_rule | base_rule) % '&'); + match_rule = steps_rule[set_steps] | geometries_rule | overview_rule | + timestamps_rule[set_timestamps]; + root_rule = + query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (match_rule | base_rule) % '&'); } engine::api::MatchParameters parameters; diff --git a/include/server/api/nearest_parameter_grammar.hpp b/include/server/api/nearest_parameter_grammar.hpp index 565e11a76..e51ccb597 100644 --- a/include/server/api/nearest_parameter_grammar.hpp +++ b/include/server/api/nearest_parameter_grammar.hpp @@ -31,7 +31,8 @@ struct NearestParametersGrammar final : public BaseParametersGrammar parameters.number_of_results = number; }; nearest_rule = (qi::lit("number=") >> qi::uint_)[set_number]; - root_rule = query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (nearest_rule | base_rule) % '&'); + root_rule = + query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (nearest_rule | base_rule) % '&'); } engine::api::NearestParameters parameters; diff --git a/include/server/api/route_parameters_grammar.hpp b/include/server/api/route_parameters_grammar.hpp index c3bab878b..7e290422c 100644 --- a/include/server/api/route_parameters_grammar.hpp +++ b/include/server/api/route_parameters_grammar.hpp @@ -76,7 +76,8 @@ struct RouteParametersGrammar : public BaseParametersGrammar route_rule = steps_rule[set_steps] | alternative_rule[set_alternative] | geometries_rule | overview_rule | uturns_rule[set_uturns]; - root_rule = query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (route_rule | base_rule) % '&'); + root_rule = + query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (route_rule | base_rule) % '&'); } engine::api::RouteParameters parameters; diff --git a/include/server/api/table_parameter_grammar.hpp b/include/server/api/table_parameter_grammar.hpp index 18a35a945..d5acb04de 100644 --- a/include/server/api/table_parameter_grammar.hpp +++ b/include/server/api/table_parameter_grammar.hpp @@ -36,11 +36,14 @@ struct TableParametersGrammar final : public BaseParametersGrammar { parameters.sources = std::move(sources); }; - destinations_rule = (qi::lit("destinations=") >> (qi::ulong_ % ";")[set_destiantions]) | qi::lit("destinations=all"); - sources_rule = (qi::lit("sources=") >> (qi::ulong_ % ";")[set_sources]) | qi::lit("sources=all"); + destinations_rule = (qi::lit("destinations=") >> (qi::ulong_ % ";")[set_destiantions]) | + qi::lit("destinations=all"); + sources_rule = + (qi::lit("sources=") >> (qi::ulong_ % ";")[set_sources]) | qi::lit("sources=all"); table_rule = destinations_rule | sources_rule; - root_rule = query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (table_rule | base_rule) % '&'); + root_rule = + query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (table_rule | base_rule) % '&'); } engine::api::TableParameters parameters; diff --git a/include/server/api/tile_parameter_grammar.hpp b/include/server/api/tile_parameter_grammar.hpp index f0eb03f2b..2212b814c 100644 --- a/include/server/api/tile_parameter_grammar.hpp +++ b/include/server/api/tile_parameter_grammar.hpp @@ -26,20 +26,29 @@ struct TileParametersGrammar final : boost::spirit::qi::grammar> qi::uint_[set_x] >> qi::lit(",") >> qi::uint_[set_y] >> qi::lit(",") >> qi::uint_[set_z] >> qi::lit(")"); + query_rule = qi::lit("tile(") >> qi::uint_[set_x] >> qi::lit(",") >> qi::uint_[set_y] >> + qi::lit(",") >> qi::uint_[set_z] >> qi::lit(")"); root_rule = query_rule >> qi::lit(".mvt"); } engine::api::TileParameters parameters; -private: + private: qi::rule root_rule; qi::rule query_rule; }; diff --git a/include/server/api/trip_parameter_grammar.hpp b/include/server/api/trip_parameter_grammar.hpp index 7a2ddc6db..3165d9919 100644 --- a/include/server/api/trip_parameter_grammar.hpp +++ b/include/server/api/trip_parameter_grammar.hpp @@ -64,7 +64,8 @@ struct TripParametersGrammar final : public BaseParametersGrammar qi::lit("overview=false")[set_false_type]; trip_rule = steps_rule[set_steps] | geometries_rule | overview_rule; - root_rule = query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (trip_rule | base_rule) % '&'); + root_rule = + query_rule >> -qi::lit(".json") >> -(qi::lit("?") >> (trip_rule | base_rule) % '&'); } engine::api::TripParameters parameters; diff --git a/include/server/api/url_parser.hpp b/include/server/api/url_parser.hpp index 58a400b98..0bac20f30 100644 --- a/include/server/api/url_parser.hpp +++ b/include/server/api/url_parser.hpp @@ -15,14 +15,13 @@ namespace api { // Starts parsing and iter and modifies it until iter == end or parsing failed -boost::optional parseURL(std::string::iterator& iter, std::string::iterator end); +boost::optional parseURL(std::string::iterator &iter, std::string::iterator end); // copy on purpose because we need mutability inline boost::optional parseURL(std::string url_string) { auto iter = url_string.begin(); return parseURL(iter, url_string.end()); } - } } } diff --git a/include/server/service/utils.hpp b/include/server/service/utils.hpp index 6d57438bb..e4fd7df13 100644 --- a/include/server/service/utils.hpp +++ b/include/server/service/utils.hpp @@ -24,8 +24,6 @@ bool constrainParamSize(const char *msg_template, } return false; } - } } } - diff --git a/include/server/service_handler.hpp b/include/server/service_handler.hpp index 68fbffc81..cb9b03762 100644 --- a/include/server/service_handler.hpp +++ b/include/server/service_handler.hpp @@ -32,7 +32,6 @@ class ServiceHandler engine::Status RunQuery(api::ParsedURL parsed_url, ResultT &result); private: - std::unordered_map> service_map; OSRM routing_machine; }; diff --git a/include/storage/storage.hpp b/include/storage/storage.hpp index 0b63b32d1..1508cab2a 100644 --- a/include/storage/storage.hpp +++ b/include/storage/storage.hpp @@ -13,10 +13,11 @@ namespace storage using DataPaths = std::unordered_map; class Storage { -public: - Storage(const DataPaths& data_paths); + public: + Storage(const DataPaths &data_paths); int Run(); -private: + + private: DataPaths paths; }; } diff --git a/include/util/rectangle.hpp b/include/util/rectangle.hpp index 0d95cd825..333405ba7 100644 --- a/include/util/rectangle.hpp +++ b/include/util/rectangle.hpp @@ -195,11 +195,13 @@ struct RectangleInt2D return lons_contained && lats_contained; } - friend std::ostream& operator<<(std::ostream& out, const RectangleInt2D& rect); + friend std::ostream &operator<<(std::ostream &out, const RectangleInt2D &rect); }; -inline std::ostream& operator<<(std::ostream& out, const RectangleInt2D& rect) +inline std::ostream &operator<<(std::ostream &out, const RectangleInt2D &rect) { - out << std::setprecision(12) << "(" << toFloating(rect.min_lon) << "," << toFloating(rect.max_lon) << "," << toFloating(rect.min_lat) << "," << toFloating(rect.max_lat) << ")"; + out << std::setprecision(12) << "(" << toFloating(rect.min_lon) << "," + << toFloating(rect.max_lon) << "," << toFloating(rect.min_lat) << "," + << toFloating(rect.max_lat) << ")"; return out; } } diff --git a/src/engine/api/json_factory.cpp b/src/engine/api/json_factory.cpp index 6ad7574df..1221e55f2 100644 --- a/src/engine/api/json_factory.cpp +++ b/src/engine/api/json_factory.cpp @@ -28,14 +28,8 @@ namespace json namespace detail { -const constexpr char *modifier_names[] = {"uturn", - "sharp right", - "right", - "slight right", - "straight", - "slight left", - "left", - "sharp left"}; +const constexpr char *modifier_names[] = {"uturn", "sharp right", "right", "slight right", + "straight", "slight left", "left", "sharp left"}; // translations of TurnTypes. Not all types are exposed to the outside world. // invalid types should never be returned as part of the API diff --git a/src/engine/plugins/viaroute.cpp b/src/engine/plugins/viaroute.cpp index 2cf98f869..333923bba 100644 --- a/src/engine/plugins/viaroute.cpp +++ b/src/engine/plugins/viaroute.cpp @@ -59,8 +59,8 @@ Status ViaRoutePlugin::HandleRequest(const api::RouteParameters &route_parameter auto snapped_phantoms = SnapPhantomNodes(phantom_node_pairs); InternalRouteResult raw_route; - auto build_phantom_pairs = - [&raw_route](const PhantomNode &first_node, const PhantomNode &second_node) + auto build_phantom_pairs = [&raw_route](const PhantomNode &first_node, + const PhantomNode &second_node) { raw_route.segment_end_coordinates.push_back(PhantomNodes{first_node, second_node}); }; diff --git a/src/engine/polyline_compressor.cpp b/src/engine/polyline_compressor.cpp index 728a26cb3..4cbfe1c7f 100644 --- a/src/engine/polyline_compressor.cpp +++ b/src/engine/polyline_compressor.cpp @@ -70,10 +70,15 @@ std::string encodePolyline(CoordVectorForwardIter begin, CoordVectorForwardIter delta_numbers.reserve((size - 1) * 2); int current_lat = 0; int current_lon = 0; - std::for_each(begin, end, [&delta_numbers, ¤t_lat, ¤t_lon](const util::Coordinate loc) + std::for_each(begin, end, + [&delta_numbers, ¤t_lat, ¤t_lon](const util::Coordinate loc) { - const int lat_diff = std::round(static_cast(loc.lat) * detail::COORDINATE_TO_POLYLINE) - current_lat; - const int lon_diff = std::round(static_cast(loc.lon) * detail::COORDINATE_TO_POLYLINE) - current_lon; + const int lat_diff = + std::round(static_cast(loc.lat) * detail::COORDINATE_TO_POLYLINE) - + current_lat; + const int lon_diff = + std::round(static_cast(loc.lon) * detail::COORDINATE_TO_POLYLINE) - + current_lon; delta_numbers.emplace_back(lat_diff); delta_numbers.emplace_back(lon_diff); current_lat += lat_diff; diff --git a/src/extractor/compressed_edge_container.cpp b/src/extractor/compressed_edge_container.cpp index d6b6cc0b2..70b1f77cb 100644 --- a/src/extractor/compressed_edge_container.cpp +++ b/src/extractor/compressed_edge_container.cpp @@ -78,7 +78,7 @@ void CompressedEdgeContainer::SerializeInternalVector(const std::string &path) c const unsigned unpacked_size = current_vector.size(); control_sum += unpacked_size; BOOST_ASSERT(std::numeric_limits::max() != unpacked_size); - for (const auto & current_node : current_vector) + for (const auto ¤t_node : current_vector) { geometry_out_stream.write((char *)&(current_node), sizeof(CompressedEdge)); } @@ -143,7 +143,7 @@ void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1, // weight1 is the distance to the (currently) last coordinate in the bucket if (edge_bucket_list1.empty()) { - edge_bucket_list1.emplace_back(CompressedEdge { via_node_id, weight1 }); + edge_bucket_list1.emplace_back(CompressedEdge{via_node_id, weight1}); } BOOST_ASSERT(0 < edge_bucket_list1.size()); @@ -174,11 +174,11 @@ void CompressedEdgeContainer::CompressEdge(const EdgeID edge_id_1, else { // we are certain that the second edge is atomic. - edge_bucket_list1.emplace_back( CompressedEdge { target_node_id, weight2 }); + edge_bucket_list1.emplace_back(CompressedEdge{target_node_id, weight2}); } } -void CompressedEdgeContainer::AddUncompressedEdge(const EdgeID edge_id, +void CompressedEdgeContainer::AddUncompressedEdge(const EdgeID edge_id, const NodeID target_node_id, const EdgeWeight weight) { @@ -215,12 +215,10 @@ void CompressedEdgeContainer::AddUncompressedEdge(const EdgeID edge_id, // Don't re-add this if it's already in there. if (edge_bucket_list.empty()) { - edge_bucket_list.emplace_back(CompressedEdge { target_node_id, weight }); + edge_bucket_list.emplace_back(CompressedEdge{target_node_id, weight}); } } - - void CompressedEdgeContainer::PrintStatistics() const { const uint64_t compressed_edges = m_compressed_geometries.size(); diff --git a/src/extractor/extractor.cpp b/src/extractor/extractor.cpp index 10f0fa6f4..568638c6a 100644 --- a/src/extractor/extractor.cpp +++ b/src/extractor/extractor.cpp @@ -278,8 +278,7 @@ int Extractor::run() util::SimpleLogger().Write() << "Saving edge-based node weights to file."; TIMER_START(timer_write_node_weights); - util::serializeVector(config.edge_based_node_weights_output_path, - edge_based_node_weights); + util::serializeVector(config.edge_based_node_weights_output_path, edge_based_node_weights); TIMER_STOP(timer_write_node_weights); util::SimpleLogger().Write() << "Done writing. (" << TIMER_SEC(timer_write_node_weights) << ")"; diff --git a/src/extractor/extractor_callbacks.cpp b/src/extractor/extractor_callbacks.cpp index 998c0740c..a289ec63f 100644 --- a/src/extractor/extractor_callbacks.cpp +++ b/src/extractor/extractor_callbacks.cpp @@ -41,9 +41,7 @@ void ExtractorCallbacks::ProcessNode(const osmium::Node &input_node, external_memory.all_nodes_list.push_back( {util::toFixed(util::FloatLongitude(input_node.location().lon())), util::toFixed(util::FloatLatitude(input_node.location().lat())), - OSMNodeID(input_node.id()), - result_node.barrier, - result_node.traffic_lights}); + OSMNodeID(input_node.id()), result_node.barrier, result_node.traffic_lights}); } void ExtractorCallbacks::ProcessRestriction( @@ -125,8 +123,8 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti if (forward_weight_data.type == InternalExtractorEdge::WeightType::INVALID && backward_weight_data.type == InternalExtractorEdge::WeightType::INVALID) { - util::SimpleLogger().Write(logDEBUG) - << "found way with bogus speed, id: " << input_way.id(); + util::SimpleLogger().Write(logDEBUG) << "found way with bogus speed, id: " + << input_way.id(); return; } @@ -187,11 +185,9 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti }); external_memory.way_start_end_id_list.push_back( - {OSMWayID(input_way.id()), - OSMNodeID(input_way.nodes().back().ref()), + {OSMWayID(input_way.id()), OSMNodeID(input_way.nodes().back().ref()), OSMNodeID(input_way.nodes()[input_way.nodes().size() - 2].ref()), - OSMNodeID(input_way.nodes()[1].ref()), - OSMNodeID(input_way.nodes()[0].ref())}); + OSMNodeID(input_way.nodes()[1].ref()), OSMNodeID(input_way.nodes()[0].ref())}); } else { @@ -223,11 +219,9 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti } external_memory.way_start_end_id_list.push_back( - {OSMWayID(input_way.id()), - OSMNodeID(input_way.nodes().back().ref()), + {OSMWayID(input_way.id()), OSMNodeID(input_way.nodes().back().ref()), OSMNodeID(input_way.nodes()[input_way.nodes().size() - 2].ref()), - OSMNodeID(input_way.nodes()[1].ref()), - OSMNodeID(input_way.nodes()[0].ref())}); + OSMNodeID(input_way.nodes()[1].ref()), OSMNodeID(input_way.nodes()[0].ref())}); } } } diff --git a/src/extractor/graph_compressor.cpp b/src/extractor/graph_compressor.cpp index 43777d053..374ff4866 100644 --- a/src/extractor/graph_compressor.cpp +++ b/src/extractor/graph_compressor.cpp @@ -156,12 +156,10 @@ void GraphCompressor::Compress(const std::unordered_set &barrier_nodes, restriction_map.FixupArrivingTurnRestriction(node_w, node_v, node_u, graph); // store compressed geometry in container - geometry_compressor.CompressEdge( - forward_e1, forward_e2, node_v, node_w, - forward_weight1, forward_weight2); - geometry_compressor.CompressEdge( - reverse_e1, reverse_e2, node_v, node_u, - reverse_weight1, reverse_weight2); + geometry_compressor.CompressEdge(forward_e1, forward_e2, node_v, node_w, + forward_weight1, forward_weight2); + geometry_compressor.CompressEdge(reverse_e1, reverse_e2, node_v, node_u, + reverse_weight1, reverse_weight2); } } @@ -179,7 +177,6 @@ void GraphCompressor::Compress(const std::unordered_set &barrier_nodes, geometry_compressor.AddUncompressedEdge(edge_id, target, data.distance); } } - } void GraphCompressor::PrintStatistics(unsigned original_number_of_nodes, diff --git a/src/server/request_handler.cpp b/src/server/request_handler.cpp index 03ce18efc..bfe793abd 100644 --- a/src/server/request_handler.cpp +++ b/src/server/request_handler.cpp @@ -29,14 +29,12 @@ namespace osrm namespace server { - void RequestHandler::RegisterServiceHandler(std::unique_ptr service_handler_) { service_handler = std::move(service_handler_); } -void RequestHandler::HandleRequest(const http::request ¤t_request, - http::reply ¤t_reply) +void RequestHandler::HandleRequest(const http::request ¤t_request, http::reply ¤t_reply) { if (!service_handler) { @@ -78,15 +76,16 @@ void RequestHandler::HandleRequest(const http::request ¤t_request, << request_string; auto api_iterator = request_string.begin(); - auto maybe_parsed_url = api::parseURL(api_iterator, request_string.end());; + auto maybe_parsed_url = api::parseURL(api_iterator, request_string.end()); + ; ServiceHandler::ResultT result; - // check if the was an error with the request if (maybe_parsed_url && api_iterator == request_string.end()) { - const engine::Status status = service_handler->RunQuery(std::move(*maybe_parsed_url), result); + const engine::Status status = + service_handler->RunQuery(std::move(*maybe_parsed_url), result); if (status != engine::Status::Ok) { // 4xx bad request return code @@ -101,18 +100,18 @@ void RequestHandler::HandleRequest(const http::request ¤t_request, { const auto position = std::distance(request_string.begin(), api_iterator); const auto context_begin = request_string.begin() + std::max(position - 3UL, 0UL); - const auto context_end = request_string.begin() + std::min(position + 3UL, request_string.size()); + const auto context_end = + request_string.begin() + std::min(position + 3UL, request_string.size()); std::string context(context_begin, context_end); current_reply.status = http::reply::bad_request; result = util::json::Object(); - auto& json_result = result.get(); + auto &json_result = result.get(); json_result.values["code"] = "invalid-url"; - json_result.values["message"] = - "URL string malformed close to position " + std::to_string(position) + ": \"" + context + "\""; + json_result.values["message"] = "URL string malformed close to position " + + std::to_string(position) + ": \"" + context + "\""; } - current_reply.headers.emplace_back("Access-Control-Allow-Origin", "*"); current_reply.headers.emplace_back("Access-Control-Allow-Methods", "GET"); current_reply.headers.emplace_back("Access-Control-Allow-Headers", @@ -121,14 +120,15 @@ void RequestHandler::HandleRequest(const http::request ¤t_request, { current_reply.headers.emplace_back("Content-Type", "application/json; charset=UTF-8"); current_reply.headers.emplace_back("Content-Disposition", - "inline; filename=\"response.json\""); + "inline; filename=\"response.json\""); util::json::render(current_reply.content, result.get()); } else { BOOST_ASSERT(result.is()); - std::copy(result.get().cbegin(), result.get().cend(), std::back_inserter(current_reply.content)); + std::copy(result.get().cbegin(), result.get().cend(), + std::back_inserter(current_reply.content)); current_reply.headers.emplace_back("Content-Type", "application/x-protobuf"); } @@ -144,6 +144,5 @@ void RequestHandler::HandleRequest(const http::request ¤t_request, << ", uri: " << current_request.uri; } } - } } diff --git a/src/server/request_parser.cpp b/src/server/request_parser.cpp index f11b89836..d50ea0b0a 100644 --- a/src/server/request_parser.cpp +++ b/src/server/request_parser.cpp @@ -39,7 +39,8 @@ RequestParser::parse(http::request ¤t_request, char *begin, char *end) return std::make_tuple(result, selected_compression); } -RequestParser::RequestStatus RequestParser::consume(http::request ¤t_request, const char input) +RequestParser::RequestStatus RequestParser::consume(http::request ¤t_request, + const char input) { switch (state) { diff --git a/src/server/service/match_service.cpp b/src/server/service/match_service.cpp index 90b58c0f9..3db0cc684 100644 --- a/src/server/service/match_service.cpp +++ b/src/server/service/match_service.cpp @@ -43,7 +43,7 @@ std::string getWrongOptionHelp(const engine::api::MatchParameters ¶meters) engine::Status MatchService::RunQuery(std::string &query, ResultT &result) { result = util::json::Object(); - auto& json_result = result.get(); + auto &json_result = result.get(); auto query_iterator = query.begin(); auto parameters = diff --git a/src/server/service/nearest_service.cpp b/src/server/service/nearest_service.cpp index 13e707701..0b5eaadf7 100644 --- a/src/server/service/nearest_service.cpp +++ b/src/server/service/nearest_service.cpp @@ -42,7 +42,7 @@ std::string getWrongOptionHelp(const engine::api::NearestParameters ¶meters) engine::Status NearestService::RunQuery(std::string &query, ResultT &result) { result = util::json::Object(); - auto& json_result = result.get(); + auto &json_result = result.get(); auto query_iterator = query.begin(); auto parameters = diff --git a/src/server/service_handler.cpp b/src/server/service_handler.cpp index 5171b7633..e4f48be32 100644 --- a/src/server/service_handler.cpp +++ b/src/server/service_handler.cpp @@ -25,7 +25,8 @@ ServiceHandler::ServiceHandler(osrm::EngineConfig &config) : routing_machine(con service_map["tile"] = util::make_unique(routing_machine); } -engine::Status ServiceHandler::RunQuery(api::ParsedURL parsed_url, service::BaseService::ResultT &result) +engine::Status ServiceHandler::RunQuery(api::ParsedURL parsed_url, + service::BaseService::ResultT &result) { const auto &service_iter = service_map.find(parsed_url.service); if (service_iter == service_map.end()) diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index 1cb72797a..ec83d0e5c 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -320,8 +320,8 @@ int Storage::Run() boost::iostreams::seek(geometry_input_stream, number_of_geometries_indices * sizeof(unsigned), BOOST_IOS::cur); geometry_input_stream.read((char *)&number_of_compressed_geometries, sizeof(unsigned)); - shared_layout_ptr->SetBlockSize(SharedDataLayout::GEOMETRIES_LIST, - number_of_compressed_geometries); + shared_layout_ptr->SetBlockSize( + SharedDataLayout::GEOMETRIES_LIST, number_of_compressed_geometries); // allocate shared memory block util::SimpleLogger().Write() << "allocating shared memory of " << shared_layout_ptr->GetSizeOfLayout() << " bytes"; @@ -420,8 +420,9 @@ int Storage::Run() (char *)geometries_index_ptr, shared_layout_ptr->GetBlockSize(SharedDataLayout::GEOMETRIES_INDEX)); } - extractor::CompressedEdgeContainer::CompressedEdge *geometries_list_ptr = shared_layout_ptr->GetBlockPtr( - shared_memory_ptr, SharedDataLayout::GEOMETRIES_LIST); + extractor::CompressedEdgeContainer::CompressedEdge *geometries_list_ptr = + shared_layout_ptr->GetBlockPtr( + shared_memory_ptr, SharedDataLayout::GEOMETRIES_LIST); geometry_input_stream.read((char *)&temporary_value, sizeof(unsigned)); BOOST_ASSERT(temporary_value == diff --git a/src/tools/components.cpp b/src/tools/components.cpp index 86635f36a..45131a85c 100644 --- a/src/tools/components.cpp +++ b/src/tools/components.cpp @@ -114,8 +114,7 @@ int main(int argc, char *argv[]) try auto number_of_nodes = osrm::tools::loadGraph(argv[1], coordinate_list, graph_edge_list); tbb::parallel_sort(graph_edge_list.begin(), graph_edge_list.end()); - const auto graph = - std::make_shared(number_of_nodes, graph_edge_list); + const auto graph = std::make_shared(number_of_nodes, graph_edge_list); graph_edge_list.clear(); graph_edge_list.shrink_to_fit(); @@ -181,8 +180,7 @@ int main(int argc, char *argv[]) try { total_network_length += 100 * osrm::util::coordinate_calculation::greatCircleDistance( - coordinate_list[source], - coordinate_list[target]); + coordinate_list[source], coordinate_list[target]); BOOST_ASSERT(current_edge != SPECIAL_EDGEID); BOOST_ASSERT(source != SPECIAL_NODEID); @@ -203,8 +201,7 @@ int main(int argc, char *argv[]) try static_cast(osrm::util::toFloating(coordinate_list[target].lon)), static_cast(osrm::util::toFloating(coordinate_list[target].lat))); - OGRFeature *po_feature = - OGRFeature::CreateFeature(po_layer->GetLayerDefn()); + OGRFeature *po_feature = OGRFeature::CreateFeature(po_layer->GetLayerDefn()); po_feature->SetGeometry(&line_string); if (OGRERR_NONE != po_layer->CreateFeature(po_feature)) @@ -223,8 +220,8 @@ int main(int argc, char *argv[]) try << "generating output took: " << TIMER_MSEC(SCC_OUTPUT) / 1000. << "s"; osrm::util::SimpleLogger().Write() - << "total network distance: " - << static_cast(total_network_length / 100 / 1000.) << " km"; + << "total network distance: " << static_cast(total_network_length / 100 / 1000.) + << " km"; osrm::util::SimpleLogger().Write() << "finished component analysis"; return EXIT_SUCCESS; diff --git a/src/tools/extract.cpp b/src/tools/extract.cpp index d8482ad13..4c5fa4cb3 100644 --- a/src/tools/extract.cpp +++ b/src/tools/extract.cpp @@ -29,10 +29,11 @@ return_code parseArguments(int argc, char *argv[], extractor::ExtractorConfig &e // declare a group of options that will be allowed both on command line boost::program_options::options_description config_options("Configuration"); - config_options.add_options()("profile,p", - boost::program_options::value( - &extractor_config.profile_path)->default_value("profile.lua"), - "Path to LUA routing profile")( + config_options.add_options()( + "profile,p", + boost::program_options::value(&extractor_config.profile_path) + ->default_value("profile.lua"), + "Path to LUA routing profile")( "threads,t", boost::program_options::value(&extractor_config.requested_num_threads) ->default_value(tbb::task_scheduler_init::default_num_threads()), @@ -42,8 +43,9 @@ return_code parseArguments(int argc, char *argv[], extractor::ExtractorConfig &e ->implicit_value(true) ->default_value(false), "Generate a lookup table for internal edge-expanded-edge IDs to OSM node pairs")( - "small-component-size", boost::program_options::value( - &extractor_config.small_component_size)->default_value(1000), + "small-component-size", + boost::program_options::value(&extractor_config.small_component_size) + ->default_value(1000), "Number of nodes required before a strongly-connected-componennt is considered big " "(affects nearest neighbor snapping)"); diff --git a/src/tools/io-benchmark.cpp b/src/tools/io-benchmark.cpp index 37cccd3b1..0030740a2 100644 --- a/src/tools/io-benchmark.cpp +++ b/src/tools/io-benchmark.cpp @@ -64,8 +64,7 @@ int main(int argc, char *argv[]) try osrm::util::LogPolicy::GetInstance().Unmute(); if (1 == argc) { - osrm::util::SimpleLogger().Write(logWARNING) << "usage: " << argv[0] - << " /path/on/device"; + osrm::util::SimpleLogger().Write(logWARNING) << "usage: " << argv[0] << " /path/on/device"; return -1; } @@ -89,8 +88,7 @@ int main(int argc, char *argv[]) try fcntl(fileno(fd), F_NOCACHE, 1); fcntl(fileno(fd), F_RDAHEAD, 0); TIMER_START(write_1gb); - write(fileno(fd), (char *)random_array, - osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned)); + write(fileno(fd), (char *)random_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned)); TIMER_STOP(write_1gb); fclose(fd); #endif @@ -148,8 +146,7 @@ int main(int argc, char *argv[]) try osrm::util::SimpleLogger().Write(logDEBUG) << "opened, error: " << strerror(errno); return -1; } - char *raw_array = - (char *)memalign(512, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned)); + char *raw_array = (char *)memalign(512, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned)); #endif TIMER_START(read_1gb); #ifdef __APPLE__ @@ -158,8 +155,7 @@ int main(int argc, char *argv[]) try fd = fopen(test_path.string().c_str(), "r"); #endif #ifdef __linux__ - int ret = - read(file_desc, raw_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned)); + int ret = read(file_desc, raw_array, osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned)); osrm::util::SimpleLogger().Write(logDEBUG) << "read " << ret << " bytes, error: " << strerror(errno); close(file_desc); @@ -168,8 +164,8 @@ int main(int argc, char *argv[]) try #endif TIMER_STOP(read_1gb); - osrm::util::SimpleLogger().Write(logDEBUG) << "reading raw 1GB took " - << TIMER_SEC(read_1gb) << "s"; + osrm::util::SimpleLogger().Write(logDEBUG) << "reading raw 1GB took " << TIMER_SEC(read_1gb) + << "s"; osrm::util::SimpleLogger().Write() << "raw read performance: " << std::setprecision(5) << std::fixed << 1024 * 1024 / TIMER_SEC(read_1gb) << "MB/sec"; @@ -184,8 +180,7 @@ int main(int argc, char *argv[]) try lseek(file_desc, 0, SEEK_SET); #endif // make 1000 random access, time each I/O seperately - unsigned number_of_blocks = - (osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned) - 1) / 4096; + unsigned number_of_blocks = (osrm::tools::NUMBER_OF_ELEMENTS * sizeof(unsigned) - 1) / 4096; std::random_device rd; std::default_random_engine e1(rd()); std::uniform_int_distribution uniform_dist(0, number_of_blocks - 1); @@ -212,15 +207,13 @@ int main(int argc, char *argv[]) try if (((off_t)-1) == ret1) { osrm::util::SimpleLogger().Write(logWARNING) << "offset: " << current_offset; - osrm::util::SimpleLogger().Write(logWARNING) << "seek error " - << strerror(errno); + osrm::util::SimpleLogger().Write(logWARNING) << "seek error " << strerror(errno); throw osrm::util::exception("seek error"); } if (-1 == ret2) { osrm::util::SimpleLogger().Write(logWARNING) << "offset: " << current_offset; - osrm::util::SimpleLogger().Write(logWARNING) << "read error " - << strerror(errno); + osrm::util::SimpleLogger().Write(logWARNING) << "read error " << strerror(errno); throw osrm::util::exception("read error"); } timing_results_raw_random.push_back(TIMER_SEC(random_access)); @@ -274,15 +267,13 @@ int main(int argc, char *argv[]) try if (((off_t)-1) == ret1) { osrm::util::SimpleLogger().Write(logWARNING) << "offset: " << current_offset; - osrm::util::SimpleLogger().Write(logWARNING) << "seek error " - << strerror(errno); + osrm::util::SimpleLogger().Write(logWARNING) << "seek error " << strerror(errno); throw osrm::util::exception("seek error"); } if (-1 == ret2) { osrm::util::SimpleLogger().Write(logWARNING) << "offset: " << current_offset; - osrm::util::SimpleLogger().Write(logWARNING) << "read error " - << strerror(errno); + osrm::util::SimpleLogger().Write(logWARNING) << "read error " << strerror(errno); throw osrm::util::exception("read error"); } timing_results_raw_seq.push_back(TIMER_SEC(read_every_100)); diff --git a/src/tools/springclean.cpp b/src/tools/springclean.cpp index 440dda2f7..69a7cc175 100644 --- a/src/tools/springclean.cpp +++ b/src/tools/springclean.cpp @@ -60,13 +60,11 @@ int main() try osrm::util::SimpleLogger().Write() << "Releasing all locks"; osrm::util::SimpleLogger().Write() << "ATTENTION! BE CAREFUL!"; osrm::util::SimpleLogger().Write() << "----------------------"; - osrm::util::SimpleLogger().Write() - << "This tool may put osrm-routed into an undefined state!"; + osrm::util::SimpleLogger().Write() << "This tool may put osrm-routed into an undefined state!"; osrm::util::SimpleLogger().Write() << "Type 'Y' to acknowledge that you know what your are doing."; - osrm::util::SimpleLogger().Write() - << "\n\nDo you want to purge all shared memory allocated " - << "by osrm-datastore? [type 'Y' to confirm]"; + osrm::util::SimpleLogger().Write() << "\n\nDo you want to purge all shared memory allocated " + << "by osrm-datastore? [type 'Y' to confirm]"; const auto letter = getchar(); if (letter != 'Y') diff --git a/unit_tests/mocks/mock_datafacade.hpp b/unit_tests/mocks/mock_datafacade.hpp index 3c94fa5a9..833520015 100644 --- a/unit_tests/mocks/mock_datafacade.hpp +++ b/unit_tests/mocks/mock_datafacade.hpp @@ -6,49 +6,67 @@ #include "engine/datafacade/datafacade_base.hpp" #include "contractor/query_edge.hpp" -namespace osrm { -namespace test { - -template class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade +namespace osrm { - private: - EdgeDataT foo; - public: +namespace test +{ + +template +class MockDataFacadeT final : public osrm::engine::datafacade::BaseDataFacade +{ + private: + EdgeDataT foo; + + public: unsigned GetNumberOfNodes() const { return 0; } unsigned GetNumberOfEdges() const { return 0; } unsigned GetOutDegree(const NodeID /* n */) const { return 0; } NodeID GetTarget(const EdgeID /* e */) const { return SPECIAL_NODEID; } - const EdgeDataT &GetEdgeData(const EdgeID /* e */) const { - return foo; - } + const EdgeDataT &GetEdgeData(const EdgeID /* e */) const { return foo; } EdgeID BeginEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; } EdgeID EndEdges(const NodeID /* n */) const { return SPECIAL_EDGEID; } - osrm::engine::datafacade::EdgeRange GetAdjacentEdgeRange(const NodeID /* node */) const { - return util::irange(static_cast(0),static_cast(0)); + osrm::engine::datafacade::EdgeRange GetAdjacentEdgeRange(const NodeID /* node */) const + { + return util::irange(static_cast(0), static_cast(0)); } EdgeID FindEdge(const NodeID /* from */, const NodeID /* to */) const { return SPECIAL_EDGEID; } - EdgeID FindEdgeInEitherDirection(const NodeID /* from */, const NodeID /* to */) const { return SPECIAL_EDGEID; } - EdgeID - FindEdgeIndicateIfReverse(const NodeID /* from */, const NodeID /* to */, bool & /* result */) const { return SPECIAL_EDGEID; } - util::FixedPointCoordinate GetCoordinateOfNode(const unsigned /* id */) const { - FixedPointCoordinate foo(0,0); + EdgeID FindEdgeInEitherDirection(const NodeID /* from */, const NodeID /* to */) const + { + return SPECIAL_EDGEID; + } + EdgeID FindEdgeIndicateIfReverse(const NodeID /* from */, + const NodeID /* to */, + bool & /* result */) const + { + return SPECIAL_EDGEID; + } + util::FixedPointCoordinate GetCoordinateOfNode(const unsigned /* id */) const + { + FixedPointCoordinate foo(0, 0); return foo; } bool EdgeIsCompressed(const unsigned /* id */) const { return false; } unsigned GetGeometryIndexForEdgeID(const unsigned /* id */) const { return SPECIAL_NODEID; } void GetUncompressedGeometry(const EdgeID /* id */, - std::vector &/* result_nodes */) const {} + std::vector & /* result_nodes */) const + { + } void GetUncompressedWeights(const EdgeID /* id */, - std::vector & /* result_weights */) const {} - extractor::TurnInstruction GetTurnInstructionForEdgeID(const unsigned /* id */) const { + std::vector & /* result_weights */) const + { + } + extractor::TurnInstruction GetTurnInstructionForEdgeID(const unsigned /* id */) const + { return osrm::extractor::TurnInstruction::NoTurn; } - extractor::TravelMode GetTravelModeForEdgeID(const unsigned /* id */) const + extractor::TravelMode GetTravelModeForEdgeID(const unsigned /* id */) const { return TRAVEL_MODE_DEFAULT; } - std::vector::RTreeLeaf> GetEdgesInBox(const util::FixedPointCoordinate & /* south_west */, - const util::FixedPointCoordinate & /*north_east */) { + std::vector::RTreeLeaf> + GetEdgesInBox(const util::FixedPointCoordinate & /* south_west */, + const util::FixedPointCoordinate & /*north_east */) + { std::vector::RTreeLeaf> foo; return foo; } @@ -56,7 +74,8 @@ template class MockDataFacadeT final : public osrm::engine::da NearestPhantomNodesInRange(const util::FixedPointCoordinate /* input_coordinate */, const float /* max_distance */, const int /* bearing = 0 */, - const int /* bearing_range = 180 */) { + const int /* bearing_range = 180 */) + { std::vector foo; return foo; } @@ -64,14 +83,17 @@ template class MockDataFacadeT final : public osrm::engine::da NearestPhantomNodes(const util::FixedPointCoordinate /* input_coordinate */, const unsigned /* max_results */, const int /* bearing = 0 */, - const int /* bearing_range = 180 */) { + const int /* bearing_range = 180 */) + { std::vector foo; return foo; } - std::pair NearestPhantomNodeWithAlternativeFromBigComponent( + std::pair + NearestPhantomNodeWithAlternativeFromBigComponent( const util::FixedPointCoordinate /* input_coordinate */, const int /* bearing = 0 */, - const int /* bearing_range = 180 */) { + const int /* bearing_range = 180 */) + { std::pair foo; return foo; } @@ -81,7 +103,6 @@ template class MockDataFacadeT final : public osrm::engine::da std::string get_name_for_id(const unsigned /* name_id */) const { return ""; } std::size_t GetCoreSize() const { return 0; } std::string GetTimestamp() const { return ""; } - }; using MockDataFacade = MockDataFacadeT; diff --git a/unit_tests/server/parameters_parser.cpp b/unit_tests/server/parameters_parser.cpp index 7b8f465ba..7f79dc356 100644 --- a/unit_tests/server/parameters_parser.cpp +++ b/unit_tests/server/parameters_parser.cpp @@ -80,28 +80,48 @@ template std::size_t testInvalidOptions(std::string option BOOST_AUTO_TEST_CASE(invalid_route_urls) { - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?overview=false&bla=foo"), 22UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?overview=false&bearings=foo"), 32UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?overview=false&uturns=foo"), 30UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?overview=false&radiuses=foo"), 32UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?overview=false&hints=foo"), 22UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?overview=false&geometries=foo"), 22UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?overview=false&overview=foo"), 22L); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?overview=false&alternative=foo"), 22UL); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?overview=false&bla=foo"), 22UL); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?overview=false&bearings=foo"), + 32UL); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?overview=false&uturns=foo"), + 30UL); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?overview=false&radiuses=foo"), + 32UL); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?overview=false&hints=foo"), 22UL); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?overview=false&geometries=foo"), + 22UL); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?overview=false&overview=foo"), + 22L); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?overview=false&alternative=foo"), + 22UL); } BOOST_AUTO_TEST_CASE(invalid_table_urls) { - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?sources=1&bla=foo"), 17UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?destinations=1&bla=foo"), 22UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?sources=1&destinations=1&bla=foo"), 32UL); + BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?sources=1&bla=foo"), + 17UL); + BOOST_CHECK_EQUAL( + testInvalidOptions("1,2;3,4?destinations=1&bla=foo"), 22UL); + BOOST_CHECK_EQUAL(testInvalidOptions( + "1,2;3,4?sources=1&destinations=1&bla=foo"), + 32UL); BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?sources=foo"), 7UL); - BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?destinations=foo"), 7UL); + BOOST_CHECK_EQUAL(testInvalidOptions("1,2;3,4?destinations=foo"), + 7UL); } BOOST_AUTO_TEST_CASE(valid_route_urls) { - std::vector coords_1 = {{util::FloatLongitude(1), util::FloatLatitude(2)}, {util::FloatLongitude(3), util::FloatLatitude(4)}}; + std::vector coords_1 = {{util::FloatLongitude(1), util::FloatLatitude(2)}, + {util::FloatLongitude(3), util::FloatLatitude(4)}}; engine::api::RouteParameters reference_1{}; reference_1.coordinates = coords_1; @@ -136,7 +156,8 @@ BOOST_AUTO_TEST_CASE(valid_route_urls) engine::api::RouteParameters::OverviewType::False, uturns_3}; reference_3.coordinates = coords_1; auto result_3 = api::parseParameters( - "1,2;3,4?steps=false&alternative=false&geometries=geojson&overview=false&uturns=true;false;"); + "1,2;3,4?steps=false&alternative=false&geometries=geojson&overview=false&uturns=true;" + "false;"); BOOST_CHECK(result_3); BOOST_CHECK_EQUAL(reference_3.steps, result_3->steps); BOOST_CHECK_EQUAL(reference_3.alternative, result_3->alternative); @@ -165,7 +186,8 @@ BOOST_AUTO_TEST_CASE(valid_route_urls) std::vector>{}, std::vector>{}}; auto result_4 = api::parseParameters( - "1,2;3,4?steps=false&hints=rVghAzxMzABMAwAA5h4CAKMIAAAQAAAAGAAAAAYAAAAAAAAAch8BAJ4AAACpWCED_" + "1,2;3,4?steps=false&hints=" + "rVghAzxMzABMAwAA5h4CAKMIAAAQAAAAGAAAAAYAAAAAAAAAch8BAJ4AAACpWCED_" "0vMAAEAAQGLSzmR;_4ghA4JuzAD_" "IAAAo28BAOYAAAAzAAAAAgAAAEwAAAAAAAAAdIwAAJ4AAAAXiSEDfm7MAAEAAQGLSzmR;03AhA0vnzAA_SAAA_____" "3wEAAAYAAAAQAAAAB4AAABAAAAAoUYBAJ4AAADlcCEDSefMAAMAAQGLSzmR"); @@ -180,20 +202,18 @@ BOOST_AUTO_TEST_CASE(valid_route_urls) CHECK_EQUAL_RANGE(reference_4.coordinates, result_4->coordinates); std::vector> bearings_4 = { - boost::none, - engine::api::BaseParameters::Bearing {200, 10}, - engine::api::BaseParameters::Bearing {100, 5}, + boost::none, engine::api::BaseParameters::Bearing{200, 10}, + engine::api::BaseParameters::Bearing{100, 5}, }; - engine::api::RouteParameters reference_5{ - false, - true, - engine::api::RouteParameters::GeometriesType::Polyline, - engine::api::RouteParameters::OverviewType::Simplified, - std::vector>{}, - coords_1, - std::vector> {}, - std::vector>{}, - bearings_4}; + engine::api::RouteParameters reference_5{false, + true, + engine::api::RouteParameters::GeometriesType::Polyline, + engine::api::RouteParameters::OverviewType::Simplified, + std::vector>{}, + coords_1, + std::vector>{}, + std::vector>{}, + bearings_4}; auto result_5 = api::parseParameters( "1,2;3,4?steps=false&bearings=;200,10;100,5"); BOOST_CHECK(result_5); @@ -206,26 +226,29 @@ BOOST_AUTO_TEST_CASE(valid_route_urls) CHECK_EQUAL_RANGE(reference_5.radiuses, result_5->radiuses); CHECK_EQUAL_RANGE(reference_5.coordinates, result_5->coordinates); - std::vector coords_2 = {{util::FloatLongitude(0), util::FloatLatitude(1)}, {util::FloatLongitude(2), util::FloatLatitude(3)}, - {util::FloatLongitude(4), util::FloatLatitude(5)}}; + std::vector coords_2 = {{util::FloatLongitude(0), util::FloatLatitude(1)}, + {util::FloatLongitude(2), util::FloatLatitude(3)}, + {util::FloatLongitude(4), util::FloatLatitude(5)}}; engine::api::RouteParameters reference_6{}; reference_6.coordinates = coords_2; - auto result_6 = api::parseParameters("polyline(_ibE?_seK_seK_seK_seK)"); + auto result_6 = + api::parseParameters("polyline(_ibE?_seK_seK_seK_seK)"); BOOST_CHECK(result_6); - BOOST_CHECK_EQUAL(reference_6.steps, result_6->steps); + BOOST_CHECK_EQUAL(reference_6.steps, result_6->steps); BOOST_CHECK_EQUAL(reference_6.alternative, result_6->alternative); - BOOST_CHECK_EQUAL(reference_6.geometries, result_6->geometries); - BOOST_CHECK_EQUAL(reference_6.overview, result_6->overview); - CHECK_EQUAL_RANGE(reference_6.uturns, result_6->uturns); - CHECK_EQUAL_RANGE(reference_6.bearings, result_6->bearings); - CHECK_EQUAL_RANGE(reference_6.radiuses, result_6->radiuses); + BOOST_CHECK_EQUAL(reference_6.geometries, result_6->geometries); + BOOST_CHECK_EQUAL(reference_6.overview, result_6->overview); + CHECK_EQUAL_RANGE(reference_6.uturns, result_6->uturns); + CHECK_EQUAL_RANGE(reference_6.bearings, result_6->bearings); + CHECK_EQUAL_RANGE(reference_6.radiuses, result_6->radiuses); CHECK_EQUAL_RANGE(reference_6.coordinates, result_6->coordinates); } BOOST_AUTO_TEST_CASE(valid_table_urls) { - std::vector coords_1 = {{util::FloatLongitude(1), util::FloatLatitude(2)}, {util::FloatLongitude(3), util::FloatLatitude(4)}}; + std::vector coords_1 = {{util::FloatLongitude(1), util::FloatLatitude(2)}, + {util::FloatLongitude(3), util::FloatLatitude(4)}}; engine::api::TableParameters reference_1{}; reference_1.coordinates = coords_1; @@ -241,18 +264,20 @@ BOOST_AUTO_TEST_CASE(valid_table_urls) std::vector destinations_2 = {4, 5}; engine::api::TableParameters reference_2{sources_2, destinations_2}; reference_2.coordinates = coords_1; - auto result_2 = api::parseParameters("1,2;3,4?sources=1;2;3&destinations=4;5"); + auto result_2 = api::parseParameters( + "1,2;3,4?sources=1;2;3&destinations=4;5"); BOOST_CHECK(result_2); - CHECK_EQUAL_RANGE(reference_2.sources, result_2->sources); + CHECK_EQUAL_RANGE(reference_2.sources, result_2->sources); CHECK_EQUAL_RANGE(reference_2.destinations, result_2->destinations); - CHECK_EQUAL_RANGE(reference_2.bearings, result_2->bearings); - CHECK_EQUAL_RANGE(reference_2.radiuses, result_2->radiuses); - CHECK_EQUAL_RANGE(reference_2.coordinates, result_2->coordinates); + CHECK_EQUAL_RANGE(reference_2.bearings, result_2->bearings); + CHECK_EQUAL_RANGE(reference_2.radiuses, result_2->radiuses); + CHECK_EQUAL_RANGE(reference_2.coordinates, result_2->coordinates); } BOOST_AUTO_TEST_CASE(valid_match_urls) { - std::vector coords_1 = {{util::FloatLongitude(1), util::FloatLatitude(2)}, {util::FloatLongitude(3), util::FloatLatitude(4)}}; + std::vector coords_1 = {{util::FloatLongitude(1), util::FloatLatitude(2)}, + {util::FloatLongitude(3), util::FloatLatitude(4)}}; engine::api::MatchParameters reference_1{}; reference_1.coordinates = coords_1; @@ -290,7 +315,8 @@ BOOST_AUTO_TEST_CASE(valid_tile_urls) BOOST_AUTO_TEST_CASE(valid_trip_urls) { - std::vector coords_1 = {{util::FloatLongitude(1), util::FloatLatitude(2)}, {util::FloatLongitude(3), util::FloatLatitude(4)}}; + std::vector coords_1 = {{util::FloatLongitude(1), util::FloatLatitude(2)}, + {util::FloatLongitude(3), util::FloatLatitude(4)}}; engine::api::TripParameters reference_1{}; reference_1.coordinates = coords_1; diff --git a/unit_tests/util/io.cpp b/unit_tests/util/io.cpp index 75aed5bc1..e37fa13b6 100644 --- a/unit_tests/util/io.cpp +++ b/unit_tests/util/io.cpp @@ -36,8 +36,7 @@ BOOST_AUTO_TEST_CASE(io_data) osrm::util::deserializeVector(IO_TMP_FILE, data_out); BOOST_REQUIRE_EQUAL(data_in.size(), data_out.size()); - BOOST_CHECK_EQUAL_COLLECTIONS(data_out.begin(), data_out.end(), data_in.begin(), - data_in.end()); + BOOST_CHECK_EQUAL_COLLECTIONS(data_out.begin(), data_out.end(), data_in.begin(), data_in.end()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/unit_tests/util/static_graph.cpp b/unit_tests/util/static_graph.cpp index 1e6721489..c975401a0 100644 --- a/unit_tests/util/static_graph.cpp +++ b/unit_tests/util/static_graph.cpp @@ -96,8 +96,8 @@ BOOST_FIXTURE_TEST_CASE(array_test, TestRandomArrayEntryFixture) BOOST_AUTO_TEST_CASE(target_test) { - std::vector input_edges = { - TestInputEdge{0, 1, TestData{1}}, TestInputEdge{3, 0, TestData{2}}}; + std::vector input_edges = {TestInputEdge{0, 1, TestData{1}}, + TestInputEdge{3, 0, TestData{2}}}; TestStaticGraph simple_graph = TestStaticGraph(4, input_edges); auto target = simple_graph.GetTarget(simple_graph.FindEdge(3, 0)); diff --git a/unit_tests/util/static_rtree.cpp b/unit_tests/util/static_rtree.cpp index 026ca62ce..d61ec2815 100644 --- a/unit_tests/util/static_rtree.cpp +++ b/unit_tests/util/static_rtree.cpp @@ -25,7 +25,6 @@ #include #include - BOOST_AUTO_TEST_SUITE(static_rtree) using namespace osrm; @@ -306,8 +305,11 @@ BOOST_AUTO_TEST_CASE(regression_test) { Coord{FloatLongitude{0.0}, FloatLatitude{40.0}}, // Coord{FloatLongitude{5.0}, FloatLatitude{35.0}}, // - Coord{FloatLongitude{5.0}, FloatLatitude{5.0,}}, // - Coord{FloatLongitude{10.0}, FloatLatitude{0.0}}, // + Coord{FloatLongitude{5.0}, + FloatLatitude{ + 5.0, + }}, // + Coord{FloatLongitude{10.0}, FloatLatitude{0.0}}, // Coord{FloatLongitude{10.0}, FloatLatitude{20.0}}, // Coord{FloatLongitude{5.0}, FloatLatitude{20.0}}, // Coord{FloatLongitude{100.0}, FloatLatitude{40.0}}, // @@ -407,7 +409,8 @@ BOOST_AUTO_TEST_CASE(bearing_tests) build_rtree("test_bearing", &fixture, leaves_path, nodes_path); MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords); std::unique_ptr mockfacade_ptr(new MockDataFacade); - engine::GeospatialQuery query(rtree, fixture.coords, *mockfacade_ptr); + engine::GeospatialQuery query(rtree, fixture.coords, + *mockfacade_ptr); Coordinate input(FloatLongitude(5.1), FloatLatitude(5.0)); @@ -472,7 +475,8 @@ BOOST_AUTO_TEST_CASE(bbox_search_tests) build_rtree("test_bbox", &fixture, leaves_path, nodes_path); MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords); std::unique_ptr mockfacade_ptr(new MockDataFacade); - engine::GeospatialQuery query(rtree, fixture.coords, *mockfacade_ptr); + engine::GeospatialQuery query(rtree, fixture.coords, + *mockfacade_ptr); { RectangleInt2D bbox = {FloatLongitude(0.5), FloatLongitude(1.5), FloatLatitude(0.5),