Run clang-format

This commit is contained in:
Patrick Niklaus
2016-01-08 01:31:57 +01:00
parent 6b18e4f7e9
commit 6991a38703
149 changed files with 457 additions and 498 deletions
+8 -10
View File
@@ -186,16 +186,14 @@ void CompressedEdgeContainer::PrintStatistics() const
longest_chain_length = std::max(longest_chain_length, (uint64_t)current_vector.size());
}
util::SimpleLogger().Write() << "Geometry successfully removed:"
"\n compressed edges: "
<< compressed_edges
<< "\n compressed geometries: " << compressed_geometries
<< "\n longest chain length: " << longest_chain_length
<< "\n cmpr ratio: " << ((float)compressed_edges /
std::max(compressed_geometries, (uint64_t)1))
<< "\n avg chain length: "
<< (float)compressed_geometries /
std::max((uint64_t)1, compressed_edges);
util::SimpleLogger().Write()
<< "Geometry successfully removed:"
"\n compressed edges: "
<< compressed_edges << "\n compressed geometries: " << compressed_geometries
<< "\n longest chain length: " << longest_chain_length << "\n cmpr ratio: "
<< ((float)compressed_edges / std::max(compressed_geometries, (uint64_t)1))
<< "\n avg chain length: "
<< (float)compressed_geometries / std::max((uint64_t)1, compressed_edges);
}
const CompressedEdgeContainer::EdgeBucket &
+20 -13
View File
@@ -37,7 +37,8 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(
{
}
void EdgeBasedGraphFactory::GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &output_edge_list)
void EdgeBasedGraphFactory::GetEdgeBasedEdges(
util::DeallocatingVector<EdgeBasedEdge> &output_edge_list)
{
BOOST_ASSERT_MSG(0 == output_edge_list.size(), "Vector is not empty");
using std::swap; // Koenig swap
@@ -321,7 +322,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes()
BOOST_ASSERT(m_edge_based_node_list.size() == m_edge_based_node_is_startpoint.size());
util::SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size()
<< " nodes in edge-expanded graph";
<< " nodes in edge-expanded graph";
}
/// Actually it also generates OriginalEdgeData and serializes them...
@@ -451,7 +452,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
{
distance += speed_profile.traffic_signal_penalty;
util::DEBUG_SIGNAL(node_v, m_node_info_list, speed_profile.traffic_signal_penalty);
util::DEBUG_SIGNAL(node_v, m_node_info_list,
speed_profile.traffic_signal_penalty);
}
// unpack last node of first segment if packed
@@ -478,7 +480,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
util::DEBUG_UTURN(node_v, m_node_info_list, speed_profile.u_turn_penalty);
}
util::DEBUG_TURN(node_v, m_node_info_list, first_coordinate, turn_angle, turn_penalty);
util::DEBUG_TURN(node_v, m_node_info_list, first_coordinate, turn_angle,
turn_penalty);
distance += turn_penalty;
@@ -546,8 +549,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
const QueryNode &from = m_node_info_list[previous];
const QueryNode &to = m_node_info_list[target_node.first];
const double segment_length =
util::coordinate_calculation::greatCircleDistance(from.lat, from.lon,
to.lat, to.lon);
util::coordinate_calculation::greatCircleDistance(
from.lat, from.lon, to.lat, to.lon);
edge_segment_file.write(reinterpret_cast<const char *>(&to.node_id),
sizeof(to.node_id));
@@ -564,8 +567,9 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
static const unsigned node_count = 2;
const QueryNode from = m_node_info_list[node_u];
const QueryNode to = m_node_info_list[node_v];
const double segment_length = util::coordinate_calculation::greatCircleDistance(
from.lat, from.lon, to.lat, to.lon);
const double segment_length =
util::coordinate_calculation::greatCircleDistance(from.lat, from.lon,
to.lat, to.lon);
edge_segment_file.write(reinterpret_cast<const char *>(&node_count),
sizeof(node_count));
edge_segment_file.write(reinterpret_cast<const char *>(&from.node_id),
@@ -591,15 +595,18 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
edge_data_file.write((char *)&original_edges_counter, sizeof(unsigned));
edge_data_file.close();
util::SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size() << " edge based nodes";
util::SimpleLogger().Write() << "Node-based graph contains " << node_based_edge_counter << " edges";
util::SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size()
<< " edge based nodes";
util::SimpleLogger().Write() << "Node-based graph contains " << node_based_edge_counter
<< " edges";
util::SimpleLogger().Write() << "Edge-expanded graph ...";
util::SimpleLogger().Write() << " contains " << m_edge_based_edge_list.size() << " edges";
util::SimpleLogger().Write() << " skips " << restricted_turns_counter << " turns, "
"defined by "
<< m_restriction_map->size() << " restrictions";
"defined by "
<< m_restriction_map->size() << " restrictions";
util::SimpleLogger().Write() << " skips " << skipped_uturns_counter << " U turns";
util::SimpleLogger().Write() << " skips " << skipped_barrier_turns_counter << " turns over barriers";
util::SimpleLogger().Write() << " skips " << skipped_barrier_turns_counter
<< " turns over barriers";
}
int EdgeBasedGraphFactory::GetTurnPenalty(double angle, lua_State *lua_state) const
+12 -9
View File
@@ -218,7 +218,7 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
if (edge_iterator->result.osm_source_id < node_iterator->node_id)
{
util::SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference "
<< edge_iterator->result.source;
<< edge_iterator->result.source;
edge_iterator->result.source = SPECIAL_NODEID;
++edge_iterator;
continue;
@@ -255,7 +255,7 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
auto markSourcesInvalid = [](InternalExtractorEdge &edge)
{
util::SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference "
<< edge.result.source;
<< edge.result.source;
edge.result.source = SPECIAL_NODEID;
edge.result.osm_source_id = SPECIAL_OSM_NODEID;
};
@@ -362,7 +362,7 @@ void ExtractionContainers::PrepareEdges(lua_State *segment_state)
auto markTargetsInvalid = [](InternalExtractorEdge &edge)
{
util::SimpleLogger().Write(LogLevel::logWARNING) << "Found invalid node reference "
<< edge.result.target;
<< edge.result.target;
edge.result.target = SPECIAL_NODEID;
};
std::for_each(edge_iterator, all_edges_list_end_, markTargetsInvalid);
@@ -614,8 +614,9 @@ void ExtractionContainers::PrepareRestrictions()
if (way_start_and_end_iterator->way_id >
OSMWayID(restrictions_iterator->restriction.from.way))
{
util::SimpleLogger().Write(LogLevel::logDEBUG) << "Restriction references invalid way: "
<< restrictions_iterator->restriction.from.way;
util::SimpleLogger().Write(LogLevel::logDEBUG)
<< "Restriction references invalid way: "
<< restrictions_iterator->restriction.from.way;
restrictions_iterator->restriction.from.node = SPECIAL_NODEID;
++restrictions_iterator;
continue;
@@ -630,8 +631,9 @@ void ExtractionContainers::PrepareRestrictions()
auto via_id_iter = external_to_internal_node_id_map.find(via_node_id);
if (via_id_iter == external_to_internal_node_id_map.end())
{
util::SimpleLogger().Write(LogLevel::logDEBUG) << "Restriction references invalid node: "
<< restrictions_iterator->restriction.via.node;
util::SimpleLogger().Write(LogLevel::logDEBUG)
<< "Restriction references invalid node: "
<< restrictions_iterator->restriction.via.node;
restrictions_iterator->restriction.via.node = SPECIAL_NODEID;
++restrictions_iterator;
continue;
@@ -691,8 +693,9 @@ void ExtractionContainers::PrepareRestrictions()
if (way_start_and_end_iterator->way_id >
OSMWayID(restrictions_iterator->restriction.to.way))
{
util::SimpleLogger().Write(LogLevel::logDEBUG) << "Restriction references invalid way: "
<< restrictions_iterator->restriction.to.way;
util::SimpleLogger().Write(LogLevel::logDEBUG)
<< "Restriction references invalid way: "
<< restrictions_iterator->restriction.to.way;
restrictions_iterator->restriction.to.way = SPECIAL_NODEID;
++restrictions_iterator;
continue;
+23 -20
View File
@@ -219,12 +219,13 @@ int extractor::run()
}
}
TIMER_STOP(parsing);
util::SimpleLogger().Write() << "Parsing finished after " << TIMER_SEC(parsing) << " seconds";
util::SimpleLogger().Write() << "Parsing finished after " << TIMER_SEC(parsing)
<< " seconds";
util::SimpleLogger().Write() << "Raw input contains " << number_of_nodes.load() << " nodes, "
<< number_of_ways.load() << " ways, and "
<< number_of_relations.load() << " relations, and "
<< number_of_others.load() << " unknown entities";
util::SimpleLogger().Write() << "Raw input contains " << number_of_nodes.load()
<< " nodes, " << number_of_ways.load() << " ways, and "
<< number_of_relations.load() << " relations, and "
<< number_of_others.load() << " unknown entities";
extractor_callbacks.reset();
@@ -238,7 +239,8 @@ int extractor::run()
config.names_file_name, segment_state);
TIMER_STOP(extracting);
util::SimpleLogger().Write() << "extraction finished after " << TIMER_SEC(extracting) << "s";
util::SimpleLogger().Write() << "extraction finished after " << TIMER_SEC(extracting)
<< "s";
}
catch (const std::exception &e)
{
@@ -287,12 +289,11 @@ int extractor::run()
WriteEdgeBasedGraph(config.edge_graph_output_path, max_edge_id, edge_based_edge_list);
util::SimpleLogger().Write() << "Expansion : "
<< (number_of_node_based_nodes / TIMER_SEC(expansion))
<< " nodes/sec and " << ((max_edge_id + 1) / TIMER_SEC(expansion))
<< " edges/sec";
util::SimpleLogger().Write()
<< "Expansion : " << (number_of_node_based_nodes / TIMER_SEC(expansion))
<< " nodes/sec and " << ((max_edge_id + 1) / TIMER_SEC(expansion)) << " edges/sec";
util::SimpleLogger().Write() << "To prepare the data for routing, run: "
<< "./osrm-prepare " << config.output_file_name << std::endl;
<< "./osrm-prepare " << config.output_file_name << std::endl;
}
catch (const std::exception &e)
{
@@ -332,7 +333,7 @@ void extractor::SetupScriptingEnvironment(lua_State *lua_state,
}
speed_profile.traffic_signal_penalty = 10 * lua_tointeger(lua_state, -1);
util::SimpleLogger().Write(logDEBUG) << "traffic_signal_penalty: "
<< speed_profile.traffic_signal_penalty;
<< speed_profile.traffic_signal_penalty;
if (0 != luaL_dostring(lua_state, "return u_turn_penalty\n"))
{
@@ -455,7 +456,7 @@ extractor::LoadNodeBasedGraph(std::unordered_set<NodeID> &barrier_nodes,
input_stream, barrier_list, traffic_light_list, internal_to_external_node_map);
util::SimpleLogger().Write() << " - " << barrier_list.size() << " bollard nodes, "
<< traffic_light_list.size() << " traffic lights";
<< traffic_light_list.size() << " traffic lights";
// insert into unordered sets for fast lookup
barrier_nodes.insert(barrier_list.begin(), barrier_list.end());
@@ -556,8 +557,8 @@ void extractor::BuildRTree(std::vector<EdgeBasedNode> node_based_edge_list,
const std::vector<QueryNode> &internal_to_external_node_map)
{
util::SimpleLogger().Write() << "constructing r-tree of " << node_based_edge_list.size()
<< " edge elements build on-top of "
<< internal_to_external_node_map.size() << " coordinates";
<< " edge elements build on-top of "
<< internal_to_external_node_map.size() << " coordinates";
BOOST_ASSERT(node_is_startpoint.size() == node_based_edge_list.size());
@@ -579,16 +580,18 @@ void extractor::BuildRTree(std::vector<EdgeBasedNode> node_based_edge_list,
TIMER_START(construction);
util::StaticRTree<EdgeBasedNode> rtree(node_based_edge_list, config.rtree_nodes_output_path,
config.rtree_leafs_output_path, internal_to_external_node_map);
config.rtree_leafs_output_path,
internal_to_external_node_map);
TIMER_STOP(construction);
util::SimpleLogger().Write() << "finished r-tree construction in " << TIMER_SEC(construction)
<< " seconds";
<< " seconds";
}
void extractor::WriteEdgeBasedGraph(std::string const &output_file_filename,
size_t const max_edge_id,
util::DeallocatingVector<EdgeBasedEdge> const &edge_based_edge_list)
void extractor::WriteEdgeBasedGraph(
std::string const &output_file_filename,
size_t const max_edge_id,
util::DeallocatingVector<EdgeBasedEdge> const &edge_based_edge_list)
{
std::ofstream file_out_stream;
+3 -2
View File
@@ -85,7 +85,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
if (std::numeric_limits<decltype(input_way.id())>::max() == input_way.id())
{
util::SimpleLogger().Write(logDEBUG) << "found bogus way with id: " << input_way.id()
<< " of size " << input_way.nodes().size();
<< " of size " << input_way.nodes().size();
return;
}
@@ -123,7 +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;
}
+1 -1
View File
@@ -108,7 +108,7 @@ ExtractorOptions::ParseArguments(int argc, char *argv[], ExtractorConfig &extrac
if (boost::filesystem::is_regular_file(extractor_config.config_file_path))
{
util::SimpleLogger().Write() << "Reading options from: "
<< extractor_config.config_file_path.string();
<< extractor_config.config_file_path.string();
std::string ini_file_contents =
util::read_file_lower_content(extractor_config.config_file_path);
std::stringstream config_stream(ini_file_contents);
+2 -2
View File
@@ -183,9 +183,9 @@ void GraphCompressor::PrintStatistics(unsigned original_number_of_nodes,
}
}
util::SimpleLogger().Write() << "Node compression ratio: "
<< new_node_count / (double)original_number_of_nodes;
<< new_node_count / (double)original_number_of_nodes;
util::SimpleLogger().Write() << "Edge compression ratio: "
<< new_edge_count / (double)original_number_of_edges;
<< new_edge_count / (double)original_number_of_edges;
}
}
}
+3 -2
View File
@@ -93,7 +93,7 @@ int SourceContainer::loadRasterSource(const std::string &path_string,
if (itr != LoadedSourcePaths.end())
{
util::SimpleLogger().Write() << "[source loader] Already loaded source '" << path_string
<< "' at source_id " << itr->second;
<< "' at source_id " << itr->second;
return itr->second;
}
@@ -115,7 +115,8 @@ int SourceContainer::loadRasterSource(const std::string &path_string,
LoadedSourcePaths.emplace(path_string, source_id);
LoadedSources.push_back(std::move(source));
util::SimpleLogger().Write() << "[source loader] ok, after " << TIMER_SEC(loading_source) << "s";
util::SimpleLogger().Write() << "[source loader] ok, after " << TIMER_SEC(loading_source)
<< "s";
return source_id;
}
+3 -2
View File
@@ -24,7 +24,8 @@ namespace osrm
namespace extractor
{
namespace {
namespace
{
int luaErrorCallback(lua_State *lua_state)
{
std::string error_msg = lua_tostring(lua_state, -1);
@@ -70,7 +71,7 @@ void RestrictionParser::ReadRestrictionExceptions(lua_State *lua_state)
boost::ref(restriction_exceptions));
const unsigned exception_count = restriction_exceptions.size();
util::SimpleLogger().Write() << "Found " << exception_count
<< " exceptions to turn restrictions:";
<< " exceptions to turn restrictions:";
for (const std::string &str : restriction_exceptions)
{
util::SimpleLogger().Write() << " " << str;