Code formatting

This commit is contained in:
Dennis Luxen 2024-05-19 14:03:44 +02:00
parent 73dd9140d1
commit a59ce85fd0
30 changed files with 93 additions and 114 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,8 +31,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "storage/storage_config.hpp"
#include "osrm/datasets.hpp"
#include <set>
#include <filesystem>
#include <set>
#include <string>
namespace osrm::engine

View File

@ -44,16 +44,15 @@ namespace osrm::engine
struct PhantomNode
{
PhantomNode()
: forward_segment_id{SPECIAL_SEGMENTID, false}, reverse_segment_id{SPECIAL_SEGMENTID,
false},
forward_weight(INVALID_EDGE_WEIGHT),
: forward_segment_id{SPECIAL_SEGMENTID, false},
reverse_segment_id{SPECIAL_SEGMENTID, false}, forward_weight(INVALID_EDGE_WEIGHT),
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_offset{0}, reverse_distance_offset{0},
forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION),
forward_duration_offset{0}, reverse_duration_offset{0},
component({INVALID_COMPONENTID, 0}),
fwd_segment_position(0), is_valid_forward_source{false}, is_valid_forward_target{false},
component({INVALID_COMPONENTID, 0}), 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)
{

View File

@ -70,7 +70,7 @@ class BasePlugin
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)
{

View File

@ -71,7 +71,7 @@ struct NodeBucket
{
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
{

View File

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

View File

@ -24,8 +24,8 @@ namespace osrm::extractor::files
// writes the .osrm.icd file
template <typename IntersectionBearingsT, typename EntryClassVectorT>
void writeIntersections(const std::filesystem::path &path,
const IntersectionBearingsT &intersection_bearings,
const EntryClassVectorT &entry_classes)
const IntersectionBearingsT &intersection_bearings,
const EntryClassVectorT &entry_classes)
{
static_assert(std::is_same<IntersectionBearingsContainer, IntersectionBearingsT>::value ||
std::is_same<IntersectionBearingsView, IntersectionBearingsT>::value,
@ -40,8 +40,8 @@ void writeIntersections(const std::filesystem::path &path,
// read the .osrm.icd file
template <typename IntersectionBearingsT, typename EntryClassVectorT>
void readIntersections(const std::filesystem::path &path,
IntersectionBearingsT &intersection_bearings,
EntryClassVectorT &entry_classes)
IntersectionBearingsT &intersection_bearings,
EntryClassVectorT &entry_classes)
{
static_assert(std::is_same<IntersectionBearingsContainer, IntersectionBearingsT>::value ||
std::is_same<IntersectionBearingsView, IntersectionBearingsT>::value,
@ -54,8 +54,7 @@ void readIntersections(const std::filesystem::path &path,
}
// reads .osrm.properties
inline void readProfileProperties(const std::filesystem::path &path,
ProfileProperties &properties)
inline void readProfileProperties(const std::filesystem::path &path, ProfileProperties &properties)
{
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
storage::tar::FileReader reader{path, fingerprint};
@ -109,8 +108,8 @@ void readEdgeBasedGraph(const std::filesystem::path &path,
// reads .osrm.nbg_nodes
template <typename CoordinatesT, typename PackedOSMIDsT>
void readNodes(const std::filesystem::path &path,
CoordinatesT &coordinates,
PackedOSMIDsT &osm_node_ids)
CoordinatesT &coordinates,
PackedOSMIDsT &osm_node_ids)
{
static_assert(std::is_same<typename CoordinatesT::value_type, util::Coordinate>::value, "");
static_assert(std::is_same<typename PackedOSMIDsT::value_type, OSMNodeID>::value, "");
@ -137,8 +136,8 @@ void readNodeCoordinates(const std::filesystem::path &path, CoordinatesT &coordi
// writes .osrm.nbg_nodes
template <typename CoordinatesT, typename PackedOSMIDsT>
void writeNodes(const std::filesystem::path &path,
const CoordinatesT &coordinates,
const PackedOSMIDsT &osm_node_ids)
const CoordinatesT &coordinates,
const PackedOSMIDsT &osm_node_ids)
{
static_assert(std::is_same<typename CoordinatesT::value_type, util::Coordinate>::value, "");
static_assert(std::is_same<typename PackedOSMIDsT::value_type, OSMNodeID>::value, "");
@ -160,8 +159,7 @@ inline void readNBGMapping(const std::filesystem::path &path, std::vector<NBGToE
}
// writes .osrm.cnbg_to_ebg
inline void writeNBGMapping(const std::filesystem::path &path,
const std::vector<NBGToEBG> &mapping)
inline void writeNBGMapping(const std::filesystem::path &path, const std::vector<NBGToEBG> &mapping)
{
const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint;
storage::tar::FileWriter writer{path, fingerprint};
@ -466,8 +464,7 @@ void readRawNBGraph(const std::filesystem::path &path,
storage::serialization::read(reader, "/extractor/edges", edge_list);
}
template <typename NameTableT>
void readNames(const std::filesystem::path &path, NameTableT &table)
template <typename NameTableT> void readNames(const std::filesystem::path &path, NameTableT &table)
{
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
storage::tar::FileReader reader{path, fingerprint};
@ -494,8 +491,7 @@ void readEdgeBasedNodeWeights(const std::filesystem::path &path, NodeWeightsVect
}
template <typename NodeDistancesVectorT>
void readEdgeBasedNodeDistances(const std::filesystem::path &path,
NodeDistancesVectorT &distances)
void readEdgeBasedNodeDistances(const std::filesystem::path &path, NodeDistancesVectorT &distances)
{
const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
storage::tar::FileReader reader{path, fingerprint};

View File

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

View File

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

View File

@ -164,29 +164,29 @@ graphToEdges(const DynamicEdgeBasedGraph &edge_based_graph)
[](const NodeID lhs, const NodeID rhs) { return std::max(lhs, rhs); });
std::vector<extractor::EdgeBasedEdge> edges(max_turn_id + 1);
tbb::parallel_for(
range,
[&](const auto range)
{
for (auto node = range.begin(); node < range.end(); ++node)
{
for (auto edge : edge_based_graph.GetAdjacentEdgeRange(node))
{
const auto &data = edge_based_graph.GetEdgeData(edge);
// we only need to save the forward edges, since the read method will
// convert from forward to bi-directional edges again
if (data.forward)
{
auto target = edge_based_graph.GetTarget(edge);
BOOST_ASSERT(data.turn_id <= max_turn_id);
edges[data.turn_id] = extractor::EdgeBasedEdge{node, target, data};
// only save the forward edge
edges[data.turn_id].data.forward = true;
edges[data.turn_id].data.backward = false;
}
}
}
});
tbb::parallel_for(range,
[&](const auto range)
{
for (auto node = range.begin(); node < range.end(); ++node)
{
for (auto edge : edge_based_graph.GetAdjacentEdgeRange(node))
{
const auto &data = edge_based_graph.GetEdgeData(edge);
// we only need to save the forward edges, since the read method
// will convert from forward to bi-directional edges again
if (data.forward)
{
auto target = edge_based_graph.GetTarget(edge);
BOOST_ASSERT(data.turn_id <= max_turn_id);
edges[data.turn_id] =
extractor::EdgeBasedEdge{node, target, data};
// only save the forward edge
edges[data.turn_id].data.forward = true;
edges[data.turn_id].data.backward = false;
}
}
}
});
return edges;
}

View File

@ -1,7 +1,6 @@
#ifndef OSRM_PARTITIONER_CONFIG_HPP
#define OSRM_PARTITIONER_CONFIG_HPP
#include <array>
#include <filesystem>
#include <string>

View File

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

View File

@ -28,7 +28,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef STORAGE_CONFIG_HPP
#define STORAGE_CONFIG_HPP
#include "storage/io_config.hpp"
#include "osrm/datasets.hpp"

View File

@ -267,9 +267,7 @@ template <typename ElementT> class DeallocatingVector
++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)
{

View File

@ -34,9 +34,8 @@ util::vector_view<T> mmapFile(const std::filesystem::path &file, MmapContainerT
}
template <typename T, typename MmapContainerT>
util::vector_view<T> mmapFile(const std::filesystem::path &file,
MmapContainerT &mmap_container,
const std::size_t size)
util::vector_view<T>
mmapFile(const std::filesystem::path &file, MmapContainerT &mmap_container, const std::size_t size)
{
try
{

View File

@ -11,11 +11,10 @@
#include "util/serialization.hpp"
#include "util/timing_util.hpp"
#include <iostream>
#include <fstream>
#include <iostream>
#include <random>
namespace osrm::benchmarks
{

View File

@ -4,13 +4,12 @@
#include <boost/assert.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <fstream>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <limits>
#include <string>
namespace osrm::extractor
{

View File

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

View File

@ -61,9 +61,8 @@ RecursiveBisection::RecursiveBisection(BisectionGraph &bisection_graph_,
std::transform(first,
last,
std::back_inserter(forest),
[this](auto graph) {
return TreeNode{std::move(graph), internal_state.SCCDepth()};
});
[this](auto graph)
{ return TreeNode{std::move(graph), internal_state.SCCDepth()}; });
using Feeder = tbb::feeder<TreeNode>;

View File

@ -27,8 +27,8 @@
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <cstdint>
#include <fstream>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <iterator>
#include <new>

View File

@ -7,8 +7,8 @@
#include <boost/program_options.hpp>
#include <iostream>
#include <filesystem>
#include <iostream>
#include <thread>
using namespace osrm;

View File

@ -3,7 +3,6 @@
#include "util/log.hpp"
#include "util/timing_util.hpp"
#include <cmath>
#include <cstdio>
#include <fcntl.h>
@ -13,9 +12,9 @@
#include <algorithm>
#include <chrono>
#include <iomanip>
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <random>
#include <vector>

View File

@ -11,9 +11,9 @@
#include <boost/program_options.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <filesystem>
#include <iostream>
#include <iterator>
#include <filesystem>
#include <regex>
#include <thread>

View File

@ -110,8 +110,8 @@ inline unsigned generateServerProgramOptions(const int argc,
int &requested_thread_num,
short &keepalive_timeout)
{
using std::filesystem::path;
using boost::program_options::value;
using std::filesystem::path;
const auto hardware_threads = std::max<int>(1, std::thread::hardware_concurrency());

View File

@ -8,17 +8,18 @@
inline std::string random_string(std::string::size_type length)
{
static auto& chrs = "0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static auto &chrs = "0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
thread_local static std::mt19937 rg{std::random_device{}()};
thread_local static std::uniform_int_distribution<std::string::size_type> pick(0, sizeof(chrs) - 2);
thread_local static std::uniform_int_distribution<std::string::size_type> pick(
0, sizeof(chrs) - 2);
std::string s;
s.reserve(length);
while(length--)
while (length--)
{
s += chrs[pick(rg)];
}

View File

@ -5,9 +5,9 @@
#include <boost/test/unit_test.hpp>
#include <filesystem>
#include <iomanip>
#include <iostream>
#include <filesystem>
#include <sstream>
#include <typeinfo>
#include <vector>