Second round of formatting

This commit is contained in:
Dennis Luxen 2024-05-19 14:09:45 +02:00
parent a59ce85fd0
commit d1632f5021
15 changed files with 73 additions and 62 deletions

View File

@ -15,8 +15,8 @@ struct QueryEdge
struct EdgeData struct EdgeData
{ {
explicit EdgeData() explicit EdgeData()
: turn_id(0), shortcut(false), weight{0}, duration(0), forward(false), backward(false), : turn_id(0), shortcut(false), weight{0}, duration(0), forward(false),
distance{0} backward(false), distance{0}
{ {
} }

View File

@ -72,8 +72,9 @@ class BaseAPI
std::transform(candidates.begin(), std::transform(candidates.begin(),
candidates.end(), candidates.end(),
seg_hints.begin(), seg_hints.begin(),
[this](const auto &phantom) [this](const auto &phantom) {
{ return SegmentHint{phantom, facade.GetCheckSum()}; }); return SegmentHint{phantom, facade.GetCheckSum()};
});
return json::makeWaypoint( return json::makeWaypoint(
snapped_location, snapped_location,
@ -141,8 +142,9 @@ class BaseAPI
std::transform(candidates.begin(), std::transform(candidates.begin(),
candidates.end(), candidates.end(),
seg_hints.begin(), seg_hints.begin(),
[this](const auto &phantom) [this](const auto &phantom) {
{ return SegmentHint{phantom, facade.GetCheckSum()}; }); return SegmentHint{phantom, facade.GetCheckSum()};
});
Hint hint{std::move(seg_hints)}; Hint hint{std::move(seg_hints)};
hint_string = builder->CreateString(hint.ToBase64()); hint_string = builder->CreateString(hint.ToBase64());
} }

View File

@ -78,8 +78,9 @@ struct MatchParameters : public RouteParameters
bool tidy_, bool tidy_,
const std::vector<std::size_t> &waypoints_, const std::vector<std::size_t> &waypoints_,
Args &&...args_) Args &&...args_)
: RouteParameters{std::forward<Args>(args_)..., waypoints_}, : RouteParameters{std::forward<Args>(args_)..., waypoints_}, timestamps{std::move(
timestamps{std::move(timestamps_)}, gaps(gaps_), tidy(tidy_) timestamps_)},
gaps(gaps_), tidy(tidy_)
{ {
} }

View File

@ -141,8 +141,8 @@ struct RouteParameters : public BaseParameters
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_}, : BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_}, number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_},
annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None}, annotations_type{annotations_ ? AnnotationsType::All : AnnotationsType::None},
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}, geometries{geometries_}, overview{overview_},
waypoints{std::move(waypoints_)} continue_straight{continue_straight_}, waypoints{std::move(waypoints_)}
{ {
} }
@ -157,10 +157,10 @@ struct RouteParameters : public BaseParameters
std::vector<std::size_t> waypoints_, std::vector<std::size_t> waypoints_,
Args &&...args_) Args &&...args_)
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_}, : BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
number_of_alternatives{alternatives_ ? 1u : 0u}, number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{annotations_ !=
annotations{annotations_ != AnnotationsType::None}, annotations_type{annotations_}, AnnotationsType::None},
geometries{geometries_}, overview{overview_}, continue_straight{continue_straight_}, annotations_type{annotations_}, geometries{geometries_}, overview{overview_},
waypoints{std::move(waypoints_)} continue_straight{continue_straight_}, waypoints{std::move(waypoints_)}
{ {
} }

View File

@ -61,8 +61,8 @@ struct TripParameters : public RouteParameters
DestinationType destination_, DestinationType destination_,
bool roundtrip_, bool roundtrip_,
Args &&...args_) Args &&...args_)
: RouteParameters{std::forward<Args>(args_)...}, source{source_}, destination{destination_}, : RouteParameters{std::forward<Args>(args_)...}, source{source_},
roundtrip{roundtrip_} destination{destination_}, roundtrip{roundtrip_}
{ {
} }

View File

