Upgrade formatting to clang-format 10 (#5895)

* Update formatting tools to clang-format-10

* Reformat using clang-format-10.0.09
This commit is contained in:
Daniel Patterson
2020-11-26 07:21:39 -08:00
committed by GitHub
parent a3f1c2afb0
commit 50d9632ed7
373 changed files with 1198 additions and 1163 deletions
+2 -2
View File
@@ -396,5 +396,5 @@ std::unique_ptr<SegmentDataContainer> CompressedEdgeContainer::ToSegmentData()
return std::move(segment_data);
}
}
}
} // namespace extractor
} // namespace osrm
+17 -20
View File
@@ -51,7 +51,7 @@ template <> struct hash<std::pair<NodeID, NodeID>>
return seed;
}
};
}
} // namespace std
namespace osrm
{
@@ -548,22 +548,21 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
&scripting_environment,
weight_multiplier,
&conditional_restriction_map](
// what nodes will be used? In most cases this will be the id
// stored in the edge_data. In case of duplicated nodes (e.g.
// due to via-way restrictions), one/both of these might
// refer to a newly added edge based node
const auto edge_based_node_from,
const auto edge_based_node_to,
// the situation of the turn
const auto node_along_road_entering,
const auto node_based_edge_from,
const auto intersection_node,
const auto node_based_edge_to,
const auto &turn_angle,
const auto &road_legs_on_the_right,
const auto &road_legs_on_the_left,
const auto &edge_geometries) {
// what nodes will be used? In most cases this will be the id
// stored in the edge_data. In case of duplicated nodes (e.g.
// due to via-way restrictions), one/both of these might
// refer to a newly added edge based node
const auto edge_based_node_from,
const auto edge_based_node_to,
// the situation of the turn
const auto node_along_road_entering,
const auto node_based_edge_from,
const auto intersection_node,
const auto node_based_edge_to,
const auto &turn_angle,
const auto &road_legs_on_the_right,
const auto &road_legs_on_the_left,
const auto &edge_geometries) {
const auto node_restricted =
isRestricted(node_along_road_entering,
intersection_node,
@@ -687,7 +686,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
//
tbb::filter_t<tbb::blocked_range<NodeID>, EdgesPipelineBufferPtr> processor_stage(
tbb::filter::parallel, [&](const tbb::blocked_range<NodeID> &intersection_node_range) {
auto buffer = std::make_shared<EdgesPipelineBuffer>();
buffer->nodes_processed = intersection_node_range.size();
@@ -885,7 +883,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
// TODO: this loop is not optimized - once we have a few
// overrides available, we should index this for faster
// lookups
for (auto & override : unresolved_maneuver_overrides)
for (auto &override : unresolved_maneuver_overrides)
{
for (auto &turn : override.turn_sequence)
{
@@ -1026,7 +1024,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
std::vector<EdgeWithData> delayed_data;
tbb::filter_t<EdgesPipelineBufferPtr, void> output_stage(
tbb::filter::serial_in_order, [&](auto buffer) {
routing_progress.PrintAddition(buffer->nodes_processed);
m_connectivity_checksum = buffer->checksum.update_checksum(m_connectivity_checksum);
+6 -7
View File
@@ -99,7 +99,7 @@ inline NodeID mapExternalToInternalNodeID(Iter first, Iter last, const OSMNodeID
return (it == last || value < *it) ? SPECIAL_NODEID
: static_cast<NodeID>(std::distance(first, it));
}
}
} // namespace
namespace osrm
{
@@ -277,8 +277,8 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
{
if (edge_iterator->result.osm_source_id < node_iterator->node_id)
{
util::Log(logDEBUG) << "Found invalid node reference "
<< edge_iterator->result.source;
util::Log(logDEBUG)
<< "Found invalid node reference " << edge_iterator->result.source;
edge_iterator->result.source = SPECIAL_NODEID;
++edge_iterator;
continue;
@@ -744,7 +744,6 @@ void ExtractionContainers::PrepareManeuverOverrides()
**/
auto const find_turn_from_way_tofrom_nodes = [&](auto const &from_segment,
auto const &to_segment) {
if (from_segment.first_segment_source_id == to_segment.first_segment_source_id)
{
return NodeBasedTurn{osm_node_to_internal_nbn(from_segment.first_segment_target_id),
@@ -861,7 +860,6 @@ void ExtractionContainers::PrepareManeuverOverrides()
// Later, the UnresolvedManeuverOverride will be converted into a final ManeuverOverride
// once the edge-based-node IDs are generated by the edge-based-graph-factory
const auto transform = [&](const auto &external, auto &internal) {
// Create a stub override
auto maneuver_override =
UnresolvedManeuverOverride{{},
@@ -1040,8 +1038,9 @@ void ExtractionContainers::PrepareRestrictions()
// translate the turn from one segment onto another into a node restriction (the ways can
// only
// be connected at a single location)
auto const get_node_restriction_from_OSM_ids = [&](
auto const from_id, auto const to_id, const OSMNodeID via_node) {
auto const get_node_restriction_from_OSM_ids = [&](auto const from_id,
auto const to_id,
const OSMNodeID via_node) {
auto const from_segment_itr = referenced_ways.find(from_id);
if (from_segment_itr->second.way_id != from_id)
{
+3 -3
View File
@@ -552,9 +552,9 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
const auto &rel = static_cast<const osmium::Relation &>(*entity);
const char *rel_type = rel.get_value_by_key("type");
if (!rel_type ||
!std::binary_search(
relation_types.begin(), relation_types.end(), std::string(rel_type)))
if (!rel_type || !std::binary_search(relation_types.begin(),
relation_types.end(),
std::string(rel_type)))
continue;
ExtractionRelation extracted_rel({rel.id(), osmium::item_type::relation});
+1 -1
View File
@@ -75,7 +75,7 @@ void ExtractorCallbacks::ProcessRestriction(const InputConditionalTurnRestrictio
// util::Log() << restriction.toString();
}
void ExtractorCallbacks::ProcessManeuverOverride(const InputManeuverOverride & override)
void ExtractorCallbacks::ProcessManeuverOverride(const InputManeuverOverride &override)
{
external_memory.external_maneuver_overrides_list.push_back(override);
}
+14 -13
View File
@@ -185,17 +185,18 @@ void GraphCompressor::Compress(
* just
* like a barrier.
*/
const auto selectAnnotation = [&node_data_container](
const AnnotationID front_annotation, const AnnotationID back_annotation) {
// 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
if (node_data_container[back_annotation].lane_description_id ==
INVALID_LANE_DESCRIPTIONID)
return front_annotation;
return back_annotation;
};
const auto selectAnnotation =
[&node_data_container](const AnnotationID front_annotation,
const AnnotationID back_annotation) {
// 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
if (node_data_container[back_annotation].lane_description_id ==
INVALID_LANE_DESCRIPTIONID)
return front_annotation;
return back_annotation;
};
graph.GetEdgeData(forward_e1).annotation_data = selectAnnotation(
fwd_edge_data1.annotation_data, fwd_edge_data2.annotation_data);
@@ -371,5 +372,5 @@ void GraphCompressor::PrintStatistics(unsigned original_number_of_nodes,
util::Log() << "Node compression ratio: " << new_node_count / (double)original_number_of_nodes;
util::Log() << "Edge compression ratio: " << new_edge_count / (double)original_number_of_edges;
}
}
}
} // namespace extractor
} // namespace osrm
@@ -55,7 +55,7 @@ double GetOffsetCorrectionFactor(const RoadClassification &road_classification)
return 1.0;
};
}
}
} // namespace
CoordinateExtractor::CoordinateExtractor(
const util::NodeBasedDynamicGraph &node_based_graph,
@@ -146,9 +146,8 @@ util::Coordinate CoordinateExtractor::ExtractRepresentativeCoordinate(
// do the best of what we can.
coordinates =
TrimCoordinatesToLength(std::move(coordinates), LOOKAHEAD_DISTANCE_WITHOUT_LANES);
if (coordinates.size() > 2 &&
util::coordinate_calculation::haversineDistance(turn_coordinate, coordinates[1]) <
ASSUMED_LANE_WIDTH)
if (coordinates.size() > 2 && util::coordinate_calculation::haversineDistance(
turn_coordinate, coordinates[1]) < ASSUMED_LANE_WIDTH)
{
const auto initial_distance =
util::coordinate_calculation::haversineDistance(turn_coordinate, coordinates[1]);
@@ -442,7 +441,7 @@ CoordinateExtractor::ExtractCoordinateAtLength(const double distance,
auto length_cache_itr = length_cache.begin() + 1;
// find the end of the segment containing the coordinate which is at least distance away
const auto find_coordinate_at_distance = [distance, &accumulated_distance, &length_cache_itr](
const util::Coordinate /*coordinate*/) mutable {
const util::Coordinate /*coordinate*/) mutable {
const auto result = (accumulated_distance + *length_cache_itr) >= distance;
if (!result)
{
@@ -474,20 +473,19 @@ util::Coordinate CoordinateExtractor::ExtractCoordinateAtLength(
double accumulated_distance = 0.;
// checks (via its state) for an accumulated distance
const auto coordinate_at_distance =
[ distance, &accumulated_distance, last_coordinate = coordinates.front() ](
const util::Coordinate coordinate) mutable
{
const double segment_distance =
util::coordinate_calculation::haversineDistance(last_coordinate, coordinate);
const auto result = (accumulated_distance + segment_distance) >= distance;
if (!result)
{
accumulated_distance += segment_distance;
last_coordinate = coordinate;
}
[distance, &accumulated_distance, last_coordinate = coordinates.front()](
const util::Coordinate coordinate) mutable {
const double segment_distance =
util::coordinate_calculation::haversineDistance(last_coordinate, coordinate);
const auto result = (accumulated_distance + segment_distance) >= distance;
if (!result)
{
accumulated_distance += segment_distance;
last_coordinate = coordinate;
}
return result;
};
return result;
};
// find the begin of the segment containing the coordinate
const auto coordinate_after =
@@ -532,11 +530,12 @@ util::Coordinate CoordinateExtractor::GetCoordinateCloseToTurn(const NodeID from
// OSM data has a tendency to include repeated nodes with identical coordinates. To skip
// over these, we search for the first coordinate along the path that is at least a meter
// away from the first entry
const auto far_enough_away = [start_coordinate, compressedGeometryToCoordinate](
const CompressedEdgeContainer::OnewayCompressedEdge &compressed_edge) {
return util::coordinate_calculation::haversineDistance(
compressedGeometryToCoordinate(compressed_edge), start_coordinate) > 1;
};
const auto far_enough_away =
[start_coordinate, compressedGeometryToCoordinate](
const CompressedEdgeContainer::OnewayCompressedEdge &compressed_edge) {
return util::coordinate_calculation::haversineDistance(
compressedGeometryToCoordinate(compressed_edge), start_coordinate) > 1;
};
// find the first coordinate, that is at least unequal to the begin of the edge
if (traversed_in_reverse)
@@ -893,19 +892,19 @@ CoordinateExtractor::PrepareLengthCache(const std::vector<util::Coordinate> &coo
segment_distances.reserve(coordinates.size());
segment_distances.push_back(0);
// sentinel
std::find_if(std::next(std::begin(coordinates)), std::end(coordinates), [
last_coordinate = coordinates.front(),
limit,
&segment_distances,
accumulated_distance = 0.
](const util::Coordinate current_coordinate) mutable {
const auto distance =
util::coordinate_calculation::haversineDistance(last_coordinate, current_coordinate);
accumulated_distance += distance;
last_coordinate = current_coordinate;
segment_distances.push_back(distance);
return accumulated_distance >= limit;
});
std::find_if(std::next(std::begin(coordinates)),
std::end(coordinates),
[last_coordinate = coordinates.front(),
limit,
&segment_distances,
accumulated_distance = 0.](const util::Coordinate current_coordinate) mutable {
const auto distance = util::coordinate_calculation::haversineDistance(
last_coordinate, current_coordinate);
accumulated_distance += distance;
last_coordinate = current_coordinate;
segment_distances.push_back(distance);
return accumulated_distance >= limit;
});
return segment_distances;
}
@@ -25,6 +25,6 @@ bool HaveIdenticalNames(const NameID lhs,
!util::guidance::requiresNameAnnounced(rhs, lhs, name_table, street_name_suffix_table);
}
} // namespace guidance
} // namespace intersection
} // namespace extractor
} // namespace osrm
+2 -2
View File
@@ -21,8 +21,8 @@ bool IntersectionViewData::CompareByAngle(const IntersectionViewData &other) con
std::string toString(const IntersectionEdgeGeometry &shape)
{
std::string result = "[shape] " + std::to_string(shape.eid) + " bearing: " +
std::to_string(shape.perceived_bearing);
std::string result = "[shape] " + std::to_string(shape.eid) +
" bearing: " + std::to_string(shape.perceived_bearing);
return result;
}
@@ -248,7 +248,7 @@ getIntersectionOutgoingGeometries(const util::NodeBasedDynamicGraph &graph,
});
return edge_geometries;
}
}
} // namespace
std::pair<IntersectionEdgeGeometries, std::unordered_set<EdgeID>>
getIntersectionGeometries(const util::NodeBasedDynamicGraph &graph,
@@ -827,6 +827,6 @@ IntersectionEdge skipDegreeTwoNodes(const util::NodeBasedDynamicGraph &graph, In
return road;
}
}
}
}
} // namespace intersection
} // namespace extractor
} // namespace osrm
@@ -31,7 +31,7 @@ inline auto makeCheckRoadForName(const NameID name_id,
const SuffixTable &suffix_table)
{
return [name_id, &node_based_graph, &node_data_container, &name_table, &suffix_table](
const MergableRoadDetector::MergableRoadData &road) {
const MergableRoadDetector::MergableRoadData &road) {
// since we filter here, we don't want any other name than the one we are looking for
const auto road_name_id =
node_data_container
@@ -49,7 +49,7 @@ inline auto makeCheckRoadForName(const NameID name_id,
return requires_announcement;
};
}
}
} // namespace
MergableRoadDetector::MergableRoadDetector(
const util::NodeBasedDynamicGraph &node_based_graph,
@@ -70,12 +70,12 @@ SelectRoadByNameOnlyChoiceAndStraightness::SelectRoadByNameOnlyChoiceAndStraight
{
}
boost::optional<EdgeID> SelectRoadByNameOnlyChoiceAndStraightness::
operator()(const NodeID /*nid*/,
const EdgeID /*via_edge_id*/,
const IntersectionView &intersection,
const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container) const
boost::optional<EdgeID> SelectRoadByNameOnlyChoiceAndStraightness::operator()(
const NodeID /*nid*/,
const EdgeID /*via_edge_id*/,
const IntersectionView &intersection,
const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container) const
{
BOOST_ASSERT(!intersection.empty());
const auto comparator = [&](const IntersectionViewData &lhs, const IntersectionViewData &rhs) {
@@ -120,12 +120,12 @@ SelectStraightmostRoadByNameAndOnlyChoice::SelectStraightmostRoadByNameAndOnlyCh
{
}
boost::optional<EdgeID> SelectStraightmostRoadByNameAndOnlyChoice::
operator()(const NodeID /*nid*/,
const EdgeID /*via_edge_id*/,
const IntersectionView &intersection,
const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container) const
boost::optional<EdgeID> SelectStraightmostRoadByNameAndOnlyChoice::operator()(
const NodeID /*nid*/,
const EdgeID /*via_edge_id*/,
const IntersectionView &intersection,
const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container) const
{
BOOST_ASSERT(!intersection.empty());
if (intersection.size() == 1)
+2 -3
View File
@@ -218,7 +218,6 @@ std::vector<std::size_t> LocationDependentData::GetPropertyIndexes(const point_t
// Search the R-tree and collect a Lua table of tags that correspond to the location
rtree.query(boost::geometry::index::intersects(point) &&
boost::geometry::index::satisfies([this, &point](const rtree_t::value_type &v) {
// Simple point-in-polygon algorithm adapted from
// https://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
@@ -276,5 +275,5 @@ std::vector<std::size_t> LocationDependentData::GetPropertyIndexes(const point_t
return result;
}
}
}
} // namespace extractor
} // namespace osrm
@@ -136,5 +136,5 @@ ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const
}
return maneuver_override;
}
}
}
} // namespace extractor
} // namespace osrm
+2 -2
View File
@@ -169,5 +169,5 @@ RasterContainer::GetRasterInterpolateFromSource(unsigned int source_id, double l
}
RasterCache *RasterCache::g_instance = NULL;
}
}
} // namespace extractor
} // namespace osrm
+2 -2
View File
@@ -255,5 +255,5 @@ bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_st
std::find(std::begin(restrictions), std::end(restrictions), current_string);
});
}
}
}
} // namespace extractor
} // namespace osrm
+4 -5
View File
@@ -37,7 +37,7 @@ template <> struct is_container<osmium::Way> : std::false_type
template <> struct is_container<osmium::Relation> : std::false_type
{
};
}
} // namespace sol
namespace osrm
{
@@ -91,7 +91,7 @@ struct to_lua_object : public boost::static_visitor<sol::object>
auto operator()(boost::blank &) const { return sol::nil; }
sol::state &state;
};
}
} // namespace
Sol2ScriptingEnvironment::Sol2ScriptingEnvironment(
const std::string &file_name,
@@ -424,8 +424,8 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
"get_relations",
[&getTypedRefBySol](ExtractionRelationContainer &cont, const sol::object &obj)
-> const ExtractionRelationContainer::RelationIDList & {
return cont.GetRelations(getTypedRefBySol(obj));
},
return cont.GetRelations(getTypedRefBySol(obj));
},
"relation",
[](ExtractionRelationContainer &cont, const ExtractionRelation::OsmIDTyped &rel_id)
-> const ExtractionRelation & { return cont.GetRelationData(rel_id); });
@@ -589,7 +589,6 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
};
auto initialize_V3_extraction_turn = [&]() {
context.state.new_usertype<ExtractionTurn>(
"ExtractionTurn",
"angle",