clang-format code

This commit is contained in:
Moritz Kobitzsch
2016-10-05 12:33:58 +02:00
parent 58316c608d
commit 73179641b1
24 changed files with 116 additions and 119 deletions
+24 -24
View File
@@ -104,12 +104,12 @@ EdgeWeight getNewWeight(IterType speed_iter,
{
auto speed_file = segment_speed_filenames.at(speed_iter->speed_source.source - 1);
util::SimpleLogger().Write(logWARNING)
<< "[weight updates] Edge weight update from " << old_secs << "s to " << new_secs << "s"
<< ". New speed: " << speed_iter->speed_source.speed << " kph"
<< "[weight updates] Edge weight update from " << old_secs << "s to " << new_secs
<< "s New speed: " << speed_iter->speed_source.speed << " kph"
<< ". Old speed: " << approx_original_speed << " kph"
<< ". Segment length: " << segment_length << " m"
<< ". Segment: " << speed_iter->segment.from << ","
<< speed_iter->segment.to << " based on " << speed_file;
<< ". Segment: " << speed_iter->segment.from << "," << speed_iter->segment.to
<< " based on " << speed_file;
}
}
@@ -593,12 +593,14 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
extractor::QueryNode *u;
extractor::QueryNode *v;
// forward_packed_geometry_id is the index id for geometry, weight and duration of the segments
// forward_packed_geometry_id is the index id for geometry, weight and duration of
// the segments
if (leaf_object.forward_packed_geometry_id != SPECIAL_EDGEID)
{
const unsigned forward_begin =
m_geometry_indices.at(leaf_object.forward_packed_geometry_id);
const auto current_fwd_segment = &(m_geometry_list[forward_begin + leaf_object.fwd_segment_position]);
const auto current_fwd_segment =
&(m_geometry_list[forward_begin + leaf_object.fwd_segment_position]);
if (leaf_object.fwd_segment_position == 0)
{
@@ -612,8 +614,7 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
[m_geometry_list[forward_begin +
leaf_object.fwd_segment_position - 1]
.node_id]);
v = &(internal_to_external_node_map
[current_fwd_segment->node_id]);
v = &(internal_to_external_node_map[current_fwd_segment->node_id]);
}
const double segment_length = util::coordinate_calculation::greatCircleDistance(
util::Coordinate{u->lon, u->lat}, util::Coordinate{v->lon, v->lat});
@@ -623,12 +624,11 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
if (forward_speed_iter != segment_speed_lookup.end())
{
const auto new_segment_weight = getNewWeight(
forward_speed_iter,
segment_length,
segment_speed_filenames,
current_fwd_segment->weight,
log_edge_updates_factor);
const auto new_segment_weight = getNewWeight(forward_speed_iter,
segment_length,
segment_speed_filenames,
current_fwd_segment->weight,
log_edge_updates_factor);
current_fwd_segment->weight = new_segment_weight;
m_geometry_datasource[forward_begin + leaf_object.fwd_segment_position] =
forward_speed_iter->speed_source.source;
@@ -642,7 +642,8 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
counters[LUA_SOURCE] += 1;
}
}
// reverse_packed_geometry_id is the index id for geometry, weight and duration of the segment
// reverse_packed_geometry_id is the index id for geometry, weight and duration of
// the segment
if (leaf_object.reverse_packed_geometry_id != SPECIAL_EDGEID)
{
const unsigned reverse_begin =
@@ -652,7 +653,8 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
int rev_segment_position =
(reverse_end - reverse_begin) - leaf_object.fwd_segment_position - 1;
const auto current_rev_segment = &(m_geometry_list[reverse_begin + rev_segment_position]);
const auto current_rev_segment =
&(m_geometry_list[reverse_begin + rev_segment_position]);
if (rev_segment_position == 0)
{
u = &(internal_to_external_node_map[leaf_object.v]);
@@ -665,8 +667,7 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
internal_to_external_node_map[m_geometry_list[reverse_begin +
rev_segment_position - 1]
.node_id]);
v = &(internal_to_external_node_map
[current_rev_segment->node_id]);
v = &(internal_to_external_node_map[current_rev_segment->node_id]);
}
const double segment_length = util::coordinate_calculation::greatCircleDistance(
util::Coordinate{u->lon, u->lat}, util::Coordinate{v->lon, v->lat});
@@ -675,12 +676,11 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
find(segment_speed_lookup, Segment{u->node_id, v->node_id});
if (reverse_speed_iter != segment_speed_lookup.end())
{
const auto new_segment_weight = getNewWeight(
reverse_speed_iter,
segment_length,
segment_speed_filenames,
current_rev_segment->weight,
log_edge_updates_factor);
const auto new_segment_weight = getNewWeight(reverse_speed_iter,
segment_length,
segment_speed_filenames,
current_rev_segment->weight,
log_edge_updates_factor);
current_rev_segment->weight = new_segment_weight;
m_geometry_datasource[reverse_begin + rev_segment_position] =
reverse_speed_iter->speed_source.source;
+7 -7
View File
@@ -84,11 +84,12 @@ namespace
// Abstracted away the query locking into a template function
// Works the same for every plugin.
template <typename ParameterT, typename PluginT, typename ResultT>
osrm::engine::Status RunQuery(const std::unique_ptr<osrm::engine::Engine::EngineLock> &lock,
const std::shared_ptr<osrm::engine::datafacade::BaseDataFacade> &facade,
const ParameterT &parameters,
PluginT &plugin,
ResultT &result)
osrm::engine::Status
RunQuery(const std::unique_ptr<osrm::engine::Engine::EngineLock> &lock,
const std::shared_ptr<osrm::engine::datafacade::BaseDataFacade> &facade,
const ParameterT &parameters,
PluginT &plugin,
ResultT &result)
{
if (!lock)
{
@@ -130,8 +131,7 @@ Engine::Engine(const EngineConfig &config)
{
throw util::exception("Invalid file paths given!");
}
query_data_facade =
std::make_shared<datafacade::InternalDataFacade>(config.storage_config);
query_data_facade = std::make_shared<datafacade::InternalDataFacade>(config.storage_config);
}
// Register plugins
+6 -2
View File
@@ -167,7 +167,10 @@ Status MatchPlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFaca
// call the actual map matching
SubMatchingList sub_matchings = map_matching(*facade,
candidates_lists, parameters.coordinates, parameters.timestamps, parameters.radiuses);
candidates_lists,
parameters.coordinates,
parameters.timestamps,
parameters.radiuses);
if (sub_matchings.size() == 0)
{
@@ -193,7 +196,8 @@ Status MatchPlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFaca
// force uturns to be on, since we split the phantom nodes anyway and only have
// bi-directional
// phantom nodes for possible uturns
shortest_path(*facade, sub_routes[index].segment_end_coordinates, {false}, sub_routes[index]);
shortest_path(
*facade, sub_routes[index].segment_end_coordinates, {false}, sub_routes[index]);
BOOST_ASSERT(sub_routes[index].shortest_path_length != INVALID_EDGE_WEIGHT);
}
+1 -4
View File
@@ -17,10 +17,7 @@ namespace engine
namespace plugins
{
NearestPlugin::NearestPlugin(const int max_results_)
: max_results{max_results_}
{
}
NearestPlugin::NearestPlugin(const int max_results_) : max_results{max_results_} {}
Status NearestPlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacade> facade,
const api::NearestParameters &params,
+3 -3
View File
@@ -24,8 +24,7 @@ namespace plugins
{
TablePlugin::TablePlugin(const int max_locations_distance_table)
: distance_table(heaps),
max_locations_distance_table(max_locations_distance_table)
: distance_table(heaps), max_locations_distance_table(max_locations_distance_table)
{
}
@@ -61,7 +60,8 @@ Status TablePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFaca
}
auto snapped_phantoms = SnapPhantomNodes(GetPhantomNodes(*facade, params));
auto result_table = distance_table(*facade, snapped_phantoms, params.sources, params.destinations);
auto result_table =
distance_table(*facade, snapped_phantoms, params.sources, params.destinations);
if (result_table.empty())
{
+25 -21
View File
@@ -1,6 +1,6 @@
#include "engine/plugins/tile.hpp"
#include "engine/edge_unpacker.hpp"
#include "engine/plugins/plugin_base.hpp"
#include "engine/plugins/tile.hpp"
#include "util/coordinate_calculation.hpp"
#include "util/vector_tile.hpp"
@@ -511,19 +511,23 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacad
// when exactly? Anyway, unpack it and get the first "real" edgedata
// out of it, which should represent the first hop, which is the one
// we want to find the turn.
const auto &data =
[this, &facade, smaller_edge_id, source_ebn, target_ebn, &unpacked_shortcut]() {
const auto inner_data = facade->GetEdgeData(smaller_edge_id);
if (inner_data.shortcut)
{
unpacked_shortcut.clear();
UnpackEdgeToEdges(
*facade, source_ebn.first, target_ebn, unpacked_shortcut);
return unpacked_shortcut.front();
}
else
return inner_data;
}();
const auto &data = [this,
&facade,
smaller_edge_id,
source_ebn,
target_ebn,
&unpacked_shortcut]() {
const auto inner_data = facade->GetEdgeData(smaller_edge_id);
if (inner_data.shortcut)
{
unpacked_shortcut.clear();
UnpackEdgeToEdges(
*facade, source_ebn.first, target_ebn, unpacked_shortcut);
return unpacked_shortcut.front();
}
else
return inner_data;
}();
BOOST_ASSERT_MSG(!data.shortcut, "Connecting edge must not be a shortcut");
// This is the geometry leading away from the intersection
@@ -535,7 +539,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacad
// Now, calculate the sum of the weight of all the segments.
forward_weight_vector.clear();
facade->GetUncompressedWeights(source_ebn.second.packed_geometry_id,
forward_weight_vector);
forward_weight_vector);
const auto sum_node_weight = std::accumulate(
forward_weight_vector.begin(), forward_weight_vector.end(), EdgeWeight{0});
@@ -620,7 +624,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacad
forward_datasource_vector.clear();
facade->GetUncompressedDatasources(edge.forward_packed_geometry_id,
forward_datasource_vector);
forward_datasource_vector);
forward_datasource = forward_datasource_vector[edge.fwd_segment_position];
use_line_value(forward_weight);
@@ -638,7 +642,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacad
reverse_datasource_vector.clear();
facade->GetUncompressedDatasources(edge.reverse_packed_geometry_id,
reverse_datasource_vector);
reverse_datasource_vector);
reverse_datasource = reverse_datasource_vector[reverse_datasource_vector.size() -
edge.fwd_segment_position - 1];
@@ -707,12 +711,12 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacad
{
forward_weight_vector.clear();
facade->GetUncompressedWeights(edge.forward_packed_geometry_id,
forward_weight_vector);
forward_weight_vector);
forward_weight = forward_weight_vector[edge.fwd_segment_position];
forward_datasource_vector.clear();
facade->GetUncompressedDatasources(edge.forward_packed_geometry_id,
forward_datasource_vector);
forward_datasource_vector);
forward_datasource = forward_datasource_vector[edge.fwd_segment_position];
}
@@ -720,7 +724,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacad
{
reverse_weight_vector.clear();
facade->GetUncompressedWeights(edge.reverse_packed_geometry_id,
reverse_weight_vector);
reverse_weight_vector);
BOOST_ASSERT(edge.fwd_segment_position < reverse_weight_vector.size());
@@ -729,7 +733,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataFacad
reverse_datasource_vector.clear();
facade->GetUncompressedDatasources(edge.reverse_packed_geometry_id,
reverse_datasource_vector);
reverse_datasource_vector);
reverse_datasource =
reverse_datasource_vector[reverse_datasource_vector.size() -
edge.fwd_segment_position - 1];
+1 -1
View File
@@ -114,7 +114,7 @@ SCC_Component SplitUnaccessibleLocations(const std::size_t number_of_locations,
return SCC_Component(std::move(components), std::move(range));
}
InternalRouteResult TripPlugin::ComputeRoute(const datafacade::BaseDataFacade& facade,
InternalRouteResult TripPlugin::ComputeRoute(const datafacade::BaseDataFacade &facade,
const std::vector<PhantomNode> &snapped_phantoms,
const std::vector<NodeID> &trip)
{
+3 -1
View File
@@ -98,7 +98,9 @@ Status ViaRoutePlugin::HandleRequest(const std::shared_ptr<datafacade::BaseDataF
else
{
shortest_path(*facade,
raw_route.segment_end_coordinates, route_parameters.continue_straight, raw_route);
raw_route.segment_end_coordinates,
route_parameters.continue_straight,
raw_route);
}
// we can only know this after the fact, different SCC ids still
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include <algorithm>
@@ -4,7 +4,6 @@
#include "util/coordinate_calculation.hpp"
#include "util/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp"
#include "util/simple_logger.hpp"
#include <algorithm>
+1 -1
View File
@@ -1,6 +1,6 @@
#include "extractor/guidance/sliproad_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/sliproad_handler.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp"
+1 -1
View File
@@ -1,7 +1,7 @@
#include "extractor/guidance/turn_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "extractor/guidance/turn_handler.hpp"
#include "util/guidance/toolkit.hpp"
+4 -2
View File
@@ -21,7 +21,8 @@ OSRM &OSRM::operator=(OSRM &&) noexcept = default;
// Forward to implementation
engine::Status OSRM::Route(const engine::api::RouteParameters &params, util::json::Object &result) const
engine::Status OSRM::Route(const engine::api::RouteParameters &params,
util::json::Object &result) const
{
return engine_->Route(params, result);
}
@@ -31,7 +32,8 @@ engine::Status OSRM::Table(const engine::api::TableParameters &params, json::Obj
return engine_->Table(params, result);
}
engine::Status OSRM::Nearest(const engine::api::NearestParameters &params, json::Object &result) const
engine::Status OSRM::Nearest(const engine::api::NearestParameters &params,
json::Object &result) const
{
return engine_->Nearest(params, result);
}
+2 -1
View File
@@ -56,7 +56,8 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
"edge-weight-updates-over-factor",
boost::program_options::value<double>(&contractor_config.log_edge_updates_factor)
->default_value(0.0),
"Use with `--segment-speed-file`. Provide an `x` factor, by which Extractor will log edge weights updated by more than this factor");
"Use with `--segment-speed-file`. Provide an `x` factor, by which Extractor will log edge "
"weights updated by more than this factor");
// hidden options, will be allowed on command line, but will not be shown to the user
boost::program_options::options_description hidden_options("Hidden options");