@ -44,15 +44,16 @@ namespace osrm::engine
struct PhantomNode struct PhantomNode
{ {
PhantomNode() PhantomNode()
: forward_segment_id{SPECIAL_SEGMENTID, false}, : forward_segment_id{SPECIAL_SEGMENTID, false}, reverse_segment_id{SPECIAL_SEGMENTID,
reverse_segment_id{SPECIAL_SEGMENTID, false}, forward_weight(INVALID_EDGE_WEIGHT), false},
forward_weight(INVALID_EDGE_WEIGHT),
reverse_weight(INVALID_EDGE_WEIGHT), forward_weight_offset{0}, reverse_weight_offset{0}, reverse_weight(INVALID_EDGE_WEIGHT), forward_weight_offset{0}, reverse_weight_offset{0},
forward_distance(INVALID_EDGE_DISTANCE), reverse_distance(INVALID_EDGE_DISTANCE), forward_distance(INVALID_EDGE_DISTANCE), reverse_distance(INVALID_EDGE_DISTANCE),
forward_distance_offset{0}, reverse_distance_offset{0}, forward_distance_offset{0}, reverse_distance_offset{0},
forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION), forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION),
forward_duration_offset{0}, reverse_duration_offset{0}, forward_duration_offset{0}, reverse_duration_offset{0},
component({INVALID_COMPONENTID, 0}), fwd_segment_position(0), component({INVALID_COMPONENTID, 0}),
is_valid_forward_source{false}, is_valid_forward_target{false}, fwd_segment_position(0), is_valid_forward_source{false}, is_valid_forward_target{false},
is_valid_reverse_source{false}, is_valid_reverse_target{false}, bearing(0) is_valid_reverse_source{false}, is_valid_reverse_target{false}, bearing(0)
{ {

View File

@ -70,7 +70,7 @@ class BasePlugin
std::string message; std::string message;
ErrorRenderer(std::string code, std::string message) ErrorRenderer(std::string code, std::string message)
: code(std::move(code)), message(std::move(message)) {}; : code(std::move(code)), message(std::move(message)){};
void operator()(util::json::Object &json_result) void operator()(util::json::Object &json_result)
{ {

View File

@ -71,7 +71,7 @@ struct NodeBucket
{ {
unsigned column_idx; unsigned column_idx;
ColumnCompare(unsigned column_idx) : column_idx(column_idx) {}; ColumnCompare(unsigned column_idx) : column_idx(column_idx){};
bool operator()(const NodeBucket &lhs, const NodeID &rhs) const // lowerbound bool operator()(const NodeBucket &lhs, const NodeID &rhs) const // lowerbound
{ {

View File

@ -18,8 +18,9 @@ namespace osrm::extractor
struct EdgeBasedNodeSegment struct EdgeBasedNodeSegment
{ {
EdgeBasedNodeSegment() EdgeBasedNodeSegment()
: forward_segment_id{SPECIAL_SEGMENTID, false}, : forward_segment_id{SPECIAL_SEGMENTID, false}, reverse_segment_id{SPECIAL_SEGMENTID,
reverse_segment_id{SPECIAL_SEGMENTID, false}, u(SPECIAL_NODEID), v(SPECIAL_NODEID), false},
u(SPECIAL_NODEID), v(SPECIAL_NODEID),
fwd_segment_position(std::numeric_limits<unsigned short>::max() >> fwd_segment_position(std::numeric_limits<unsigned short>::max() >>
1), // >> 1 because we've only got 15 bits 1), // >> 1 because we've only got 15 bits
is_startpoint(false) is_startpoint(false)

View File

@ -105,7 +105,9 @@ std::vector<BisectionInputEdge> adaptToBisectionEdge(std::vector<InputEdge> edge
std::transform(begin(edges), std::transform(begin(edges),
end(edges), end(edges),
std::back_inserter(result), std::back_inserter(result),
[](const auto &edge) { return BisectionInputEdge{edge.source, edge.target}; }); [](const auto &edge) {
return BisectionInputEdge{edge.source, edge.target};
});
return result; return result;
} }

View File

@ -189,10 +189,10 @@ template <storage::Ownership Ownership> class CellStorageImpl
const NodeID *const all_sources, const NodeID *const all_sources,
const NodeID *const all_destinations) const NodeID *const all_destinations)
: num_source_nodes{data.num_source_nodes}, : num_source_nodes{data.num_source_nodes},
num_destination_nodes{data.num_destination_nodes}, num_destination_nodes{data.num_destination_nodes}, weights{all_weights +
weights{all_weights + data.value_offset}, data.value_offset},
durations{all_durations + data.value_offset}, durations{all_durations + data.value_offset}, distances{all_distances +
distances{all_distances + data.value_offset}, data.value_offset},
source_boundary{all_sources + data.source_boundary_offset}, source_boundary{all_sources + data.source_boundary_offset},
destination_boundary{all_destinations + data.destination_boundary_offset} destination_boundary{all_destinations + data.destination_boundary_offset}
{ {
@ -210,8 +210,8 @@ template <storage::Ownership Ownership> class CellStorageImpl
const NodeID *const all_destinations) const NodeID *const all_destinations)
: num_source_nodes{data.num_source_nodes}, : num_source_nodes{data.num_source_nodes},
num_destination_nodes{data.num_destination_nodes}, weights{nullptr}, num_destination_nodes{data.num_destination_nodes}, weights{nullptr},
durations{nullptr}, distances{nullptr}, durations{nullptr}, distances{nullptr}, source_boundary{all_sources +
source_boundary{all_sources + data.source_boundary_offset}, data.source_boundary_offset},
destination_boundary{all_destinations + data.destination_boundary_offset} destination_boundary{all_destinations + data.destination_boundary_offset}
{ {
BOOST_ASSERT(num_source_nodes == 0 || all_sources != nullptr); BOOST_ASSERT(num_source_nodes == 0 || all_sources != nullptr);

View File

@ -164,7 +164,8 @@ graphToEdges(const DynamicEdgeBasedGraph &edge_based_graph)
[](const NodeID lhs, const NodeID rhs) { return std::max(lhs, rhs); }); [](const NodeID lhs, const NodeID rhs) { return std::max(lhs, rhs); });
std::vector<extractor::EdgeBasedEdge> edges(max_turn_id + 1); std::vector<extractor::EdgeBasedEdge> edges(max_turn_id + 1);
tbb::parallel_for(range, tbb::parallel_for(
range,
[&](const auto range) [&](const auto range)
{ {
for (auto node = range.begin(); node < range.end(); ++node) for (auto node = range.begin(); node < range.end(); ++node)
@ -178,8 +179,7 @@ graphToEdges(const DynamicEdgeBasedGraph &edge_based_graph)
{ {
auto target = edge_based_graph.GetTarget(edge); auto target = edge_based_graph.GetTarget(edge);
BOOST_ASSERT(data.turn_id <= max_turn_id); BOOST_ASSERT(data.turn_id <= max_turn_id);
edges[data.turn_id] = edges[data.turn_id] = extractor::EdgeBasedEdge{node, target, data};
extractor::EdgeBasedEdge{node, target, data};
// only save the forward edge // only save the forward edge
edges[data.turn_id].data.forward = true; edges[data.turn_id].data.forward = true;
edges[data.turn_id].data.backward = false; edges[data.turn_id].data.backward = false;

View File

@ -110,9 +110,10 @@ struct BaseParametersGrammar : boost::spirit::qi::grammar<Iterator, Signature>
unlimited_rule = qi::lit("unlimited")[qi::_val = std::numeric_limits<double>::infinity()]; unlimited_rule = qi::lit("unlimited")[qi::_val = std::numeric_limits<double>::infinity()];
bearing_rule = bearing_rule =
(qi::short_ > ',' > (qi::short_ > ',' > qi::short_)[qi::_val = ph::bind(
qi::short_)[qi::_val = ph::bind([](short bearing, short range) [](short bearing, short range) {
{ return osrm::engine::Bearing{bearing, range}; }, return osrm::engine::Bearing{bearing, range};
},
qi::_1, qi::_1,
qi::_2)]; qi::_2)];

View File

@ -267,7 +267,9 @@ template <typename ElementT> class DeallocatingVector
++current_size; ++current_size;
} }
void reserve(const std::size_t) const { /* don't do anything */ } void reserve(const std::size_t) const
{ /* don't do anything */
}
void resize(const std::size_t new_size) void resize(const std::size_t new_size)
{ {

View File

@ -1183,8 +1183,9 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
first_turn_edges.first, first_turn_edges.first,
first_turn_edges.second, first_turn_edges.second,
std::back_inserter(node_sequences), std::back_inserter(node_sequences),
[](const auto turn_edges) [](const auto turn_edges) {
{ return std::vector<NodeID>{turn_edges.second.first, turn_edges.second.second}; }); return std::vector<NodeID>{turn_edges.second.first, turn_edges.second.second};
});
std::for_each(std::next(turns.begin()), std::for_each(std::next(turns.begin()),
turns.end(), turns.end(),