diff --git a/.travis.yml b/.travis.yml index e1b1339e4..5b2df215e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,8 +62,8 @@ matrix: - npm ci --ignore-scripts script: - ./scripts/check_taginfo.py taginfo.json profiles/car.lua - - ${MASON} install clang-format 3.8.1 - - PATH=$(${MASON} prefix clang-format 3.8.1)/bin:${PATH} ./scripts/format.sh && ./scripts/error_on_dirty.sh + - ${MASON} install clang-format 10.0.0 + - PATH=$(${MASON} prefix clang-format 10.0.0)/bin:${PATH} ./scripts/format.sh && ./scripts/error_on_dirty.sh - node ./scripts/validate_changelog.js # See issue 4043 #- npm run docs && ./scripts/error_on_dirty.sh diff --git a/include/contractor/contract_excludable_graph.hpp b/include/contractor/contract_excludable_graph.hpp index 6ae29282a..74ea8373b 100644 --- a/include/contractor/contract_excludable_graph.hpp +++ b/include/contractor/contract_excludable_graph.hpp @@ -94,7 +94,7 @@ inline auto contractExcludableGraph(ContractorGraph contractor_graph_, return GraphAndFilter{QueryGraph{num_nodes, std::move(edge_container.edges)}, edge_container.MakeEdgeFilters()}; } -} -} +} // namespace contractor +} // namespace osrm #endif diff --git a/include/contractor/contracted_edge_container.hpp b/include/contractor/contracted_edge_container.hpp index 8b37f5d4a..db3ae5cc9 100644 --- a/include/contractor/contracted_edge_container.hpp +++ b/include/contractor/contracted_edge_container.hpp @@ -164,7 +164,7 @@ struct ContractedEdgeContainer std::vector flags; std::vector edges; }; -} -} +} // namespace contractor +} // namespace osrm #endif diff --git a/include/contractor/contracted_metric.hpp b/include/contractor/contracted_metric.hpp index f44f49e83..c795a139a 100644 --- a/include/contractor/contracted_metric.hpp +++ b/include/contractor/contracted_metric.hpp @@ -15,11 +15,11 @@ template struct ContractedMetric detail::QueryGraph graph; std::vector> edge_filter; }; -} +} // namespace detail using ContractedMetric = detail::ContractedMetric; using ContractedMetricView = detail::ContractedMetric; -} -} +} // namespace contractor +} // namespace osrm #endif diff --git a/include/contractor/contractor.hpp b/include/contractor/contractor.hpp index ee1d2dd42..a0335d8ea 100644 --- a/include/contractor/contractor.hpp +++ b/include/contractor/contractor.hpp @@ -49,7 +49,7 @@ class Contractor private: ContractorConfig config; }; -} -} +} // namespace contractor +} // namespace osrm #endif // PROCESSING_CHAIN_HPP diff --git a/include/contractor/contractor_config.hpp b/include/contractor/contractor_config.hpp index 8f1455cce..c93d2e63d 100644 --- a/include/contractor/contractor_config.hpp +++ b/include/contractor/contractor_config.hpp @@ -73,7 +73,7 @@ struct ContractorConfig final : storage::IOConfig //(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%) double core_factor; }; -} -} +} // namespace contractor +} // namespace osrm #endif // EXTRACTOR_OPTIONS_HPP diff --git a/include/contractor/crc32_processor.hpp b/include/contractor/crc32_processor.hpp index 4130ed583..a441ae576 100644 --- a/include/contractor/crc32_processor.hpp +++ b/include/contractor/crc32_processor.hpp @@ -125,7 +125,7 @@ struct RangebasedCRC32 private: IteratorbasedCRC32 crc32; }; -} -} +} // namespace contractor +} // namespace osrm #endif /* ITERATOR_BASED_CRC32_H */ diff --git a/include/contractor/files.hpp b/include/contractor/files.hpp index 8dcade795..39ffa5b54 100644 --- a/include/contractor/files.hpp +++ b/include/contractor/files.hpp @@ -52,8 +52,8 @@ inline void writeGraph(const boost::filesystem::path &path, serialization::write(writer, "/ch/metrics/" + pair.first, pair.second); } } -} -} -} +} // namespace files +} // namespace contractor +} // namespace osrm #endif diff --git a/include/contractor/query_edge.hpp b/include/contractor/query_edge.hpp index 74d38e79e..351ecee24 100644 --- a/include/contractor/query_edge.hpp +++ b/include/contractor/query_edge.hpp @@ -77,7 +77,7 @@ struct QueryEdge data.distance == right.data.distance); } }; -} -} +} // namespace contractor +} // namespace osrm #endif // QUERYEDGE_HPP diff --git a/include/contractor/query_graph.hpp b/include/contractor/query_graph.hpp index e5758dcfe..b312a5403 100644 --- a/include/contractor/query_graph.hpp +++ b/include/contractor/query_graph.hpp @@ -19,7 +19,7 @@ using QueryGraph = util::StaticGraph; using QueryGraph = detail::QueryGraph; using QueryGraphView = detail::QueryGraph; -} -} +} // namespace contractor +} // namespace osrm #endif // QUERYEDGE_HPP diff --git a/include/contractor/serialization.hpp b/include/contractor/serialization.hpp index aa8659274..693216d6a 100644 --- a/include/contractor/serialization.hpp +++ b/include/contractor/serialization.hpp @@ -46,8 +46,8 @@ void read(storage::tar::FileReader &reader, metric.edge_filter[index]); } } -} -} -} +} // namespace serialization +} // namespace contractor +} // namespace osrm #endif diff --git a/include/customizer/cell_customizer.hpp b/include/customizer/cell_customizer.hpp index df5499579..9e27236d0 100644 --- a/include/customizer/cell_customizer.hpp +++ b/include/customizer/cell_customizer.hpp @@ -212,9 +212,8 @@ class CellCustomizer } const auto &data = graph.GetEdgeData(edge); - if (data.forward && - (first_level || - partition.GetCell(level - 1, node) != partition.GetCell(level - 1, to))) + if (data.forward && (first_level || partition.GetCell(level - 1, node) != + partition.GetCell(level - 1, to))) { const EdgeWeight to_weight = weight + data.weight; const EdgeDuration to_duration = duration + data.duration; @@ -237,7 +236,7 @@ class CellCustomizer const partitioner::MultiLevelPartition &partition; }; -} -} +} // namespace customizer +} // namespace osrm #endif // OSRM_CELLS_CUSTOMIZER_HPP diff --git a/include/customizer/cell_metric.hpp b/include/customizer/cell_metric.hpp index 7674174fe..a522facc3 100644 --- a/include/customizer/cell_metric.hpp +++ b/include/customizer/cell_metric.hpp @@ -22,11 +22,11 @@ template struct CellMetricImpl Vector durations; Vector distances; }; -} +} // namespace detail using CellMetric = detail::CellMetricImpl; using CellMetricView = detail::CellMetricImpl; -} -} +} // namespace customizer +} // namespace osrm #endif diff --git a/include/customizer/customizer_config.hpp b/include/customizer/customizer_config.hpp index 35ab1a356..4df629de5 100644 --- a/include/customizer/customizer_config.hpp +++ b/include/customizer/customizer_config.hpp @@ -39,7 +39,7 @@ struct CustomizationConfig final : storage::IOConfig updater::UpdaterConfig updater_config; }; -} -} +} // namespace customizer +} // namespace osrm #endif // OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP diff --git a/include/customizer/edge_based_graph.hpp b/include/customizer/edge_based_graph.hpp index 840a84299..5ef3277f9 100644 --- a/include/customizer/edge_based_graph.hpp +++ b/include/customizer/edge_based_graph.hpp @@ -34,7 +34,7 @@ template void write(storage::tar::FileWriter &writer, const std::string &name, const MultiLevelGraph &graph); -} +} // namespace serialization template class MultiLevelGraph : public partitioner::MultiLevelGraph @@ -126,7 +126,7 @@ using MultiLevelEdgeBasedGraph = MultiLevelGraph; using MultiLevelEdgeBasedGraphView = MultiLevelGraph; -} -} +} // namespace customizer +} // namespace osrm #endif diff --git a/include/customizer/files.hpp b/include/customizer/files.hpp index 364a2572d..335b77a30 100644 --- a/include/customizer/files.hpp +++ b/include/customizer/files.hpp @@ -106,8 +106,8 @@ inline void writeGraph(const boost::filesystem::path &path, writer.WriteFrom("/mld/connectivity_checksum", connectivity_checksum); serialization::write(writer, "/mld/multilevelgraph", graph); } -} -} -} +} // namespace files +} // namespace customizer +} // namespace osrm #endif diff --git a/include/customizer/serialization.hpp b/include/customizer/serialization.hpp index afe23cf9b..c242f8ba3 100644 --- a/include/customizer/serialization.hpp +++ b/include/customizer/serialization.hpp @@ -65,8 +65,8 @@ inline void write(storage::tar::FileWriter &writer, storage::serialization::write(writer, name + "/is_backward_edge", graph.is_backward_edge); storage::serialization::write(writer, name + "/node_to_edge_offset", graph.node_to_edge_offset); } -} -} -} +} // namespace serialization +} // namespace customizer +} // namespace osrm #endif diff --git a/include/engine/algorithm.hpp b/include/engine/algorithm.hpp index 760f78e80..1d65cac04 100644 --- a/include/engine/algorithm.hpp +++ b/include/engine/algorithm.hpp @@ -16,14 +16,14 @@ namespace ch struct Algorithm final { }; -} +} // namespace ch // Multi-Level Dijkstra namespace mld { struct Algorithm final { }; -} +} // namespace mld // Algorithm names template const char *name(); @@ -111,8 +111,8 @@ template <> struct HasGetTileTurns final : std::true_type template <> struct HasExcludeFlags final : std::true_type { }; -} -} -} +} // namespace routing_algorithms +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/base_api.hpp b/include/engine/api/base_api.hpp index 702a7f15f..6cd1a6e48 100644 --- a/include/engine/api/base_api.hpp +++ b/include/engine/api/base_api.hpp @@ -128,8 +128,8 @@ class BaseAPI const BaseParameters ¶meters; }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/base_parameters.hpp b/include/engine/api/base_parameters.hpp index e7a49378d..ad071faec 100644 --- a/include/engine/api/base_parameters.hpp +++ b/include/engine/api/base_parameters.hpp @@ -124,8 +124,8 @@ struct BaseParameters }); } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif // ROUTE_PARAMETERS_HPP diff --git a/include/engine/api/base_result.hpp b/include/engine/api/base_result.hpp index 65dd6aeeb..5dd63e7a9 100644 --- a/include/engine/api/base_result.hpp +++ b/include/engine/api/base_result.hpp @@ -16,8 +16,8 @@ namespace api { using ResultT = mapbox::util::variant; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/json_factory.hpp b/include/engine/api/json_factory.hpp index 0ec505703..f92dba16a 100644 --- a/include/engine/api/json_factory.hpp +++ b/include/engine/api/json_factory.hpp @@ -112,8 +112,8 @@ util::json::Object makeRouteLeg(guidance::RouteLeg leg, util::json::Array steps) util::json::Array makeRouteLegs(std::vector legs, std::vector step_geometries, std::vector annotations); -} -} +} // namespace json +} // namespace api } // namespace engine } // namespace osrm diff --git a/include/engine/api/match_api.hpp b/include/engine/api/match_api.hpp index e1639794e..a93e49710 100644 --- a/include/engine/api/match_api.hpp +++ b/include/engine/api/match_api.hpp @@ -248,8 +248,8 @@ class MatchAPI final : public RouteAPI const tidy::Result &tidy_result; }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/match_parameters.hpp b/include/engine/api/match_parameters.hpp index b54076582..73a660caf 100644 --- a/include/engine/api/match_parameters.hpp +++ b/include/engine/api/match_parameters.hpp @@ -79,8 +79,9 @@ struct MatchParameters : public RouteParameters bool tidy_, std::vector waypoints_, Args... args_) - : RouteParameters{std::forward(args_)..., waypoints_}, - timestamps{std::move(timestamps_)}, gaps(gaps_), tidy(tidy_) + : RouteParameters{std::forward(args_)..., waypoints_}, timestamps{std::move( + timestamps_)}, + gaps(gaps_), tidy(tidy_) { } @@ -94,8 +95,8 @@ struct MatchParameters : public RouteParameters (timestamps.empty() || timestamps.size() == coordinates.size()); } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/match_parameters_tidy.hpp b/include/engine/api/match_parameters_tidy.hpp index ab4610c4f..198740afa 100644 --- a/include/engine/api/match_parameters_tidy.hpp +++ b/include/engine/api/match_parameters_tidy.hpp @@ -200,9 +200,9 @@ inline Result tidy(const MatchParameters ¶ms, Thresholds cfg = {15., 5}) return result; } -} // ns tidy -} // ns api -} // ns engine -} // ns osrm +} // namespace tidy +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/nearest_api.hpp b/include/engine/api/nearest_api.hpp index 4cc01e41f..aff3c57dc 100644 --- a/include/engine/api/nearest_api.hpp +++ b/include/engine/api/nearest_api.hpp @@ -159,8 +159,8 @@ class NearestAPI final : public BaseAPI } }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/nearest_parameters.hpp b/include/engine/api/nearest_parameters.hpp index f24251b8c..576e75352 100644 --- a/include/engine/api/nearest_parameters.hpp +++ b/include/engine/api/nearest_parameters.hpp @@ -52,8 +52,8 @@ struct NearestParameters : public BaseParameters bool IsValid() const { return BaseParameters::IsValid() && number_of_results >= 1; } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif // ENGINE_API_NEAREST_PARAMETERS_HPP diff --git a/include/engine/api/route_api.hpp b/include/engine/api/route_api.hpp index 1c8283fae..4990d37c9 100644 --- a/include/engine/api/route_api.hpp +++ b/include/engine/api/route_api.hpp @@ -988,8 +988,8 @@ class RouteAPI : public BaseAPI } }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/route_parameters.hpp b/include/engine/api/route_parameters.hpp index ba200050d..afda6c859 100644 --- a/include/engine/api/route_parameters.hpp +++ b/include/engine/api/route_parameters.hpp @@ -90,16 +90,10 @@ struct RouteParameters : public BaseParameters Args... args_) // Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one // below. - : BaseParameters{std::forward(args_)...}, - steps{steps_}, - alternatives{alternatives_}, - number_of_alternatives{alternatives_ ? 1u : 0u}, - annotations{false}, - annotations_type{AnnotationsType::None}, - geometries{geometries_}, - overview{overview_}, - continue_straight{continue_straight_}, - waypoints() + : BaseParameters{std::forward(args_)...}, steps{steps_}, alternatives{alternatives_}, + number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{false}, + annotations_type{AnnotationsType::None}, geometries{geometries_}, overview{overview_}, + continue_straight{continue_straight_}, waypoints() { } @@ -151,8 +145,8 @@ struct RouteParameters : public BaseParameters : BaseParameters{std::forward(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{waypoints_} + geometries{geometries_}, overview{overview_}, + continue_straight{continue_straight_}, waypoints{waypoints_} { } @@ -217,8 +211,8 @@ inline RouteParameters::AnnotationsType operator|=(RouteParameters::AnnotationsT { return lhs = lhs | rhs; } -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/table_api.hpp b/include/engine/api/table_api.hpp index d3efe15d9..72cdea4e6 100644 --- a/include/engine/api/table_api.hpp +++ b/include/engine/api/table_api.hpp @@ -407,8 +407,8 @@ class TableAPI final : public BaseAPI const TableParameters ¶meters; }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/table_parameters.hpp b/include/engine/api/table_parameters.hpp index fbbf6831e..a18b6808f 100644 --- a/include/engine/api/table_parameters.hpp +++ b/include/engine/api/table_parameters.hpp @@ -166,8 +166,8 @@ inline TableParameters::AnnotationsType &operator|=(TableParameters::Annotations { return lhs = lhs | rhs; } -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif // ENGINE_API_TABLE_PARAMETERS_HPP diff --git a/include/engine/api/tile_parameters.hpp b/include/engine/api/tile_parameters.hpp index 137c4dac3..e5328e7c7 100644 --- a/include/engine/api/tile_parameters.hpp +++ b/include/engine/api/tile_parameters.hpp @@ -70,8 +70,8 @@ struct TileParameters final return valid_x && valid_y && valid_z; } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/trip_api.hpp b/include/engine/api/trip_api.hpp index 65f9381fc..90e5e1391 100644 --- a/include/engine/api/trip_api.hpp +++ b/include/engine/api/trip_api.hpp @@ -175,8 +175,8 @@ class TripAPI final : public RouteAPI const TripParameters ¶meters; }; -} // ns api -} // ns engine -} // ns osrm +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/api/trip_parameters.hpp b/include/engine/api/trip_parameters.hpp index 0df38d6c9..84d6b861a 100644 --- a/include/engine/api/trip_parameters.hpp +++ b/include/engine/api/trip_parameters.hpp @@ -65,8 +65,8 @@ struct TripParameters : public RouteParameters DestinationType destination_, bool roundtrip_, Args &&... args_) - : RouteParameters{std::forward(args_)...}, source{source_}, destination{destination_}, - roundtrip{roundtrip_} + : RouteParameters{std::forward(args_)...}, source{source_}, + destination{destination_}, roundtrip{roundtrip_} { } @@ -76,8 +76,8 @@ struct TripParameters : public RouteParameters bool IsValid() const { return RouteParameters::IsValid(); } }; -} -} -} +} // namespace api +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/approach.hpp b/include/engine/approach.hpp index 5c6787f27..f7d671a9c 100644 --- a/include/engine/approach.hpp +++ b/include/engine/approach.hpp @@ -42,5 +42,5 @@ enum class Approach : std::uint8_t }; } -} +} // namespace osrm #endif diff --git a/include/engine/base64.hpp b/include/engine/base64.hpp index 024d04b29..d1fa8753c 100644 --- a/include/engine/base64.hpp +++ b/include/engine/base64.hpp @@ -38,7 +38,7 @@ using BinaryFromBase64 = boost::archive::iterators::transform_width< 8, // get a view of 8 bit 6 // from a sequence of 6 bit >; -} // ns detail +} // namespace detail namespace engine { @@ -135,7 +135,7 @@ template T decodeBase64Bytewise(const std::string &encoded) return x; } -} // ns engine -} // ns osrm +} // namespace engine +} // namespace osrm #endif /* OSRM_BASE64_HPP */ diff --git a/include/engine/bearing.hpp b/include/engine/bearing.hpp index eaabae781..54e24f57f 100644 --- a/include/engine/bearing.hpp +++ b/include/engine/bearing.hpp @@ -46,7 +46,7 @@ inline bool operator==(const Bearing lhs, const Bearing rhs) return lhs.bearing == rhs.bearing && lhs.range == rhs.range; } inline bool operator!=(const Bearing lhs, const Bearing rhs) { return !(lhs == rhs); } -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/data_watchdog.hpp b/include/engine/data_watchdog.hpp index 416f1df76..29fb93443 100644 --- a/include/engine/data_watchdog.hpp +++ b/include/engine/data_watchdog.hpp @@ -142,14 +142,14 @@ class DataWatchdogImpl facade_factory; }; -} +} // namespace detail // This class monitors the shared memory region that contains the pointers to // the data and layout regions that should be used. This region is updated // once a new dataset arrives. template class FacadeT> using DataWatchdog = detail::DataWatchdogImpl>; -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/datafacade.hpp b/include/engine/datafacade.hpp index 76068a472..f0f8e9e5b 100644 --- a/include/engine/datafacade.hpp +++ b/include/engine/datafacade.hpp @@ -11,7 +11,7 @@ namespace engine using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase; template using DataFacade = datafacade::ContiguousInternalMemoryDataFacade; -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/datafacade/algorithm_datafacade.hpp b/include/engine/datafacade/algorithm_datafacade.hpp index a83a5340c..38030511c 100644 --- a/include/engine/datafacade/algorithm_datafacade.hpp +++ b/include/engine/datafacade/algorithm_datafacade.hpp @@ -99,8 +99,8 @@ template <> class AlgorithmDataFacade // searches for a specific edge virtual EdgeID FindEdge(const NodeID from, const NodeID to) const = 0; }; -} -} -} +} // namespace datafacade +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index 63d4dbc3a..988678331 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -609,7 +609,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade auto found_range = std::equal_range( m_maneuver_overrides.begin(), m_maneuver_overrides.end(), edge_based_node_id, Comp{}); - std::for_each(found_range.first, found_range.second, [&](const auto & override) { + std::for_each(found_range.first, found_range.second, [&](const auto &override) { std::vector sequence( m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_begin, m_maneuver_override_node_sequences.begin() + override.node_sequence_offset_end); @@ -760,8 +760,8 @@ class ContiguousInternalMemoryDataFacade final { } }; -} -} -} +} // namespace datafacade +} // namespace engine +} // namespace osrm #endif // CONTIGUOUS_INTERNALMEM_DATAFACADE_HPP diff --git a/include/engine/datafacade/datafacade_base.hpp b/include/engine/datafacade/datafacade_base.hpp index 77dab643f..b80c93b18 100644 --- a/include/engine/datafacade/datafacade_base.hpp +++ b/include/engine/datafacade/datafacade_base.hpp @@ -223,8 +223,8 @@ class BaseDataFacade virtual std::vector GetOverridesThatStartAt(const NodeID edge_based_node_id) const = 0; }; -} -} -} +} // namespace datafacade +} // namespace engine +} // namespace osrm #endif // DATAFACADE_BASE_HPP diff --git a/include/engine/datafacade_provider.hpp b/include/engine/datafacade_provider.hpp index 0f1441f6a..0ad6370f0 100644 --- a/include/engine/datafacade_provider.hpp +++ b/include/engine/datafacade_provider.hpp @@ -93,7 +93,7 @@ class WatchingProvider : public DataFacadeProvider return watchdog.Get(params); } }; -} +} // namespace detail template using DataFacadeProvider = detail::DataFacadeProvider; @@ -103,7 +103,7 @@ template using ImmutableProvider = detail::ImmutableProvider; template using ExternalProvider = detail::ExternalProvider; -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/douglas_peucker.hpp b/include/engine/douglas_peucker.hpp index 0f48378f7..1dced2617 100644 --- a/include/engine/douglas_peucker.hpp +++ b/include/engine/douglas_peucker.hpp @@ -57,7 +57,7 @@ const constexpr std::uint64_t DOUGLAS_PEUCKER_THRESHOLDS[19] = { const constexpr auto DOUGLAS_PEUCKER_THRESHOLDS_SIZE = sizeof(DOUGLAS_PEUCKER_THRESHOLDS) / sizeof(*DOUGLAS_PEUCKER_THRESHOLDS); -} // ns detail +} // namespace detail // These functions compute the bitvector of indicating generalized input // points according to the (Ramer-)Douglas-Peucker algorithm. @@ -75,7 +75,7 @@ inline std::vector douglasPeucker(const std::vector class Engine final : public EngineInterface const plugins::MatchPlugin match_plugin; const plugins::TilePlugin tile_plugin; }; -} -} +} // namespace engine +} // namespace osrm #endif // OSRM_IMPL_HPP diff --git a/include/engine/engine_config.hpp b/include/engine/engine_config.hpp index cc0cc4a93..ece74b3a5 100644 --- a/include/engine/engine_config.hpp +++ b/include/engine/engine_config.hpp @@ -94,7 +94,7 @@ struct EngineConfig final std::string verbosity; std::string dataset_name; }; -} -} +} // namespace engine +} // namespace osrm #endif // SERVER_CONFIG_HPP diff --git a/include/engine/geospatial_query.hpp b/include/engine/geospatial_query.hpp index b4a05b18d..cb7dc7d58 100644 --- a/include/engine/geospatial_query.hpp +++ b/include/engine/geospatial_query.hpp @@ -715,7 +715,7 @@ template class GeospatialQuery const CoordinateList &coordinates; DataFacadeT &datafacade; }; -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/guidance/assemble_geometry.hpp b/include/engine/guidance/assemble_geometry.hpp index eb4f9cf95..9e3a0deaf 100644 --- a/include/engine/guidance/assemble_geometry.hpp +++ b/include/engine/guidance/assemble_geometry.hpp @@ -167,8 +167,8 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade, return geometry; } -} -} -} +} // namespace guidance +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/guidance/assemble_leg.hpp b/include/engine/guidance/assemble_leg.hpp index 5bd2cca0e..0a49ae81e 100644 --- a/include/engine/guidance/assemble_leg.hpp +++ b/include/engine/guidance/assemble_leg.hpp @@ -122,7 +122,7 @@ std::array summarizeRoute(const datafacade::BaseDa [](const NamedSegment &segment) { return segment.name_id; }); return summary; } -} +} // namespace detail inline RouteLeg assembleLeg(const datafacade::BaseDataFacade &facade, const std::vector &route_data, diff --git a/include/engine/guidance/assemble_steps.hpp b/include/engine/guidance/assemble_steps.hpp index 75344c063..ac65a539f 100644 --- a/include/engine/guidance/assemble_steps.hpp +++ b/include/engine/guidance/assemble_steps.hpp @@ -35,7 +35,7 @@ std::pair getDepartBearings(const LegGeometry &leg_geometry, std::pair getArriveBearings(const LegGeometry &leg_geometry, const PhantomNode &target_node, const bool traversed_in_reverse); -} // ns detail +} // namespace detail inline std::vector assembleSteps(const datafacade::BaseDataFacade &facade, const std::vector &leg_data, diff --git a/include/engine/guidance/collapse_turns.hpp b/include/engine/guidance/collapse_turns.hpp index b8b5d3198..d2db4a420 100644 --- a/include/engine/guidance/collapse_turns.hpp +++ b/include/engine/guidance/collapse_turns.hpp @@ -163,7 +163,7 @@ void combineRouteSteps(RouteStep &step_at_turn_location, void suppressStep(RouteStep &step_at_turn_location, RouteStep &step_after_turn_location); } /* namespace guidance */ -} /* namespace osrm */ +} // namespace engine } /* namespace osrm */ #endif /* OSRM_ENGINE_GUIDANCE_COLLAPSE_HPP_ */ diff --git a/include/engine/guidance/leg_geometry.hpp b/include/engine/guidance/leg_geometry.hpp index a1ba56c81..8374bb992 100644 --- a/include/engine/guidance/leg_geometry.hpp +++ b/include/engine/guidance/leg_geometry.hpp @@ -64,8 +64,8 @@ struct LegGeometry return segment_offsets.size() - 1; } }; -} -} -} +} // namespace guidance +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/guidance/route.hpp b/include/engine/guidance/route.hpp index 461da4cc7..fa750d4da 100644 --- a/include/engine/guidance/route.hpp +++ b/include/engine/guidance/route.hpp @@ -14,8 +14,8 @@ struct Route double duration; double weight; }; -} -} -} +} // namespace guidance +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/guidance/route_leg.hpp b/include/engine/guidance/route_leg.hpp index c9f4e2ab5..443c2ae23 100644 --- a/include/engine/guidance/route_leg.hpp +++ b/include/engine/guidance/route_leg.hpp @@ -23,8 +23,8 @@ struct RouteLeg std::string summary; std::vector steps; }; -} -} -} +} // namespace guidance +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/guidance/step_maneuver.hpp b/include/engine/guidance/step_maneuver.hpp index 6d5dcede7..efe0726ca 100644 --- a/include/engine/guidance/step_maneuver.hpp +++ b/include/engine/guidance/step_maneuver.hpp @@ -46,5 +46,5 @@ inline StepManeuver getInvalidStepManeuver() } // namespace guidance } // namespace engine -} // namespace osrmn +} // namespace osrm #endif diff --git a/include/engine/hint.hpp b/include/engine/hint.hpp index 3ab69b928..50e7cdb16 100644 --- a/include/engine/hint.hpp +++ b/include/engine/hint.hpp @@ -67,7 +67,7 @@ static_assert(sizeof(Hint) == 80 + 4, "Hint is bigger than expected"); constexpr std::size_t ENCODED_HINT_SIZE = 112; static_assert(ENCODED_HINT_SIZE / 4 * 3 >= sizeof(Hint), "ENCODED_HINT_SIZE does not match size of Hint"); -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/internal_route_result.hpp b/include/engine/internal_route_result.hpp index bd4798f5b..9f5443ffa 100644 --- a/include/engine/internal_route_result.hpp +++ b/include/engine/internal_route_result.hpp @@ -173,7 +173,7 @@ inline InternalRouteResult CollapseInternalRouteResult(const InternalRouteResult collapsed.unpacked_path_segments.size()); return collapsed; } -} -} +} // namespace engine +} // namespace osrm #endif // RAW_ROUTE_DATA_H diff --git a/include/engine/map_matching/bayes_classifier.hpp b/include/engine/map_matching/bayes_classifier.hpp index 70e2cfd30..c93277f64 100644 --- a/include/engine/map_matching/bayes_classifier.hpp +++ b/include/engine/map_matching/bayes_classifier.hpp @@ -98,8 +98,8 @@ class BayesClassifier double positive_apriori_probability; double negative_apriori_probability; }; -} -} -} +} // namespace map_matching +} // namespace engine +} // namespace osrm #endif // BAYES_CLASSIFIER_HPP diff --git a/include/engine/map_matching/hidden_markov_model.hpp b/include/engine/map_matching/hidden_markov_model.hpp index 8f1e4d1ff..30bb8254b 100644 --- a/include/engine/map_matching/hidden_markov_model.hpp +++ b/include/engine/map_matching/hidden_markov_model.hpp @@ -137,8 +137,8 @@ template struct HiddenMarkovModel return initial_timestamp; } }; -} -} -} +} // namespace map_matching +} // namespace engine +} // namespace osrm #endif // HIDDEN_MARKOV_MODEL diff --git a/include/engine/map_matching/matching_confidence.hpp b/include/engine/map_matching/matching_confidence.hpp index 03613b048..2ae8728d6 100644 --- a/include/engine/map_matching/matching_confidence.hpp +++ b/include/engine/map_matching/matching_confidence.hpp @@ -51,8 +51,8 @@ struct MatchingConfidence private: ClassifierT classifier; }; -} -} -} +} // namespace map_matching +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/map_matching/sub_matching.hpp b/include/engine/map_matching/sub_matching.hpp index e272423e7..544978d61 100644 --- a/include/engine/map_matching/sub_matching.hpp +++ b/include/engine/map_matching/sub_matching.hpp @@ -19,8 +19,8 @@ struct SubMatching std::vector alternatives_count; double confidence; }; -} -} -} +} // namespace map_matching +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/phantom_node.hpp b/include/engine/phantom_node.hpp index 3cb0b9593..d535283d3 100644 --- a/include/engine/phantom_node.hpp +++ b/include/engine/phantom_node.hpp @@ -44,14 +44,15 @@ namespace engine struct PhantomNode { PhantomNode() - : 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_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), fwd_segment_position(0), - is_valid_forward_source{false}, is_valid_forward_target{false}, + forward_duration_offset(0), reverse_duration_offset(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) { @@ -109,8 +110,9 @@ struct PhantomNode bool IsValid(const unsigned number_of_nodes) const { - return location.IsValid() && ((forward_segment_id.id < number_of_nodes) || - (reverse_segment_id.id < number_of_nodes)) && + return location.IsValid() && + ((forward_segment_id.id < number_of_nodes) || + (reverse_segment_id.id < number_of_nodes)) && ((forward_weight != INVALID_EDGE_WEIGHT) || (reverse_weight != INVALID_EDGE_WEIGHT)) && ((forward_duration != MAXIMAL_EDGE_DURATION) || @@ -234,7 +236,7 @@ struct PhantomNodes PhantomNode source_phantom; PhantomNode target_phantom; }; -} -} +} // namespace engine +} // namespace osrm #endif // PHANTOM_NODES_H diff --git a/include/engine/plugins/match.hpp b/include/engine/plugins/match.hpp index 3717aa718..5b2bdca30 100644 --- a/include/engine/plugins/match.hpp +++ b/include/engine/plugins/match.hpp @@ -38,8 +38,8 @@ class MatchPlugin : public BasePlugin const int max_locations_map_matching; const double max_radius_map_matching; }; -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm #endif // MATCH_HPP diff --git a/include/engine/plugins/nearest.hpp b/include/engine/plugins/nearest.hpp index d696c46b0..4582de348 100644 --- a/include/engine/plugins/nearest.hpp +++ b/include/engine/plugins/nearest.hpp @@ -26,8 +26,8 @@ class NearestPlugin final : public BasePlugin private: const int max_results; }; -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm #endif /* NEAREST_HPP */ diff --git a/include/engine/plugins/plugin_base.hpp b/include/engine/plugins/plugin_base.hpp index 6fc23adcd..ef6641621 100644 --- a/include/engine/plugins/plugin_base.hpp +++ b/include/engine/plugins/plugin_base.hpp @@ -131,8 +131,10 @@ class BasePlugin return phantom_pair.first; }; - const auto use_closed_phantom = []( - const std::pair &phantom_pair) { return phantom_pair.first; }; + const auto use_closed_phantom = + [](const std::pair &phantom_pair) { + return phantom_pair.first; + }; const bool every_phantom_is_in_tiny_cc = std::all_of(std::begin(phantom_node_pair_list), std::end(phantom_node_pair_list), @@ -388,8 +390,8 @@ class BasePlugin std::to_string(missing_index); } }; -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm #endif /* BASE_PLUGIN_HPP */ diff --git a/include/engine/plugins/table.hpp b/include/engine/plugins/table.hpp index 1cd7da6e9..d8e5a32e9 100644 --- a/include/engine/plugins/table.hpp +++ b/include/engine/plugins/table.hpp @@ -27,8 +27,8 @@ class TablePlugin final : public BasePlugin private: const int max_locations_distance_table; }; -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm #endif // TABLE_HPP diff --git a/include/engine/plugins/tile.hpp b/include/engine/plugins/tile.hpp index 90d598d78..5d4bdb5b0 100644 --- a/include/engine/plugins/tile.hpp +++ b/include/engine/plugins/tile.hpp @@ -30,8 +30,8 @@ class TilePlugin final : public BasePlugin const api::TileParameters ¶meters, osrm::engine::api::ResultT &pbf_buffer) const; }; -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm #endif /* TILEPLUGIN_HPP */ diff --git a/include/engine/plugins/trip.hpp b/include/engine/plugins/trip.hpp index ee45729f8..2cf9da4de 100644 --- a/include/engine/plugins/trip.hpp +++ b/include/engine/plugins/trip.hpp @@ -42,8 +42,8 @@ class TripPlugin final : public BasePlugin const api::TripParameters ¶meters, osrm::engine::api::ResultT &json_result) const; }; -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm #endif // TRIP_HPP diff --git a/include/engine/plugins/viaroute.hpp b/include/engine/plugins/viaroute.hpp index 70642d6d1..719749472 100644 --- a/include/engine/plugins/viaroute.hpp +++ b/include/engine/plugins/viaroute.hpp @@ -35,8 +35,8 @@ class ViaRoutePlugin final : public BasePlugin const api::RouteParameters &route_parameters, osrm::engine::api::ResultT &json_result) const; }; -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm #endif // VIA_ROUTE_HPP diff --git a/include/engine/polyline_compressor.hpp b/include/engine/polyline_compressor.hpp index fb64b9de9..224f1ed3b 100644 --- a/include/engine/polyline_compressor.hpp +++ b/include/engine/polyline_compressor.hpp @@ -17,7 +17,7 @@ namespace detail std::string encode(std::vector &numbers); std::int32_t decode_polyline_integer(std::string::const_iterator &first, std::string::const_iterator last); -} +} // namespace detail using CoordVectorForwardIter = std::vector::const_iterator; // Encodes geometry into polyline format. // See: https://developers.google.com/maps/documentation/utilities/polylinealgorithm @@ -80,7 +80,7 @@ std::vector decodePolyline(const std::string &polyline) } return coordinates; } -} -} +} // namespace engine +} // namespace osrm #endif /* POLYLINECOMPRESSOR_H_ */ diff --git a/include/engine/routing_algorithms.hpp b/include/engine/routing_algorithms.hpp index 5d4a8a956..8bedcb8d8 100644 --- a/include/engine/routing_algorithms.hpp +++ b/include/engine/routing_algorithms.hpp @@ -230,7 +230,7 @@ inline std::vector RoutingAlgorithms::G return routing_algorithms::getTileTurns(*facade, edges, sorted_edge_indexes); } -} // ns engine -} // ns osrm +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/routing_algorithms/routing_base_mld.hpp b/include/engine/routing_algorithms/routing_base_mld.hpp index c3462039c..17c5b0931 100644 --- a/include/engine/routing_algorithms/routing_base_mld.hpp +++ b/include/engine/routing_algorithms/routing_base_mld.hpp @@ -97,7 +97,6 @@ inline LevelID getNodeQueryLevel(const MultiLevelPartition &partition, const std::vector &phantom_indices) { auto min_level = [&partition, node](const PhantomNode &phantom_node) { - const auto &forward_segment = phantom_node.forward_segment_id; const auto forward_level = forward_segment.enabled ? partition.GetHighestDifferentLevel(node, forward_segment.id) @@ -120,7 +119,7 @@ inline LevelID getNodeQueryLevel(const MultiLevelPartition &partition, } return result; } -} +} // namespace // Heaps only record for each node its predecessor ("parent") on the shortest path. // For re-constructing the actual path we need to trace back all parent "pointers". diff --git a/include/engine/routing_algorithms/shortest_path_impl.hpp b/include/engine/routing_algorithms/shortest_path_impl.hpp index 0dea19897..05a817a1e 100644 --- a/include/engine/routing_algorithms/shortest_path_impl.hpp +++ b/include/engine/routing_algorithms/shortest_path_impl.hpp @@ -226,7 +226,7 @@ inline void initializeHeap(SearchEngineData &eng const auto border_nodes_number = facade.GetMaxBorderNodeID() + 1; engine_working_data.InitializeOrClearFirstThreadLocalStorage(nodes_number, border_nodes_number); } -} +} // namespace template InternalRouteResult shortestPathSearch(SearchEngineData &engine_working_data, diff --git a/include/engine/search_engine_data.hpp b/include/engine/search_engine_data.hpp index 353076162..4dafdd1a2 100644 --- a/include/engine/search_engine_data.hpp +++ b/include/engine/search_engine_data.hpp @@ -120,7 +120,7 @@ template <> struct SearchEngineData void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes, unsigned number_of_boundary_nodes); }; -} -} +} // namespace engine +} // namespace osrm #endif // SEARCH_ENGINE_DATA_HPP diff --git a/include/engine/status.hpp b/include/engine/status.hpp index c2c31cdfb..7b08db1d6 100644 --- a/include/engine/status.hpp +++ b/include/engine/status.hpp @@ -42,7 +42,7 @@ enum class Status Ok, Error }; -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/include/engine/trip/trip_nearest_neighbour.hpp b/include/engine/trip/trip_nearest_neighbour.hpp index 6243c8711..29aca8e72 100644 --- a/include/engine/trip/trip_nearest_neighbour.hpp +++ b/include/engine/trip/trip_nearest_neighbour.hpp @@ -92,8 +92,8 @@ std::vector NearestNeighbourTrip(const NodeIDIterator &start, } return route; } -} -} -} +} // namespace trip +} // namespace engine +} // namespace osrm #endif // TRIP_NEAREST_NEIGHBOUR_HPP diff --git a/include/extractor/class_data.hpp b/include/extractor/class_data.hpp index 11b07ffcd..5e5cf3087 100644 --- a/include/extractor/class_data.hpp +++ b/include/extractor/class_data.hpp @@ -33,7 +33,7 @@ inline bool isValidClassName(const std::string &name) return std::isalnum(c); }) == name.end(); } -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/compressed_edge_container.hpp b/include/extractor/compressed_edge_container.hpp index 5b570e724..ec9e1f9ea 100644 --- a/include/extractor/compressed_edge_container.hpp +++ b/include/extractor/compressed_edge_container.hpp @@ -82,7 +82,7 @@ class CompressedEdgeContainer std::unordered_map m_reverse_edge_id_to_zipped_index_map; std::unique_ptr segment_data; }; -} -} +} // namespace extractor +} // namespace osrm #endif // GEOMETRY_COMPRESSOR_HPP_ diff --git a/include/extractor/compressed_node_based_graph_edge.hpp b/include/extractor/compressed_node_based_graph_edge.hpp index 06c01d538..279be7c1c 100644 --- a/include/extractor/compressed_node_based_graph_edge.hpp +++ b/include/extractor/compressed_node_based_graph_edge.hpp @@ -14,7 +14,7 @@ struct CompressedNodeBasedGraphEdge NodeID source; NodeID target; }; -} -} +} // namespace extractor +} // namespace osrm #endif // OSRM_EXTRACTOR_COMPRESSED_NODE_BASED_GRAPH_EDGE_HPP diff --git a/include/extractor/datasources.hpp b/include/extractor/datasources.hpp index 03af4deea..a4f872656 100644 --- a/include/extractor/datasources.hpp +++ b/include/extractor/datasources.hpp @@ -42,7 +42,7 @@ class Datasources std::array lengths; std::array sources; }; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/edge_based_edge.hpp b/include/extractor/edge_based_edge.hpp index 28ebf934a..6c9aaa974 100644 --- a/include/extractor/edge_based_edge.hpp +++ b/include/extractor/edge_based_edge.hpp @@ -96,7 +96,7 @@ inline bool EdgeBasedEdge::operator<(const EdgeBasedEdge &other) const return std::tie(source, target, data.weight, unidirectional) < std::tie(other.source, other.target, other.data.weight, other_is_unidirectional); } -} // ns extractor -} // ns osrm +} // namespace extractor +} // namespace osrm #endif /* EDGE_BASED_EDGE_HPP */ diff --git a/include/extractor/edge_based_graph_factory.hpp b/include/extractor/edge_based_graph_factory.hpp index b99ec2c2c..9736cebf6 100644 --- a/include/extractor/edge_based_graph_factory.hpp +++ b/include/extractor/edge_based_graph_factory.hpp @@ -54,7 +54,7 @@ struct TurnIndexBlock #pragma pack(pop) static_assert(std::is_trivial::value, "TurnIndexBlock is not trivial"); static_assert(sizeof(TurnIndexBlock) == 12, "TurnIndexBlock is not packed correctly"); -} // ns lookup +} // namespace lookup struct NodeBasedGraphToEdgeBasedGraphMappingWriter; // fwd. decl diff --git a/include/extractor/edge_based_node_segment.hpp b/include/extractor/edge_based_node_segment.hpp index b85131e02..ff2198803 100644 --- a/include/extractor/edge_based_node_segment.hpp +++ b/include/extractor/edge_based_node_segment.hpp @@ -20,8 +20,9 @@ namespace 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::max() >> 1), // >> 1 because we've only got 15 bits is_startpoint(false) @@ -47,7 +48,7 @@ struct EdgeBasedNodeSegment unsigned short fwd_segment_position : 15; // segment id in a compressed geometry bool is_startpoint : 1; }; -} -} +} // namespace extractor +} // namespace osrm #endif // OSRM_EXTRACT_EDGE_BASED_NODE_SEGMENT_HPP diff --git a/include/extractor/extraction_containers.hpp b/include/extractor/extraction_containers.hpp index 184db7739..13f949c94 100644 --- a/include/extractor/extraction_containers.hpp +++ b/include/extractor/extraction_containers.hpp @@ -73,7 +73,7 @@ class ExtractionContainers const std::string &osrm_path, const std::string &names_data_path); }; -} -} +} // namespace extractor +} // namespace osrm #endif /* EXTRACTION_CONTAINERS_HPP */ diff --git a/include/extractor/extraction_helper_functions.hpp b/include/extractor/extraction_helper_functions.hpp index 5fb790c9b..d9e0f9b44 100644 --- a/include/extractor/extraction_helper_functions.hpp +++ b/include/extractor/extraction_helper_functions.hpp @@ -82,7 +82,7 @@ template struct iso_8601_grammar : qi::grammar uint_p; qi::uint_parser uint2_p; }; -} +} // namespace detail inline bool durationIsValid(const std::string &s) { @@ -136,7 +136,7 @@ inline std::string canonicalizeStringList(std::string strlist, const std::string return strlist; } -} // extractor -} // osrm +} // namespace extractor +} // namespace osrm #endif // EXTRACTION_HELPER_FUNCTIONS_HPP diff --git a/include/extractor/extraction_node.hpp b/include/extractor/extraction_node.hpp index e82f298ba..065ff4a3f 100644 --- a/include/extractor/extraction_node.hpp +++ b/include/extractor/extraction_node.hpp @@ -13,7 +13,7 @@ struct ExtractionNode bool traffic_lights; bool barrier; }; -} -} +} // namespace extractor +} // namespace osrm #endif // EXTRACTION_NODE_HPP diff --git a/include/extractor/extraction_segment.hpp b/include/extractor/extraction_segment.hpp index 6e3f3b5d5..4330e5c99 100644 --- a/include/extractor/extraction_segment.hpp +++ b/include/extractor/extraction_segment.hpp @@ -26,7 +26,7 @@ struct ExtractionSegment double weight; double duration; }; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/extraction_way.hpp b/include/extractor/extraction_way.hpp index e5f8693ba..674555c81 100644 --- a/include/extractor/extraction_way.hpp +++ b/include/extractor/extraction_way.hpp @@ -26,7 +26,7 @@ inline void maybeSetString(std::string &str, const char *value) str = std::string(value); } } -} +} // namespace detail /** * This struct is the direct result of the call to ```way_function``` @@ -130,7 +130,7 @@ struct ExtractionWay std::uint8_t highway_turn_classification : 4; std::uint8_t access_turn_classification : 4; }; -} -} +} // namespace extractor +} // namespace osrm #endif // EXTRACTION_WAY_HPP diff --git a/include/extractor/extractor.hpp b/include/extractor/extractor.hpp index 29dec218b..2e333b7cc 100644 --- a/include/extractor/extractor.hpp +++ b/include/extractor/extractor.hpp @@ -115,7 +115,7 @@ class Extractor LaneDescriptionMap lane_description_map, ScriptingEnvironment &scripting_environment); }; -} -} +} // namespace extractor +} // namespace osrm #endif /* EXTRACTOR_HPP */ diff --git a/include/extractor/extractor_callbacks.hpp b/include/extractor/extractor_callbacks.hpp index 865f1e2ad..6d8080d23 100644 --- a/include/extractor/extractor_callbacks.hpp +++ b/include/extractor/extractor_callbacks.hpp @@ -16,15 +16,15 @@ namespace osmium class Node; class Way; class Relation; -} +} // namespace osmium namespace std { template <> struct hash> { std::size_t operator()( - const std::tuple &mk) const - noexcept + const std::tuple &mk) + const noexcept { std::size_t seed = 0; boost::hash_combine(seed, std::get<0>(mk)); @@ -35,7 +35,7 @@ template <> struct hash::IntersectionPrinter( } template -util::json::Array IntersectionPrinter:: -operator()(const NodeID intersection_node, - const IntersectionType &intersection, - const boost::optional &node_style, - const boost::optional &way_style) const +util::json::Array IntersectionPrinter::operator()( + const NodeID intersection_node, + const IntersectionType &intersection, + const boost::optional &node_style, + const boost::optional &way_style) const { // request the number of lanes. This process needs to be in sync with what happens over at // intersection analysis diff --git a/include/extractor/graph_compressor.hpp b/include/extractor/graph_compressor.hpp index 99d4cf85b..159e606ef 100644 --- a/include/extractor/graph_compressor.hpp +++ b/include/extractor/graph_compressor.hpp @@ -39,7 +39,7 @@ class GraphCompressor unsigned original_number_of_edges, const util::NodeBasedDynamicGraph &graph) const; }; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/internal_extractor_edge.hpp b/include/extractor/internal_extractor_edge.hpp index 5b2007fa7..c7ee904d9 100644 --- a/include/extractor/internal_extractor_edge.hpp +++ b/include/extractor/internal_extractor_edge.hpp @@ -49,7 +49,7 @@ struct ByEdgeOrByMeterValue using value_type = float; value_type value; }; -} +} // namespace detail struct InternalExtractorEdge { @@ -86,7 +86,7 @@ struct InternalExtractorEdge // coordinate of the source node util::Coordinate source_coordinate; }; -} -} +} // namespace extractor +} // namespace osrm #endif // INTERNAL_EXTRACTOR_EDGE_HPP diff --git a/include/extractor/intersection/intersection_analysis.hpp b/include/extractor/intersection/intersection_analysis.hpp index e5ed8ede3..f64f3eaf1 100644 --- a/include/extractor/intersection/intersection_analysis.hpp +++ b/include/extractor/intersection/intersection_analysis.hpp @@ -79,8 +79,8 @@ IntersectionView getConnectedRoads(const util::NodeBasedDynamicGraph &graph, // for getConnectedRoads. IntersectionEdge skipDegreeTwoNodes(const util::NodeBasedDynamicGraph &graph, IntersectionEdge road); -} -} -} +} // namespace intersection +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/intersection/intersection_edge.hpp b/include/extractor/intersection/intersection_edge.hpp index 954184abe..fcf5bc5d4 100644 --- a/include/extractor/intersection/intersection_edge.hpp +++ b/include/extractor/intersection/intersection_edge.hpp @@ -42,8 +42,8 @@ struct IntersectionEdgeGeometry }; using IntersectionEdgeGeometries = std::vector; -} -} -} +} // namespace intersection +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/intersection_bearings_container.hpp b/include/extractor/intersection_bearings_container.hpp index 879d38a98..924ea4562 100644 --- a/include/extractor/intersection_bearings_container.hpp +++ b/include/extractor/intersection_bearings_container.hpp @@ -30,7 +30,7 @@ template void write(storage::tar::FileWriter &writer, const std::string &name, const detail::IntersectionBearingsContainer &turn_data); -} +} // namespace serialization namespace detail { @@ -99,12 +99,12 @@ template class IntersectionBearingsContainer Vector node_to_class_id; RangeTable<16> class_id_to_ranges_table; }; -} +} // namespace detail using IntersectionBearingsContainer = detail::IntersectionBearingsContainer; using IntersectionBearingsView = detail::IntersectionBearingsContainer; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/location_dependent_data.hpp b/include/extractor/location_dependent_data.hpp index c8f4b9af9..afb0a66b9 100644 --- a/include/extractor/location_dependent_data.hpp +++ b/include/extractor/location_dependent_data.hpp @@ -48,7 +48,7 @@ struct LocationDependentData std::vector> polygons; std::vector properties; }; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/maneuver_override.hpp b/include/extractor/maneuver_override.hpp index 34ac6230e..ab0d2837a 100644 --- a/include/extractor/maneuver_override.hpp +++ b/include/extractor/maneuver_override.hpp @@ -71,19 +71,19 @@ struct UnresolvedManeuverOverride // check if all parts of the restriction reference an actual node bool Valid() const { - return !turn_sequence.empty() && std::none_of(turn_sequence.begin(), - turn_sequence.end(), - [](const auto &n) { - return n.from == SPECIAL_NODEID || - n.via == SPECIAL_NODEID || - n.to == SPECIAL_NODEID; - }) && + return !turn_sequence.empty() && + std::none_of(turn_sequence.begin(), + turn_sequence.end(), + [](const auto &n) { + return n.from == SPECIAL_NODEID || n.via == SPECIAL_NODEID || + n.to == SPECIAL_NODEID; + }) && (direction != guidance::DirectionModifier::MaxDirectionModifier || override_type != guidance::TurnType::Invalid); } }; -} -} +} // namespace extractor +} // namespace osrm // custom specialization of std::hash can be injected in namespace std namespace std @@ -104,7 +104,7 @@ template <> struct hash return seed; } }; -} +} // namespace std #endif /* diff --git a/include/extractor/maneuver_override_relation_parser.hpp b/include/extractor/maneuver_override_relation_parser.hpp index 902410a13..45b3d87ab 100644 --- a/include/extractor/maneuver_override_relation_parser.hpp +++ b/include/extractor/maneuver_override_relation_parser.hpp @@ -59,7 +59,7 @@ class ManeuverOverrideRelationParser ManeuverOverrideRelationParser(); boost::optional TryParse(const osmium::Relation &relation) const; }; -} -} +} // namespace extractor +} // namespace osrm #endif /* RESTRICTION_PARSER_HPP */ diff --git a/include/extractor/name_table.hpp b/include/extractor/name_table.hpp index f50bd73e1..9bf6dc7ea 100644 --- a/include/extractor/name_table.hpp +++ b/include/extractor/name_table.hpp @@ -28,7 +28,7 @@ template inline void write(storage::tar::FileWriter &writer, const std::string &name, const detail::NameTableImpl &index_data); -} +} // namespace serialization namespace detail { @@ -111,7 +111,7 @@ template class NameTableImpl private: IndexedData indexed_data; }; -} +} // namespace detail using NameTable = detail::NameTableImpl; using NameTableView = detail::NameTableImpl; diff --git a/include/extractor/nbg_to_ebg.hpp b/include/extractor/nbg_to_ebg.hpp index adbf70a4b..6859db9a8 100644 --- a/include/extractor/nbg_to_ebg.hpp +++ b/include/extractor/nbg_to_ebg.hpp @@ -15,7 +15,7 @@ struct NBGToEBG NodeID u, v; NodeID forward_ebg_node, backward_ebg_node; }; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/node_based_edge.hpp b/include/extractor/node_based_edge.hpp index 5abcd08d3..84a03d0a0 100644 --- a/include/extractor/node_based_edge.hpp +++ b/include/extractor/node_based_edge.hpp @@ -206,7 +206,7 @@ static_assert(sizeof(extractor::NodeBasedEdge) == 32, "bigger than expected. This will influence " "memory consumption."); -} // ns extractor -} // ns osrm +} // namespace extractor +} // namespace osrm #endif /* NODE_BASED_EDGE_HPP */ diff --git a/include/extractor/node_data_container.hpp b/include/extractor/node_data_container.hpp index e60dfa2e2..e39b28727 100644 --- a/include/extractor/node_data_container.hpp +++ b/include/extractor/node_data_container.hpp @@ -37,7 +37,7 @@ template void write(storage::tar::FileWriter &writer, const std::string &name, const detail::EdgeBasedNodeDataContainerImpl &ebn_data); -} +} // namespace serialization namespace detail { @@ -122,7 +122,7 @@ template class EdgeBasedNodeDataContainerImpl Vector nodes; Vector annotation_data; }; -} +} // namespace detail using EdgeBasedNodeDataExternalContainer = detail::EdgeBasedNodeDataContainerImpl; diff --git a/include/extractor/packed_osm_ids.hpp b/include/extractor/packed_osm_ids.hpp index 0f97d4b06..3a1b50557 100644 --- a/include/extractor/packed_osm_ids.hpp +++ b/include/extractor/packed_osm_ids.hpp @@ -16,7 +16,7 @@ using PackedOSMIDs = util::detail::PackedVector; using PackedOSMIDsView = detail::PackedOSMIDs; using PackedOSMIDs = detail::PackedOSMIDs; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/profile_properties.hpp b/include/extractor/profile_properties.hpp index 7960544d8..ccfd0f348 100644 --- a/include/extractor/profile_properties.hpp +++ b/include/extractor/profile_properties.hpp @@ -138,7 +138,7 @@ struct ProfileProperties bool force_split_edges = false; bool call_tagless_node_function = true; }; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/query_node.hpp b/include/extractor/query_node.hpp index 53c7adad7..557c80eea 100644 --- a/include/extractor/query_node.hpp +++ b/include/extractor/query_node.hpp @@ -48,7 +48,7 @@ struct QueryNode MAX_OSM_NODEID); } }; -} -} +} // namespace extractor +} // namespace osrm #endif // QUERY_NODE_HPP diff --git a/include/extractor/restriction.hpp b/include/extractor/restriction.hpp index 4f7f59a0e..a05fccdc0 100644 --- a/include/extractor/restriction.hpp +++ b/include/extractor/restriction.hpp @@ -250,7 +250,7 @@ struct ConditionalTurnRestriction : TurnRestriction { std::vector condition; }; -} -} +} // namespace extractor +} // namespace osrm #endif // RESTRICTION_HPP diff --git a/include/extractor/restriction_parser.hpp b/include/extractor/restriction_parser.hpp index 25a2a95e0..cb8304617 100644 --- a/include/extractor/restriction_parser.hpp +++ b/include/extractor/restriction_parser.hpp @@ -54,7 +54,7 @@ class RestrictionParser bool parse_conditionals; std::vector restrictions; }; -} -} +} // namespace extractor +} // namespace osrm #endif /* RESTRICTION_PARSER_HPP */ diff --git a/include/extractor/road_classification.hpp b/include/extractor/road_classification.hpp index da7b2638a..bac267bb3 100644 --- a/include/extractor/road_classification.hpp +++ b/include/extractor/road_classification.hpp @@ -50,7 +50,7 @@ const constexpr Enum FOOT_PATH = 18; // a road simply offered for connectivity. Will be ignored in forks/other decisions. Always // considered non-obvious to continue on const constexpr Enum CONNECTIVITY = 31; -} // namespace Road Class +} // namespace RoadPriorityClass #pragma pack(push, 1) class RoadClassification diff --git a/include/extractor/scripting_environment.hpp b/include/extractor/scripting_environment.hpp index 0fcc4a7c9..2de5d9638 100644 --- a/include/extractor/scripting_environment.hpp +++ b/include/extractor/scripting_environment.hpp @@ -18,7 +18,7 @@ namespace osmium class Node; class Way; class Relation; -} +} // namespace osmium namespace osrm { @@ -73,7 +73,7 @@ class ScriptingEnvironment virtual bool HasLocationDependentData() const = 0; }; -} -} +} // namespace extractor +} // namespace osrm #endif /* SCRIPTING_ENVIRONMENT_HPP */ diff --git a/include/extractor/segment_data_container.hpp b/include/extractor/segment_data_container.hpp index bb7825000..580c018ed 100644 --- a/include/extractor/segment_data_container.hpp +++ b/include/extractor/segment_data_container.hpp @@ -39,7 +39,7 @@ template inline void write(storage::tar::FileWriter &writer, const std::string &name, const detail::SegmentDataContainerImpl &segment_data); -} +} // namespace serialization namespace detail { @@ -221,11 +221,11 @@ template class SegmentDataContainerImpl SegmentDatasourceVector fwd_datasources; SegmentDatasourceVector rev_datasources; }; -} +} // namespace detail using SegmentDataView = detail::SegmentDataContainerImpl; using SegmentDataContainer = detail::SegmentDataContainerImpl; -} -} +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/serialization.hpp b/include/extractor/serialization.hpp index 58ca81f0e..363dd9c16 100644 --- a/include/extractor/serialization.hpp +++ b/include/extractor/serialization.hpp @@ -222,8 +222,8 @@ inline void read(storage::tar::FileReader &reader, std::string buffer; util::serialization::read(reader, name, name_table.indexed_data); } -} -} -} +} // namespace serialization +} // namespace extractor +} // namespace osrm #endif diff --git a/include/extractor/tarjan_scc.hpp b/include/extractor/tarjan_scc.hpp index 2eea7efe7..c4ccac1ca 100644 --- a/include/extractor/tarjan_scc.hpp +++ b/include/extractor/tarjan_scc.hpp @@ -180,7 +180,7 @@ template class TarjanSCC unsigned GetComponentID(const NodeID node) const { return components_index[node]; } }; -} -} +} // namespace extractor +} // namespace osrm #endif /* TARJAN_SCC_HPP */ diff --git a/include/extractor/travel_mode.hpp b/include/extractor/travel_mode.hpp index 59ac70d6b..5ba4bbd1f 100644 --- a/include/extractor/travel_mode.hpp +++ b/include/extractor/travel_mode.hpp @@ -103,7 +103,7 @@ inline std::string travelModeToString(const TravelMode mode) return token; } -} // ns extractor -} // ns osrm +} // namespace extractor +} // namespace osrm #endif /* TRAVEL_MODE_HPP */ diff --git a/include/extractor/turn_lane_types.hpp b/include/extractor/turn_lane_types.hpp index ac8c5e0cc..80b413ad7 100644 --- a/include/extractor/turn_lane_types.hpp +++ b/include/extractor/turn_lane_types.hpp @@ -52,7 +52,7 @@ const constexpr Mask uturn = 1u << 8u; const constexpr Mask merge_to_left = 1u << 9u; const constexpr Mask merge_to_right = 1u << 10u; -} // TurnLaneType +} // namespace TurnLaneType typedef std::vector TurnLaneDescription; @@ -100,7 +100,7 @@ inline TurnLanesIndexedArray transformTurnLaneMapIntoArrays(const LaneDescriptio return std::make_tuple(std::move(turn_lane_offsets), std::move(turn_lane_masks)); } -} // extractor -} // osrm +} // namespace extractor +} // namespace osrm #endif /* OSRM_GUIDANCE_TURN_LANE_TYPES_HPP_ */ diff --git a/include/guidance/files.hpp b/include/guidance/files.hpp index c0d1f54e2..b57e79987 100644 --- a/include/guidance/files.hpp +++ b/include/guidance/files.hpp @@ -51,8 +51,8 @@ inline void writeTurnData(const boost::filesystem::path &path, writer.WriteFrom("/common/connectivity_checksum", connectivity_checksum); serialization::write(writer, "/common/turn_data", turn_data); } -} -} -} +} // namespace files +} // namespace guidance +} // namespace osrm #endif diff --git a/include/guidance/guidance_processing.hpp b/include/guidance/guidance_processing.hpp index 9da18abc7..26122e6ce 100644 --- a/include/guidance/guidance_processing.hpp +++ b/include/guidance/guidance_processing.hpp @@ -44,7 +44,7 @@ void annotateTurns(const util::NodeBasedDynamicGraph &node_based_graph, EntryClassesMap &entry_class_hash, std::uint32_t &connectivity_checksum); -} // namespace customizer +} // namespace guidance } // namespace osrm #endif diff --git a/include/guidance/intersection_handler.hpp b/include/guidance/intersection_handler.hpp index 2b5cb6671..42221e467 100644 --- a/include/guidance/intersection_handler.hpp +++ b/include/guidance/intersection_handler.hpp @@ -172,7 +172,7 @@ inline bool roadHasLowerClass(const util::NodeBasedEdgeData &from_data, return false; } -} +} // namespace template // works with Intersection and IntersectionView inline bool @@ -213,7 +213,6 @@ IntersectionHandler::IsDistinctNarrowTurn(const EdgeID via_edge, // check if there are other narrow turns are not considered passing a low category or simply // a link of the same type as the potentially obvious turn auto const is_similar_turn = [&](auto const &road) { - // 1. Skip the candidate road if (road.eid == candidate->eid) { @@ -409,7 +408,6 @@ IntersectionHandler::IsDistinctWideTurn(const EdgeID via_edge, // check if there is any turn, that might look just as obvious, even though it might not // be allowed. Entry-allowed isn't considered a valid distinction criterion here auto const is_similar_turn = [&](auto const &road) { - // 1. Skip over our candidate if (road.eid == candidate->eid) return false; @@ -644,7 +642,7 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge, const auto all_roads_have_same_name = std::all_of(intersection.begin(), intersection.end(), - [ id = via_edge_annotation.name_id, this ](auto const &road) { + [id = via_edge_annotation.name_id, this](auto const &road) { auto const data_id = node_based_graph.GetEdgeData(road.eid).annotation_data; auto const name_id = node_data_container.GetAnnotation(data_id).name_id; return (name_id != EMPTY_NAMEID) && (name_id == id); diff --git a/include/guidance/segregated_intersection_classification.hpp b/include/guidance/segregated_intersection_classification.hpp index 363192921..b8cf3b094 100644 --- a/include/guidance/segregated_intersection_classification.hpp +++ b/include/guidance/segregated_intersection_classification.hpp @@ -20,5 +20,5 @@ namespace guidance // - square/circle intersections std::unordered_set findSegregatedNodes(const extractor::NodeBasedGraphFactory &factory, const extractor::NameTable &names); -} -} +} // namespace guidance +} // namespace osrm diff --git a/include/guidance/serialization.hpp b/include/guidance/serialization.hpp index 6917cb02e..e5cf544ff 100644 --- a/include/guidance/serialization.hpp +++ b/include/guidance/serialization.hpp @@ -49,8 +49,8 @@ inline void write(storage::tar::FileWriter &writer, storage::serialization::write( writer, name + "/post_turn_bearings", turn_data_container.post_turn_bearings); } -} -} -} +} // namespace serialization +} // namespace guidance +} // namespace osrm #endif diff --git a/include/guidance/turn_data_container.hpp b/include/guidance/turn_data_container.hpp index ae4ecc173..99b893cb0 100644 --- a/include/guidance/turn_data_container.hpp +++ b/include/guidance/turn_data_container.hpp @@ -32,7 +32,7 @@ template void write(storage::tar::FileWriter &writer, const std::string &name, const detail::TurnDataContainerImpl &turn_data); -} +} // namespace serialization struct TurnData { @@ -111,12 +111,12 @@ template class TurnDataContainerImpl Vector pre_turn_bearings; Vector post_turn_bearings; }; -} +} // namespace detail using TurnDataExternalContainer = detail::TurnDataContainerImpl; using TurnDataContainer = detail::TurnDataContainerImpl; using TurnDataView = detail::TurnDataContainerImpl; -} -} +} // namespace guidance +} // namespace osrm #endif diff --git a/include/guidance/turn_instruction.hpp b/include/guidance/turn_instruction.hpp index 82afe8614..685c633e7 100644 --- a/include/guidance/turn_instruction.hpp +++ b/include/guidance/turn_instruction.hpp @@ -26,7 +26,7 @@ const constexpr Enum SlightLeft = 5; const constexpr Enum Left = 6; const constexpr Enum SharpLeft = 7; const constexpr Enum MaxDirectionModifier = 8; -} +} // namespace DirectionModifier namespace TurnType { @@ -63,7 +63,7 @@ const constexpr Enum StayOnRoundabout = 25; // Continue on Either a small or a l const constexpr Enum Sliproad = 26; // Something that looks like a ramp, but is actually just a small sliproad const constexpr Enum MaxTurnType = 27; // Special value for static asserts -} +} // namespace TurnType struct TurnInstruction { @@ -367,7 +367,7 @@ const constexpr TurnTypeName turn_type_names[] = { {"invalid", "(sliproad)"}, {"MAXVALUE", "MAXVALUE"}}; -} // ns detail +} // namespace detail inline std::string instructionTypeToString(const TurnType::Enum type) { diff --git a/include/guidance/turn_lane_data.hpp b/include/guidance/turn_lane_data.hpp index e6a6c83b2..9ede132ab 100644 --- a/include/guidance/turn_lane_data.hpp +++ b/include/guidance/turn_lane_data.hpp @@ -37,7 +37,7 @@ LaneDataVector::iterator findTag(const extractor::TurnLaneType::Mask tag, LaneDa // Returns true if any of the queried tags is contained bool hasTag(const extractor::TurnLaneType::Mask tag, const LaneDataVector &data); -} // namespace lane_data_generation +} // namespace lanes } // namespace guidance } // namespace osrm diff --git a/include/guidance/turn_lane_handler.hpp b/include/guidance/turn_lane_handler.hpp index ad9a759a8..d0947d980 100644 --- a/include/guidance/turn_lane_handler.hpp +++ b/include/guidance/turn_lane_handler.hpp @@ -34,7 +34,8 @@ namespace lanes namespace { -typedef enum TurnLaneScenario { +typedef enum TurnLaneScenario +{ SIMPLE, // a straightforward assignment PARTITION_LOCAL, // an assignment that requires partitioning, using local turns SIMPLE_PREVIOUS, // an assignemtnn using the turns specified at the previous road (e.g. diff --git a/include/nodejs/json_v8_renderer.hpp b/include/nodejs/json_v8_renderer.hpp index ab7c89e42..b23054a3b 100644 --- a/include/nodejs/json_v8_renderer.hpp +++ b/include/nodejs/json_v8_renderer.hpp @@ -63,6 +63,6 @@ inline void renderToV8(v8::Local &out, const osrm::json::Object &obje osrm::json::Value value = object; mapbox::util::apply_visitor(V8Renderer(out), value); } -} +} // namespace node_osrm #endif // JSON_V8_RENDERER_HPP diff --git a/include/osrm/contractor.hpp b/include/osrm/contractor.hpp index 9e6b67261..e6b1cafdd 100644 --- a/include/osrm/contractor.hpp +++ b/include/osrm/contractor.hpp @@ -34,7 +34,7 @@ namespace contractor { struct ContractorConfig; -} // ns contractor +} // namespace contractor /** * Runs contraction hierarchy computation process. @@ -45,6 +45,6 @@ struct ContractorConfig; */ void contract(const contractor::ContractorConfig &config); -} // ns osrm +} // namespace osrm #endif // OSRM_CONTRACTOR_HPP diff --git a/include/osrm/coordinate.hpp b/include/osrm/coordinate.hpp index 124fa34bc..37bcbdd87 100644 --- a/include/osrm/coordinate.hpp +++ b/include/osrm/coordinate.hpp @@ -39,6 +39,6 @@ using util::FloatLatitude; using util::FloatLongitude; using util::toFixed; using util::toFloating; -} +} // namespace osrm #endif diff --git a/include/osrm/customizer.hpp b/include/osrm/customizer.hpp index f086d2dce..d810aa60e 100644 --- a/include/osrm/customizer.hpp +++ b/include/osrm/customizer.hpp @@ -34,7 +34,7 @@ namespace osrm namespace customizer { struct CustomizationConfig; -} // ns customizer +} // namespace customizer /** * Runs customize pipeline stage. @@ -45,6 +45,6 @@ struct CustomizationConfig; */ void customize(const customizer::CustomizationConfig &config); -} // ns osrm +} // namespace osrm #endif // OSRM_CUSTOMIZER_HPP diff --git a/include/osrm/error_codes.hpp b/include/osrm/error_codes.hpp index 0891cc7bc..531966fd5 100644 --- a/include/osrm/error_codes.hpp +++ b/include/osrm/error_codes.hpp @@ -32,6 +32,6 @@ enum ErrorCode __ENDMARKER__ #endif }; -} +} // namespace osrm #endif // OSRM_ERRORCODES_HPP \ No newline at end of file diff --git a/include/osrm/exception.hpp b/include/osrm/exception.hpp index ab0c7dfd7..97368d855 100644 --- a/include/osrm/exception.hpp +++ b/include/osrm/exception.hpp @@ -32,8 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace osrm { -using util::RuntimeError; using util::exception; -} +using util::RuntimeError; +} // namespace osrm #endif diff --git a/include/osrm/extractor.hpp b/include/osrm/extractor.hpp index a598980b0..c7743f1b0 100644 --- a/include/osrm/extractor.hpp +++ b/include/osrm/extractor.hpp @@ -34,7 +34,7 @@ namespace extractor { struct ExtractorConfig; -} // ns contractor +} // namespace extractor /** * Runs extraction process. @@ -45,6 +45,6 @@ struct ExtractorConfig; */ void extract(const extractor::ExtractorConfig &config); -} // ns osrm +} // namespace osrm #endif // OSRM_EXTRACTOR_HPP diff --git a/include/osrm/osrm.hpp b/include/osrm/osrm.hpp index 74c73f7dd..0caa83827 100644 --- a/include/osrm/osrm.hpp +++ b/include/osrm/osrm.hpp @@ -134,6 +134,6 @@ class OSRM final private: std::unique_ptr engine_; }; -} +} // namespace osrm #endif // OSRM_HPP diff --git a/include/osrm/osrm_fwd.hpp b/include/osrm/osrm_fwd.hpp index a232390d0..e1b0ee772 100644 --- a/include/osrm/osrm_fwd.hpp +++ b/include/osrm/osrm_fwd.hpp @@ -39,8 +39,8 @@ namespace util namespace json { struct Object; -} // ns json -} // ns util +} // namespace json +} // namespace util namespace engine { @@ -52,11 +52,11 @@ struct NearestParameters; struct TripParameters; struct MatchParameters; struct TileParameters; -} // ns api +} // namespace api class EngineInterface; struct EngineConfig; -} // ns engine -} // ns osrm +} // namespace engine +} // namespace osrm #endif diff --git a/include/osrm/partitioner.hpp b/include/osrm/partitioner.hpp index 429e4a588..e9a91db8d 100644 --- a/include/osrm/partitioner.hpp +++ b/include/osrm/partitioner.hpp @@ -34,7 +34,7 @@ namespace osrm namespace partitioner { struct PartitionerConfig; -} // ns partition +} // namespace partitioner /** * Runs recursive partitioning process. @@ -45,6 +45,6 @@ struct PartitionerConfig; */ void partition(const partitioner::PartitionerConfig &config); -} // ns osrm +} // namespace osrm #endif // OSRM_PARTITIONER_HPP diff --git a/include/partitioner/bisection_graph.hpp b/include/partitioner/bisection_graph.hpp index bc2bd44ca..f0a5d62ff 100644 --- a/include/partitioner/bisection_graph.hpp +++ b/include/partitioner/bisection_graph.hpp @@ -77,8 +77,9 @@ inline BisectionGraph makeBisectionGraph(const std::vector &co }; // create a bisection node, requires the ID of the node as well as the lower bound to its edges - const auto make_bisection_node = [&edges, &coordinates]( - const std::size_t node_id, const auto begin_itr, const auto end_itr) { + const auto make_bisection_node = [&edges, &coordinates](const std::size_t node_id, + const auto begin_itr, + const auto end_itr) { std::size_t range_begin = std::distance(edges.begin(), begin_itr); std::size_t range_end = std::distance(edges.begin(), end_itr); return BisectionGraph::NodeT(range_begin, range_end, coordinates[node_id], node_id); diff --git a/include/partitioner/bisection_to_partition.hpp b/include/partitioner/bisection_to_partition.hpp index 14186f3c4..03a37f19b 100644 --- a/include/partitioner/bisection_to_partition.hpp +++ b/include/partitioner/bisection_to_partition.hpp @@ -17,7 +17,7 @@ using Partition = std::vector; std::tuple, std::vector> bisectionToPartition(const std::vector &node_to_bisection_id, const std::vector &max_cell_sizes); -} -} +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/cell_statistics.hpp b/include/partitioner/cell_statistics.hpp index cf8dfd0f8..17b750e79 100644 --- a/include/partitioner/cell_statistics.hpp +++ b/include/partitioner/cell_statistics.hpp @@ -48,7 +48,7 @@ void printCellStatistics(const Partition &partition, const CellStorage &storage) << (2 * entries * sizeof(EdgeWeight)) << " bytes)"; } } -} -} +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/cell_storage.hpp b/include/partitioner/cell_storage.hpp index b28393319..42c347861 100644 --- a/include/partitioner/cell_storage.hpp +++ b/include/partitioner/cell_storage.hpp @@ -45,7 +45,7 @@ template inline void write(storage::tar::FileWriter &writer, const std::string &name, const detail::CellStorageImpl &storage); -} +} // namespace serialization namespace detail { @@ -102,10 +102,9 @@ template class CellStorageImpl { using ValueT = decltype(*std::declval()); - typedef boost::iterator_facade, - ValueT, - boost::random_access_traversal_tag> - base_t; + typedef boost:: + iterator_facade, ValueT, boost::random_access_traversal_tag> + base_t; public: typedef typename base_t::value_type value_type; @@ -195,10 +194,10 @@ template 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} { @@ -216,8 +215,8 @@ template 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); @@ -451,8 +450,8 @@ template class CellStorageImpl Vector cells; Vector level_to_cell_offset; }; -} -} -} +} // namespace detail +} // namespace partitioner +} // namespace osrm #endif // OSRM_PARTITIONER_CUSTOMIZE_CELL_STORAGE_HPP diff --git a/include/partitioner/edge_based_graph.hpp b/include/partitioner/edge_based_graph.hpp index f39fb2732..a0f6e1986 100644 --- a/include/partitioner/edge_based_graph.hpp +++ b/include/partitioner/edge_based_graph.hpp @@ -53,7 +53,7 @@ struct DynamicEdgeBasedGraphEdge : DynamicEdgeBasedGraph::InputEdge using Base = DynamicEdgeBasedGraph::InputEdge; using Base::Base; }; -} -} +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/edge_based_graph_reader.hpp b/include/partitioner/edge_based_graph_reader.hpp index bc5ba8b96..0c5d01b70 100644 --- a/include/partitioner/edge_based_graph_reader.hpp +++ b/include/partitioner/edge_based_graph_reader.hpp @@ -143,22 +143,22 @@ inline std::vector graphToEdges(const DynamicEdgeBasedGraph &edge_based_graph) { auto range = tbb::blocked_range(0, edge_based_graph.GetNumberOfNodes()); - auto max_turn_id = - tbb::parallel_reduce(range, - NodeID{0}, - [&edge_based_graph](const auto range, NodeID initial) { - NodeID max_turn_id = initial; - 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); - max_turn_id = std::max(max_turn_id, data.turn_id); - } - } - return max_turn_id; - }, - [](const NodeID lhs, const NodeID rhs) { return std::max(lhs, rhs); }); + auto max_turn_id = tbb::parallel_reduce( + range, + NodeID{0}, + [&edge_based_graph](const auto range, NodeID initial) { + NodeID max_turn_id = initial; + 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); + max_turn_id = std::max(max_turn_id, data.turn_id); + } + } + return max_turn_id; + }, + [](const NodeID lhs, const NodeID rhs) { return std::max(lhs, rhs); }); std::vector edges(max_turn_id + 1); tbb::parallel_for(range, [&](const auto range) { @@ -198,7 +198,7 @@ inline DynamicEdgeBasedGraph LoadEdgeBasedGraph(const boost::filesystem::path &p return DynamicEdgeBasedGraph(number_of_edge_based_nodes, std::move(tidied), checksum); } -} // ns partition -} // ns osrm +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/files.hpp b/include/partitioner/files.hpp index 30bd2942d..fe96d5c50 100644 --- a/include/partitioner/files.hpp +++ b/include/partitioner/files.hpp @@ -96,8 +96,8 @@ inline void writeGraph(const boost::filesystem::path &path, writer.WriteFrom("/mld/connectivity_checksum", connectivity_checksum); serialization::write(writer, "/mld/multilevelgraph", graph); } -} -} -} +} // namespace files +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/multi_level_graph.hpp b/include/partitioner/multi_level_graph.hpp index 2d5635790..48a9c3ae4 100644 --- a/include/partitioner/multi_level_graph.hpp +++ b/include/partitioner/multi_level_graph.hpp @@ -33,7 +33,7 @@ template void write(storage::tar::FileWriter &writer, const std::string &name, const MultiLevelGraph &graph); -} +} // namespace serialization template class MultiLevelGraph : public util::StaticGraph @@ -236,7 +236,7 @@ class MultiLevelGraph : public util::StaticGraph using MultiLevelEdgeBasedGraph = MultiLevelGraph; -} -} +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/multi_level_partition.hpp b/include/partitioner/multi_level_partition.hpp index 0b61f21d6..855aa5ae2 100644 --- a/include/partitioner/multi_level_partition.hpp +++ b/include/partitioner/multi_level_partition.hpp @@ -41,7 +41,7 @@ template void write(storage::tar::FileWriter &writer, const std::string &name, const detail::MultiLevelPartitionImpl &mlp); -} +} // namespace serialization namespace detail { @@ -338,8 +338,8 @@ inline MultiLevelPartitionImpl::MultiLevelPartitionImp : level_data(nullptr) { } -} -} -} +} // namespace detail +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/partitioner_config.hpp b/include/partitioner/partitioner_config.hpp index 04809dff4..01189b780 100644 --- a/include/partitioner/partitioner_config.hpp +++ b/include/partitioner/partitioner_config.hpp @@ -44,7 +44,7 @@ struct PartitionerConfig final : storage::IOConfig std::size_t small_component_size; std::vector max_cell_sizes; }; -} -} +} // namespace partitioner +} // namespace osrm #endif // OSRM_PARTITIONER_CONFIG_HPP diff --git a/include/partitioner/remove_unconnected.hpp b/include/partitioner/remove_unconnected.hpp index 7e6ac9679..2e379fa71 100644 --- a/include/partitioner/remove_unconnected.hpp +++ b/include/partitioner/remove_unconnected.hpp @@ -109,7 +109,7 @@ std::size_t removeUnconnectedBoundaryNodes(const GraphT &edge_based_graph, return num_unconnected; } -} -} +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/reorder_first_last.hpp b/include/partitioner/reorder_first_last.hpp index 231509db0..da2d04157 100644 --- a/include/partitioner/reorder_first_last.hpp +++ b/include/partitioner/reorder_first_last.hpp @@ -49,7 +49,7 @@ void reorderFirstLast(RandomAccessRange &rng, std::size_t n, Compare comp) return reorderFirstLast(begin(rng), end(rng), n, comp); } -} // ns partition -} // ns osrm +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/partitioner/serialization.hpp b/include/partitioner/serialization.hpp index 6f43c02ea..55e105102 100644 --- a/include/partitioner/serialization.hpp +++ b/include/partitioner/serialization.hpp @@ -65,8 +65,8 @@ inline void write(storage::tar::FileWriter &writer, storage::serialization::write( writer, name + "/level_to_cell_offset", storage.level_to_cell_offset); } -} -} -} +} // namespace serialization +} // namespace partitioner +} // namespace osrm #endif diff --git a/include/server/api/match_parameter_grammar.hpp b/include/server/api/match_parameter_grammar.hpp index 42915fe1b..9893b01db 100644 --- a/include/server/api/match_parameter_grammar.hpp +++ b/include/server/api/match_parameter_grammar.hpp @@ -18,7 +18,7 @@ namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; -} +} // namespace template @@ -62,8 +62,8 @@ struct MatchParametersGrammar final : public RouteParametersGrammar gaps_type; }; -} -} -} +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/api/nearest_parameter_grammar.hpp b/include/server/api/nearest_parameter_grammar.hpp index 5a6c298c9..8327a9503 100644 --- a/include/server/api/nearest_parameter_grammar.hpp +++ b/include/server/api/nearest_parameter_grammar.hpp @@ -18,7 +18,7 @@ namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; -} +} // namespace template @@ -40,8 +40,8 @@ struct NearestParametersGrammar final : public BaseParametersGrammar root_rule; qi::rule nearest_rule; }; -} -} -} +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/api/parameters_parser.hpp b/include/server/api/parameters_parser.hpp index 08083edb5..05e257b53 100644 --- a/include/server/api/parameters_parser.hpp +++ b/include/server/api/parameters_parser.hpp @@ -25,7 +25,7 @@ using is_parameter_t = std::integral_constant::value || std::is_same::value>; -} // ns detail +} // namespace detail // Starts parsing and iter and modifies it until iter == end or parsing failed template parseParameters(std::string options_string) return parseParameters(first, last); } -} // ns api -} // ns server -} // ns osrm +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/api/parsed_url.hpp b/include/server/api/parsed_url.hpp index 0fefc65db..b4abf49c5 100644 --- a/include/server/api/parsed_url.hpp +++ b/include/server/api/parsed_url.hpp @@ -22,8 +22,8 @@ struct ParsedURL final std::size_t prefix_length; }; -} // api -} // server -} // osrm +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/api/route_parameters_grammar.hpp b/include/server/api/route_parameters_grammar.hpp index 71beb971a..df5fb52df 100644 --- a/include/server/api/route_parameters_grammar.hpp +++ b/include/server/api/route_parameters_grammar.hpp @@ -18,7 +18,7 @@ namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; -} +} // namespace template @@ -113,8 +113,8 @@ struct RouteParametersGrammar : public BaseParametersGrammar overview_type; qi::symbols annotations_type; }; -} -} -} +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/api/table_parameter_grammar.hpp b/include/server/api/table_parameter_grammar.hpp index 7734621aa..c88f85299 100644 --- a/include/server/api/table_parameter_grammar.hpp +++ b/include/server/api/table_parameter_grammar.hpp @@ -18,7 +18,7 @@ namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; -} +} // namespace template @@ -106,8 +106,8 @@ struct TableParametersGrammar : public BaseParametersGrammar double_; }; -} -} -} +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/api/tile_parameter_grammar.hpp b/include/server/api/tile_parameter_grammar.hpp index 42e958400..8c22b3837 100644 --- a/include/server/api/tile_parameter_grammar.hpp +++ b/include/server/api/tile_parameter_grammar.hpp @@ -22,7 +22,7 @@ namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; -} +} // namespace template @@ -40,8 +40,8 @@ struct TileParametersGrammar final : boost::spirit::qi::grammar root_rule; }; -} -} -} +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/api/trip_parameter_grammar.hpp b/include/server/api/trip_parameter_grammar.hpp index 28cf98458..ecb14db50 100644 --- a/include/server/api/trip_parameter_grammar.hpp +++ b/include/server/api/trip_parameter_grammar.hpp @@ -18,7 +18,7 @@ namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; -} +} // namespace template @@ -60,8 +60,8 @@ struct TripParametersGrammar final : public RouteParametersGrammar source_type; qi::symbols destination_type; }; -} -} -} +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/api/url_parser.hpp b/include/server/api/url_parser.hpp index 5fcca36d1..35a3e0a60 100644 --- a/include/server/api/url_parser.hpp +++ b/include/server/api/url_parser.hpp @@ -22,8 +22,8 @@ inline boost::optional parseURL(std::string url_string) auto iter = url_string.begin(); return parseURL(iter, url_string.end()); } -} -} -} +} // namespace api +} // namespace server +} // namespace osrm #endif diff --git a/include/server/connection.hpp b/include/server/connection.hpp index 0680735f0..b40fa2912 100644 --- a/include/server/connection.hpp +++ b/include/server/connection.hpp @@ -76,7 +76,7 @@ class Connection : public std::enable_shared_from_this short processed_requests = 512; short keepalive_timeout = 5; // In seconds }; -} -} +} // namespace server +} // namespace osrm #endif // CONNECTION_HPP diff --git a/include/server/http/compression_type.hpp b/include/server/http/compression_type.hpp index 7ff929c0e..620ca5859 100644 --- a/include/server/http/compression_type.hpp +++ b/include/server/http/compression_type.hpp @@ -15,7 +15,7 @@ enum compression_type deflate_rfc1951 }; } -} -} +} // namespace server +} // namespace osrm #endif // COMPRESSION_TYPE_HPP diff --git a/include/server/http/header.hpp b/include/server/http/header.hpp index 48111a9c8..8ceb5ae9e 100644 --- a/include/server/http/header.hpp +++ b/include/server/http/header.hpp @@ -27,8 +27,8 @@ struct header std::string name; std::string value; }; -} -} -} +} // namespace http +} // namespace server +} // namespace osrm #endif // HEADER_HPP diff --git a/include/server/http/reply.hpp b/include/server/http/reply.hpp index 8474a5c2d..a7b444691 100644 --- a/include/server/http/reply.hpp +++ b/include/server/http/reply.hpp @@ -38,8 +38,8 @@ class reply std::string status_to_string(reply::status_type status); boost::asio::const_buffer status_to_buffer(reply::status_type status); }; -} -} -} +} // namespace http +} // namespace server +} // namespace osrm #endif // REPLY_HPP diff --git a/include/server/http/request.hpp b/include/server/http/request.hpp index e5d867c23..69830ec0d 100644 --- a/include/server/http/request.hpp +++ b/include/server/http/request.hpp @@ -20,8 +20,8 @@ struct request std::string connection; boost::asio::ip::address endpoint; }; -} -} -} +} // namespace http +} // namespace server +} // namespace osrm #endif // REQUEST_HPP diff --git a/include/server/request_handler.hpp b/include/server/request_handler.hpp index d83d088e4..e1c47fced 100644 --- a/include/server/request_handler.hpp +++ b/include/server/request_handler.hpp @@ -14,7 +14,7 @@ namespace http { class reply; struct request; -} +} // namespace http class RequestHandler { @@ -31,7 +31,7 @@ class RequestHandler private: std::unique_ptr service_handler; }; -} -} +} // namespace server +} // namespace osrm #endif // REQUEST_HANDLER_HPP diff --git a/include/server/request_parser.hpp b/include/server/request_parser.hpp index 6d9093d7d..5af1911c9 100644 --- a/include/server/request_parser.hpp +++ b/include/server/request_parser.hpp @@ -69,7 +69,7 @@ class RequestParser http::header current_header; http::compression_type selected_compression; }; -} -} +} // namespace server +} // namespace osrm #endif // REQUEST_PARSER_HPP diff --git a/include/server/server.hpp b/include/server/server.hpp index 0b944fd4a..53098fa61 100644 --- a/include/server/server.hpp +++ b/include/server/server.hpp @@ -109,7 +109,7 @@ class Server std::shared_ptr new_connection; RequestHandler request_handler; }; -} -} +} // namespace server +} // namespace osrm #endif // SERVER_HPP diff --git a/include/server/service/base_service.hpp b/include/server/service/base_service.hpp index 9491fa662..d8e88e72e 100644 --- a/include/server/service/base_service.hpp +++ b/include/server/service/base_service.hpp @@ -31,8 +31,8 @@ class BaseService protected: OSRM &routing_machine; }; -} -} -} +} // namespace service +} // namespace server +} // namespace osrm #endif diff --git a/include/server/service/match_service.hpp b/include/server/service/match_service.hpp index 1c3e51226..df9b81ace 100644 --- a/include/server/service/match_service.hpp +++ b/include/server/service/match_service.hpp @@ -28,8 +28,8 @@ class MatchService final : public BaseService unsigned GetVersion() final override { return 1; } }; -} -} -} +} // namespace service +} // namespace server +} // namespace osrm #endif diff --git a/include/server/service/nearest_service.hpp b/include/server/service/nearest_service.hpp index 454ec710b..06495ea59 100644 --- a/include/server/service/nearest_service.hpp +++ b/include/server/service/nearest_service.hpp @@ -28,8 +28,8 @@ class NearestService final : public BaseService unsigned GetVersion() final override { return 1; } }; -} -} -} +} // namespace service +} // namespace server +} // namespace osrm #endif diff --git a/include/server/service/route_service.hpp b/include/server/service/route_service.hpp index 12dbe0916..033bfbd61 100644 --- a/include/server/service/route_service.hpp +++ b/include/server/service/route_service.hpp @@ -28,8 +28,8 @@ class RouteService final : public BaseService unsigned GetVersion() final override { return 1; } }; -} -} -} +} // namespace service +} // namespace server +} // namespace osrm #endif diff --git a/include/server/service/table_service.hpp b/include/server/service/table_service.hpp index 76f4c32fa..3eb4c72e6 100644 --- a/include/server/service/table_service.hpp +++ b/include/server/service/table_service.hpp @@ -28,8 +28,8 @@ class TableService final : public BaseService unsigned GetVersion() final override { return 1; } }; -} -} -} +} // namespace service +} // namespace server +} // namespace osrm #endif diff --git a/include/server/service/tile_service.hpp b/include/server/service/tile_service.hpp index 5efd2a9b2..4693c9739 100644 --- a/include/server/service/tile_service.hpp +++ b/include/server/service/tile_service.hpp @@ -28,8 +28,8 @@ class TileService final : public BaseService unsigned GetVersion() final override { return 1; } }; -} -} -} +} // namespace service +} // namespace server +} // namespace osrm #endif diff --git a/include/server/service/trip_service.hpp b/include/server/service/trip_service.hpp index a86657dad..0180aa8e4 100644 --- a/include/server/service/trip_service.hpp +++ b/include/server/service/trip_service.hpp @@ -28,8 +28,8 @@ class TripService final : public BaseService unsigned GetVersion() final override { return 1; } }; -} -} -} +} // namespace service +} // namespace server +} // namespace osrm #endif diff --git a/include/server/service/utils.hpp b/include/server/service/utils.hpp index e4fd7df13..fc76d0d14 100644 --- a/include/server/service/utils.hpp +++ b/include/server/service/utils.hpp @@ -24,6 +24,6 @@ bool constrainParamSize(const char *msg_template, } return false; } -} -} -} +} // namespace service +} // namespace server +} // namespace osrm diff --git a/include/server/service_handler.hpp b/include/server/service_handler.hpp index 150174982..2b62b0687 100644 --- a/include/server/service_handler.hpp +++ b/include/server/service_handler.hpp @@ -16,7 +16,7 @@ namespace json { struct Object; } -} +} // namespace util namespace server { namespace api @@ -44,7 +44,7 @@ class ServiceHandler final : public ServiceHandlerInterface std::unordered_map> service_map; OSRM routing_machine; }; -} -} +} // namespace server +} // namespace osrm #endif diff --git a/include/storage/block.hpp b/include/storage/block.hpp index 60271f4ea..75358d460 100644 --- a/include/storage/block.hpp +++ b/include/storage/block.hpp @@ -36,7 +36,7 @@ template Block make_block(uint64_t num_entries) static_assert(sizeof(T) % alignof(T) == 0, "aligned T* can't be used as an array pointer"); return Block{num_entries, sizeof(T) * num_entries, 0}; } -} -} +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/io.hpp b/include/storage/io.hpp old mode 100755 new mode 100644 index 750605ac1..dc681c2fe --- a/include/storage/io.hpp +++ b/include/storage/io.hpp @@ -388,8 +388,8 @@ class BufferWriter private: std::ostringstream output_stream; }; -} // ns io -} // ns storage -} // ns osrm +} // namespace io +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/io_config.hpp b/include/storage/io_config.hpp index ab90298ed..a76ad9562 100644 --- a/include/storage/io_config.hpp +++ b/include/storage/io_config.hpp @@ -79,7 +79,7 @@ struct IOConfig std::vector optional_input_files; std::vector output_files; }; -} -} +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/io_fwd.hpp b/include/storage/io_fwd.hpp index d88af1347..8bfef5728 100644 --- a/include/storage/io_fwd.hpp +++ b/include/storage/io_fwd.hpp @@ -11,8 +11,8 @@ namespace io class FileReader; class FileWriter; -} // ns io -} // ns storage -} // ns osrm +} // namespace io +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/serialization.hpp b/include/storage/serialization.hpp index 07655ba4d..d83abfd9a 100644 --- a/include/storage/serialization.hpp +++ b/include/storage/serialization.hpp @@ -104,7 +104,7 @@ void writeBoolVector(tar::FileWriter &writer, const std::string &name, const Vec boost::make_function_input_iterator(encode_function, boost::infinite()), number_of_blocks); } -} +} // namespace detail /* All vector formats here use the same on-disk format. * This is important because we want to be able to write from a vector @@ -268,8 +268,8 @@ inline void write(io::BufferWriter &writer, const BaseDataLayout &layout) { write(writer, layout.blocks); } -} -} -} +} // namespace serialization +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/shared_data_index.hpp b/include/storage/shared_data_index.hpp index 9041bc100..41ae6dabb 100644 --- a/include/storage/shared_data_index.hpp +++ b/include/storage/shared_data_index.hpp @@ -95,7 +95,7 @@ class SharedDataIndex std::vector regions; std::unordered_map block_to_region; }; -} -} +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/shared_memory_ownership.hpp b/include/storage/shared_memory_ownership.hpp index c1c7e40d9..6075199f2 100644 --- a/include/storage/shared_memory_ownership.hpp +++ b/include/storage/shared_memory_ownership.hpp @@ -13,6 +13,6 @@ enum class Ownership External }; } -} +} // namespace osrm #endif // SHARED_MEMORY_OWNERSHIP_HPP diff --git a/include/storage/storage.hpp b/include/storage/storage.hpp index b03669db0..8c8b974f6 100644 --- a/include/storage/storage.hpp +++ b/include/storage/storage.hpp @@ -61,7 +61,7 @@ class Storage private: StorageConfig config; }; -} -} +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/storage_config.hpp b/include/storage/storage_config.hpp index 83b51a0bd..581b45e32 100644 --- a/include/storage/storage_config.hpp +++ b/include/storage/storage_config.hpp @@ -75,7 +75,7 @@ struct StorageConfig final : IOConfig { } }; -} -} +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/tar.hpp b/include/storage/tar.hpp index d7f4d0022..a13893589 100644 --- a/include/storage/tar.hpp +++ b/include/storage/tar.hpp @@ -9,7 +9,8 @@ #include -extern "C" { +extern "C" +{ #include "microtar.h" } @@ -70,7 +71,7 @@ checkMTarError(int error_code, const boost::filesystem::path &filepath, const st throw util::exception(filepath.string() + " : " + name + ":" + mtar_strerror(error_code)); } } -} +} // namespace detail class FileReader { @@ -311,8 +312,8 @@ class FileWriter boost::filesystem::path path; mtar_t handle; }; -} -} -} +} // namespace tar +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/tar_fwd.hpp b/include/storage/tar_fwd.hpp index cc19ad484..b8503e003 100644 --- a/include/storage/tar_fwd.hpp +++ b/include/storage/tar_fwd.hpp @@ -11,8 +11,8 @@ namespace tar class FileReader; class FileWriter; -} // ns io -} // ns storage -} // ns osrm +} // namespace tar +} // namespace storage +} // namespace osrm #endif diff --git a/include/storage/view_factory.hpp b/include/storage/view_factory.hpp index fb45b57d6..f8fe54212 100644 --- a/include/storage/view_factory.hpp +++ b/include/storage/view_factory.hpp @@ -379,7 +379,7 @@ inline auto make_filtered_graph_view(const SharedDataIndex &index, return util::FilteredGraphView({node_list, edge_list}, edge_filter); } -} -} +} // namespace storage +} // namespace osrm #endif diff --git a/include/updater/csv_file_parser.hpp b/include/updater/csv_file_parser.hpp index 1d746cdc0..c9841798e 100644 --- a/include/updater/csv_file_parser.hpp +++ b/include/updater/csv_file_parser.hpp @@ -48,18 +48,16 @@ template struct CSVFilesParser { tbb::spin_mutex mutex; std::vector> lookup; - tbb::parallel_for(std::size_t{0}, - csv_filenames.size(), - [&](const std::size_t idx) { - auto local = ParseCSVFile(csv_filenames[idx], start_index + idx); + tbb::parallel_for(std::size_t{0}, csv_filenames.size(), [&](const std::size_t idx) { + auto local = ParseCSVFile(csv_filenames[idx], start_index + idx); - { // Merge local CSV results into a flat global vector - tbb::spin_mutex::scoped_lock _{mutex}; - lookup.insert(end(lookup), - std::make_move_iterator(begin(local)), - std::make_move_iterator(end(local))); - } - }); + { // Merge local CSV results into a flat global vector + tbb::spin_mutex::scoped_lock _{mutex}; + lookup.insert(end(lookup), + std::make_move_iterator(begin(local)), + std::make_move_iterator(end(local))); + } + }); // With flattened map-ish view of all the files, make a stable sort on key and source // and unique them on key to keep only the value with the largest file index @@ -140,7 +138,7 @@ template struct CSVFilesParser const KeyRule key_rule; const ValueRule value_rule; }; -} -} +} // namespace updater +} // namespace osrm #endif diff --git a/include/updater/csv_source.hpp b/include/updater/csv_source.hpp index 08c8d22bb..8fa00941a 100644 --- a/include/updater/csv_source.hpp +++ b/include/updater/csv_source.hpp @@ -11,8 +11,8 @@ namespace csv { SegmentLookupTable readSegmentValues(const std::vector &paths); TurnLookupTable readTurnValues(const std::vector &paths); -} -} -} +} // namespace csv +} // namespace updater +} // namespace osrm #endif diff --git a/include/updater/source.hpp b/include/updater/source.hpp index d03cc76bf..58a19e080 100644 --- a/include/updater/source.hpp +++ b/include/updater/source.hpp @@ -88,7 +88,7 @@ struct PenaltySource final using SegmentLookupTable = LookupTable; using TurnLookupTable = LookupTable; -} -} +} // namespace updater +} // namespace osrm #endif diff --git a/include/updater/updater.hpp b/include/updater/updater.hpp index 565b293cb..e5610c6bd 100644 --- a/include/updater/updater.hpp +++ b/include/updater/updater.hpp @@ -37,7 +37,7 @@ class Updater private: UpdaterConfig config; }; -} -} +} // namespace updater +} // namespace osrm #endif diff --git a/include/updater/updater_config.hpp b/include/updater/updater_config.hpp index 64306a609..30c2cec9f 100644 --- a/include/updater/updater_config.hpp +++ b/include/updater/updater_config.hpp @@ -73,7 +73,7 @@ struct UpdaterConfig final : storage::IOConfig std::vector turn_penalty_lookup_paths; std::string tz_file_path; }; -} -} +} // namespace updater +} // namespace osrm #endif // EXTRACTOR_OPTIONS_HPP diff --git a/include/util/alias.hpp b/include/util/alias.hpp index 43b007a19..23f614298 100644 --- a/include/util/alias.hpp +++ b/include/util/alias.hpp @@ -130,7 +130,7 @@ inline std::ostream &operator<<(std::ostream &stream, const Alias &in { return stream << inst.__value; } -} +} // namespace osrm namespace std { @@ -143,6 +143,6 @@ template struct hash> return std::hash()(static_cast(s)); } }; -} +} // namespace std #endif // OSRM_ALIAS_HPP diff --git a/include/util/bit_range.hpp b/include/util/bit_range.hpp index f1f1d4ba9..6d7ffcae4 100644 --- a/include/util/bit_range.hpp +++ b/include/util/bit_range.hpp @@ -39,7 +39,7 @@ inline std::size_t countOnes(unsigned int value) { return __builtin_popcount(val inline std::size_t countOnes(unsigned long value) { return __builtin_popcountl(value); } inline std::size_t countOnes(unsigned long long value) { return __builtin_popcountll(value); } #endif -} +} // namespace detail // Investigate if we can replace this with // http://www.boost.org/doc/libs/1_64_0/libs/dynamic_bitset/dynamic_bitset.html @@ -93,7 +93,7 @@ template auto makeBitRange(const T value) { return boost::make_iterator_range(BitIterator{value}, BitIterator{}); } -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/cast.hpp b/include/util/cast.hpp index 0b4468d75..1a420fa3a 100644 --- a/include/util/cast.hpp +++ b/include/util/cast.hpp @@ -42,8 +42,8 @@ template inline std::string to_string_with_preci return rv; } -} -} -} +} // namespace cast +} // namespace util +} // namespace osrm #endif // CAST_HPP diff --git a/include/util/concurrent_id_map.hpp b/include/util/concurrent_id_map.hpp index bd15f44d8..f5fbb4374 100644 --- a/include/util/concurrent_id_map.hpp +++ b/include/util/concurrent_id_map.hpp @@ -74,7 +74,7 @@ struct ConcurrentIDMap } }; -} // util -} // osrm +} // namespace util +} // namespace osrm #endif // CONCURRENT_ID_MAP_HPP diff --git a/include/util/conditional_restrictions.hpp b/include/util/conditional_restrictions.hpp index 18c0463e6..e18379698 100644 --- a/include/util/conditional_restrictions.hpp +++ b/include/util/conditional_restrictions.hpp @@ -21,7 +21,7 @@ struct ConditionalRestriction std::vector ParseConditionalRestrictions(const std::string &str); -} // util -} // osrm +} // namespace util +} // namespace osrm #endif // OSRM_CONDITIONAL_RESTRICTIONS_HPP diff --git a/include/util/connectivity_checksum.hpp b/include/util/connectivity_checksum.hpp index a39a98064..25893a8d2 100644 --- a/include/util/connectivity_checksum.hpp +++ b/include/util/connectivity_checksum.hpp @@ -84,7 +84,7 @@ struct ConnectivityChecksum std::size_t byte_number; unsigned char bit_number; }; -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/container.hpp b/include/util/container.hpp index 91b1cccb1..68ab7e526 100644 --- a/include/util/container.hpp +++ b/include/util/container.hpp @@ -16,7 +16,7 @@ void append_to_container(Container &&container, T value, Args &&... args) container.emplace_back(value); append_to_container(std::forward(container), std::forward(args)...); } -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/coordinate.hpp b/include/util/coordinate.hpp index 6f2096703..bb03c9107 100644 --- a/include/util/coordinate.hpp +++ b/include/util/coordinate.hpp @@ -60,7 +60,7 @@ struct unsafelatitude struct unsafelongitude { }; -} +} // namespace tag // Internal lon/lat types - assumed to be range safe using FixedLatitude = Alias; @@ -265,7 +265,7 @@ inline Coordinate::Coordinate(const FloatCoordinate &other) : Coordinate(toFixed(other.lon), toFixed(other.lat)) { } -} -} +} // namespace util +} // namespace osrm #endif /* COORDINATE_HPP_ */ diff --git a/include/util/coordinate_calculation.hpp b/include/util/coordinate_calculation.hpp index c946842a2..21719e26d 100644 --- a/include/util/coordinate_calculation.hpp +++ b/include/util/coordinate_calculation.hpp @@ -38,7 +38,7 @@ inline double radToDeg(const double radian) using namespace boost::math::constants; return radian * (180.0 * (1. / pi())); } -} +} // namespace detail //! Takes the squared euclidean distance of the input coordinates. Does not return meters! std::uint64_t squaredEuclideanDistance(const Coordinate lhs, const Coordinate rhs); @@ -224,7 +224,7 @@ double findClosestDistance(const iterator_type lhs_begin, double current_min = std::numeric_limits::max(); const auto compute_minimum_distance_in_rhs = [¤t_min, rhs_begin, rhs_end]( - const Coordinate coordinate) { + const Coordinate coordinate) { current_min = std::min(current_min, findClosestDistance(coordinate, rhs_begin, rhs_end)); return false; }; @@ -320,10 +320,9 @@ std::pair leastSquareRegression(const iterator_type begi end, 0., [&](const auto sum_so_far, const auto current_coordinate) { - return sum_so_far + - (extract_lon(current_coordinate) - mean_lon) * - (extract_lat(current_coordinate) - mean_lat) / - (sample_variance_lon * sample_variance_lat); + return sum_so_far + (extract_lon(current_coordinate) - mean_lon) * + (extract_lat(current_coordinate) - mean_lat) / + (sample_variance_lon * sample_variance_lat); }) / (number_of_coordinates - 1); @@ -383,8 +382,8 @@ bool areParallel(const iterator_type lhs_begin, double computeArea(const std::vector &polygon); -} // ns coordinate_calculation -} // ns util -} // ns osrm +} // namespace coordinate_calculation +} // namespace util +} // namespace osrm #endif // COORDINATE_CALCULATION diff --git a/include/util/deallocating_vector.hpp b/include/util/deallocating_vector.hpp index 1a160271b..afc357f6f 100644 --- a/include/util/deallocating_vector.hpp +++ b/include/util/deallocating_vector.hpp @@ -273,7 +273,9 @@ template 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) { @@ -350,7 +352,7 @@ template void swap(DeallocatingVector &lhs, DeallocatingVector(road.lane_data_id) << "}"; return out; } -} +} // namespace guidance namespace extractor { @@ -95,7 +95,7 @@ inline std::ostream &operator<<(std::ostream &out, const IntersectionViewData &v << " angle: " << view.angle << " bearing: " << view.perceived_bearing << "}"; return out; } -} +} // namespace intersection namespace TurnLaneType { @@ -125,9 +125,9 @@ inline std::ostream &operator<<(std::ostream &out, const Mask lane_type) return out; } -} -} -} +} // namespace TurnLaneType +} // namespace extractor +} // namespace osrm namespace std { @@ -147,7 +147,7 @@ inline std::ostream &operator<<(std::ostream &out, return out; } -} +} // namespace std namespace osrm { @@ -186,8 +186,8 @@ inline std::ostream &operator<<(std::ostream &out, const LaneDataVector &turn_la return out; } -} -} +} // namespace lanes +} // namespace guidance namespace extractor { @@ -204,7 +204,7 @@ inline std::ostream &operator<<(std::ostream &out, const EdgeBasedEdge &edge) out << "}"; return out; } -} -} +} // namespace extractor +} // namespace osrm #endif /*OSRM_ENGINE_GUIDANCE_DEBUG_HPP_*/ diff --git a/include/util/dist_table_wrapper.hpp b/include/util/dist_table_wrapper.hpp index 56c750244..8344a3178 100644 --- a/include/util/dist_table_wrapper.hpp +++ b/include/util/dist_table_wrapper.hpp @@ -77,7 +77,7 @@ template class DistTableWrapper std::vector table_; const std::size_t number_of_nodes_; }; -} -} +} // namespace util +} // namespace osrm #endif // DIST_TABLE_WRAPPER_H diff --git a/include/util/dynamic_graph.hpp b/include/util/dynamic_graph.hpp index 2a22aeae7..5cee5b3e0 100644 --- a/include/util/dynamic_graph.hpp +++ b/include/util/dynamic_graph.hpp @@ -41,7 +41,7 @@ template struct DynamicEdge NodeIterator target; EdgeDataT data; }; -} +} // namespace detail template class DynamicGraph { @@ -468,7 +468,7 @@ template class DynamicGraph std::vector node_array; DeallocatingVector edge_list; }; -} -} +} // namespace util +} // namespace osrm #endif // DYNAMICGRAPH_HPP diff --git a/include/util/exception.hpp b/include/util/exception.hpp index 26e219f8e..871c4ba27 100644 --- a/include/util/exception.hpp +++ b/include/util/exception.hpp @@ -123,7 +123,7 @@ class RuntimeError : public exception return result; } }; -} -} +} // namespace util +} // namespace osrm #endif /* OSRM_EXCEPTION_HPP */ diff --git a/include/util/exclude_flag.hpp b/include/util/exclude_flag.hpp index ffec32c80..373faeb90 100644 --- a/include/util/exclude_flag.hpp +++ b/include/util/exclude_flag.hpp @@ -29,7 +29,7 @@ excludeFlagsToNodeFilter(const NodeID number_of_nodes, } return filters; } -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/filtered_graph.hpp b/include/util/filtered_graph.hpp index c4df051d0..3efdf7b9b 100644 --- a/include/util/filtered_graph.hpp +++ b/include/util/filtered_graph.hpp @@ -153,13 +153,13 @@ class FilteredGraphImpl, Ownership> Graph graph; Vector edge_filter; }; -} +} // namespace detail template using FilteredGraphContainer = detail::FilteredGraphImpl; template using FilteredGraphView = detail::FilteredGraphImpl; -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/filtered_integer_range.hpp b/include/util/filtered_integer_range.hpp index dd3f61b3d..ec0ac596b 100644 --- a/include/util/filtered_integer_range.hpp +++ b/include/util/filtered_integer_range.hpp @@ -95,7 +95,7 @@ filtered_irange(const Integer first, { return filtered_range(first, last, filter); } -} -} +} // namespace util +} // namespace osrm #endif // INTEGER_RANGE_HPP diff --git a/include/util/fingerprint.hpp b/include/util/fingerprint.hpp index 1c99a3a6b..14a9b4b2b 100644 --- a/include/util/fingerprint.hpp +++ b/include/util/fingerprint.hpp @@ -36,7 +36,7 @@ struct FingerPrint static_assert(sizeof(FingerPrint) == 8, "FingerPrint has unexpected size"); static_assert(std::is_trivial::value, "FingerPrint needs to be trivial."); static_assert(std::is_pod::value, "FingerPrint needs to be a POD."); -} -} +} // namespace util +} // namespace osrm #endif /* FingerPrint_H */ diff --git a/include/util/for_each_range.hpp b/include/util/for_each_range.hpp index 01f29e781..6df81b4da 100644 --- a/include/util/for_each_range.hpp +++ b/include/util/for_each_range.hpp @@ -20,7 +20,7 @@ template void for_each_range(Iter begin, Iter end f(begin_range, iter); } } -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/geojson_validation.hpp b/include/util/geojson_validation.hpp index 97fcbc807..40b986df1 100644 --- a/include/util/geojson_validation.hpp +++ b/include/util/geojson_validation.hpp @@ -77,6 +77,6 @@ inline void validateFeature(const rapidjson::Value &feature) if (coord_array.Empty()) throw osrm::util::exception("Feature geometry coordinates member is empty."); } -} -} +} // namespace util +} // namespace osrm #endif // OSRM_GEOJSON_VALIDATION_HPP diff --git a/include/util/graph_traits.hpp b/include/util/graph_traits.hpp index 419e6e276..31edfadf1 100644 --- a/include/util/graph_traits.hpp +++ b/include/util/graph_traits.hpp @@ -49,8 +49,8 @@ struct HasFirstEdgeMember().first_edge { }; -} // ns traits -} // ns util -} // ns osrm +} // namespace traits +} // namespace util +} // namespace osrm #endif // STATIC_GRAPH_TRAITS_HPP diff --git a/include/util/graph_utils.hpp b/include/util/graph_utils.hpp index e135873ab..bb0bebf66 100644 --- a/include/util/graph_utils.hpp +++ b/include/util/graph_utils.hpp @@ -96,7 +96,7 @@ std::vector directedEdgesFromCompressed(const std::vector:: -operator()(const ::osrm::util::guidance::BearingClass &bearing_class) const +inline size_t hash<::osrm::util::guidance::BearingClass>::operator()( + const ::osrm::util::guidance::BearingClass &bearing_class) const { return boost::hash_value(bearing_class.available_bearings); } diff --git a/include/util/guidance/entry_class.hpp b/include/util/guidance/entry_class.hpp index 458303644..6d6838e27 100644 --- a/include/util/guidance/entry_class.hpp +++ b/include/util/guidance/entry_class.hpp @@ -72,7 +72,7 @@ static_assert(std::is_trivially_copyable::value, #endif } // namespace guidance -} // namespace utilr +} // namespace util constexpr const util::guidance::EntryClass EMPTY_ENTRY_CLASS{}; } // namespace osrm @@ -80,8 +80,8 @@ constexpr const util::guidance::EntryClass EMPTY_ENTRY_CLASS{}; // make Entry Class hasbable namespace std { -inline size_t hash<::osrm::util::guidance::EntryClass>:: -operator()(const ::osrm::util::guidance::EntryClass &entry_class) const +inline size_t hash<::osrm::util::guidance::EntryClass>::operator()( + const ::osrm::util::guidance::EntryClass &entry_class) const { return hash<::osrm::util::guidance::EntryClass::FlagBaseType>()( entry_class.enabled_entries_flags); diff --git a/include/util/hilbert_value.hpp b/include/util/hilbert_value.hpp index c5f9245b0..7521cbd92 100644 --- a/include/util/hilbert_value.hpp +++ b/include/util/hilbert_value.hpp @@ -69,7 +69,7 @@ inline std::uint64_t GetHilbertCode(const Coordinate &coordinate) static_cast(90 * COORDINATE_PRECISION); return HilbertToLinear(x, y); } -} -} +} // namespace util +} // namespace osrm #endif /* HILBERT_VALUE_HPP */ diff --git a/include/util/ieee754.hpp b/include/util/ieee754.hpp index 16f37e15d..a6112ec2f 100644 --- a/include/util/ieee754.hpp +++ b/include/util/ieee754.hpp @@ -52,7 +52,8 @@ struct DiyFp DiyFp(double d) { - union { + union + { double d; uint64_t u64; } u = {d}; @@ -247,8 +248,9 @@ inline DiyFp GetCachedPower(int e, int *K) inline void GrisuRound(char *buffer, int len, uint64_t delta, uint64_t rest, uint64_t ten_kappa, uint64_t wp_w) { - while (rest < wp_w && delta - rest >= ten_kappa && (rest + ten_kappa < wp_w || /// closer - wp_w - rest > rest + ten_kappa - wp_w)) + while (rest < wp_w && delta - rest >= ten_kappa && + (rest + ten_kappa < wp_w || /// closer + wp_w - rest > rest + ten_kappa - wp_w)) { buffer[len - 1]--; rest += ten_kappa; diff --git a/include/util/indexed_data.hpp b/include/util/indexed_data.hpp index 8df3c350a..475c68a96 100644 --- a/include/util/indexed_data.hpp +++ b/include/util/indexed_data.hpp @@ -69,9 +69,7 @@ template struct VariableGroupBlock inline void var_advance(DataIterator &data, DataIterator &length, std::uint32_t byte_length) const { - if (byte_length == 0) - { - } + if (byte_length == 0) {} else if (byte_length == 1) { data += static_cast(*length++); @@ -331,6 +329,9 @@ template struct Indexe // Return value at the given index ResultType at(std::uint32_t index) const { + if (values.empty()) + return ResultType(); + // Get block external ad internal indices const BlocksNumberType block_idx = index / (BLOCK_SIZE + 1); const std::uint32_t internal_idx = index % (BLOCK_SIZE + 1); diff --git a/include/util/integer_range.hpp b/include/util/integer_range.hpp index befaa3275..c8f56b8f7 100644 --- a/include/util/integer_range.hpp +++ b/include/util/integer_range.hpp @@ -90,7 +90,7 @@ irange(const Integer first, { return range(first, last); } -} -} +} // namespace util +} // namespace osrm #endif // INTEGER_RANGE_HPP diff --git a/include/util/json_deep_compare.hpp b/include/util/json_deep_compare.hpp index 9c202a527..53df4fdb3 100644 --- a/include/util/json_deep_compare.hpp +++ b/include/util/json_deep_compare.hpp @@ -40,8 +40,8 @@ struct Comparator bool is_same = lhs.value == rhs.value; if (!is_same) { - reason = lhs_path + " (= " + std::to_string(lhs.value) + ") != " + rhs_path + " (= " + - std::to_string(rhs.value) + ")"; + reason = lhs_path + " (= " + std::to_string(lhs.value) + ") != " + rhs_path + + " (= " + std::to_string(rhs.value) + ")"; } return is_same; } @@ -158,8 +158,8 @@ inline bool compare(const Value &reference, const Value &result, std::string &re return mapbox::util::apply_visitor( Comparator(reason, "reference", "result"), reference, result); } -} -} -} +} // namespace json +} // namespace util +} // namespace osrm #endif diff --git a/include/util/log.hpp b/include/util/log.hpp index d4b5f9c47..be3650961 100644 --- a/include/util/log.hpp +++ b/include/util/log.hpp @@ -101,7 +101,7 @@ class UnbufferedLog : public Log public: UnbufferedLog(LogLevel level_ = logINFO); }; -} -} +} // namespace util +} // namespace osrm #endif /* LOG_HPP */ diff --git a/include/util/lua_util.hpp b/include/util/lua_util.hpp index b5b64aada..0504834fd 100644 --- a/include/util/lua_util.hpp +++ b/include/util/lua_util.hpp @@ -1,7 +1,8 @@ #ifndef LUA_UTIL_HPP #define LUA_UTIL_HPP -extern "C" { +extern "C" +{ #include #include #include @@ -27,7 +28,7 @@ inline void luaAddScriptFolderToLoadPath(lua_State *lua_state, const char *file_ const std::string lua_code = "package.path = \"" + folder + "/?.lua;\" .. package.path"; luaL_dostring(lua_state, lua_code.c_str()); } -} -} +} // namespace util +} // namespace osrm #endif // LUA_UTIL_HPP diff --git a/include/util/matrix_graph_wrapper.hpp b/include/util/matrix_graph_wrapper.hpp index 7889a6301..189ddfeea 100644 --- a/include/util/matrix_graph_wrapper.hpp +++ b/include/util/matrix_graph_wrapper.hpp @@ -46,7 +46,7 @@ template class MatrixGraphWrapper const std::vector table_; const std::size_t number_of_nodes_; }; -} -} +} // namespace util +} // namespace osrm #endif // MATRIX_GRAPH_WRAPPER_H diff --git a/include/util/meminfo.hpp b/include/util/meminfo.hpp index 1fe9d4d28..3409a4380 100644 --- a/include/util/meminfo.hpp +++ b/include/util/meminfo.hpp @@ -28,7 +28,7 @@ inline void DumpMemoryStats() util::Log() << "RAM: peak bytes used: "; #endif // _WIN32 } -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/mmap_file.hpp b/include/util/mmap_file.hpp index d55203d72..01e829b71 100644 --- a/include/util/mmap_file.hpp +++ b/include/util/mmap_file.hpp @@ -60,7 +60,7 @@ util::vector_view mmapFile(const boost::filesystem::path &file, SOURCE_REF); } } -} +} // namespace detail template util::vector_view mmapFile(const boost::filesystem::path &file, @@ -83,7 +83,7 @@ util::vector_view mmapFile(const boost::filesystem::path &file, { return detail::mmapFile(file, mmap_container, size); } -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/mmap_tar.hpp b/include/util/mmap_tar.hpp index b9129ba87..26f223159 100644 --- a/include/util/mmap_tar.hpp +++ b/include/util/mmap_tar.hpp @@ -38,7 +38,7 @@ inline DataMap mmapTarFile(const boost::filesystem::path &path, return map; } -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/msb.hpp b/include/util/msb.hpp index 37e3a31a1..96e88d987 100644 --- a/include/util/msb.hpp +++ b/include/util/msb.hpp @@ -47,7 +47,7 @@ inline std::size_t msb(unsigned int v) return MSB_INDEX - __builtin_clz(v); } #endif -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/node_based_graph.hpp b/include/util/node_based_graph.hpp index 1c31f8f7d..ba3126369 100644 --- a/include/util/node_based_graph.hpp +++ b/include/util/node_based_graph.hpp @@ -97,7 +97,7 @@ NodeBasedDynamicGraphFromEdges(NodeID number_of_nodes, return NodeBasedDynamicGraph(number_of_nodes, edges_list); } -} -} +} // namespace util +} // namespace osrm #endif // NODE_BASED_GRAPH_HPP diff --git a/include/util/opening_hours.hpp b/include/util/opening_hours.hpp index 63b82c453..e506bd0fa 100644 --- a/include/util/opening_hours.hpp +++ b/include/util/opening_hours.hpp @@ -223,7 +223,7 @@ std::vector ParseOpeningHours(const std::string &str); bool CheckOpeningHours(const std::vector &input, const struct tm &time); -} // util -} // osrm +} // namespace util +} // namespace osrm #endif // OSRM_OPENING_HOURS_HPP diff --git a/include/util/packed_vector.hpp b/include/util/packed_vector.hpp index 94ee4f19f..8874ed40c 100644 --- a/include/util/packed_vector.hpp +++ b/include/util/packed_vector.hpp @@ -37,7 +37,7 @@ template inline void write(storage::tar::FileWriter &writer, const std::string &name, const detail::PackedVector &vec); -} +} // namespace serialization namespace detail { @@ -546,13 +546,13 @@ template class Pack util::ViewOrVector vec; std::uint64_t num_elements = 0; }; -} +} // namespace detail template using PackedVector = detail::PackedVector; template using PackedVectorView = detail::PackedVector; -} -} +} // namespace util +} // namespace osrm #endif /* PACKED_VECTOR_HPP */ diff --git a/include/util/percent.hpp b/include/util/percent.hpp index 1ec1f2c13..f812558e7 100644 --- a/include/util/percent.hpp +++ b/include/util/percent.hpp @@ -87,7 +87,7 @@ class Percent } } }; -} -} +} // namespace util +} // namespace osrm #endif // PERCENT_HPP diff --git a/include/util/query_heap.hpp b/include/util/query_heap.hpp index f4b9e626a..4030120cb 100644 --- a/include/util/query_heap.hpp +++ b/include/util/query_heap.hpp @@ -328,7 +328,7 @@ class QueryHeap HeapContainer heap; IndexStorage node_index; }; -} -} +} // namespace util +} // namespace osrm #endif // OSRM_UTIL_QUERY_HEAP_HPP diff --git a/include/util/range_table.hpp b/include/util/range_table.hpp index fcb732b24..ef3745894 100644 --- a/include/util/range_table.hpp +++ b/include/util/range_table.hpp @@ -33,7 +33,7 @@ template void read(storage::tar::FileReader &reader, const std::string &name, util::RangeTable &table); -} +} // namespace serialization /** * Stores adjacent ranges in a compressed format. @@ -209,7 +209,7 @@ unsigned RangeTable::PrefixSumAtIndex(int index, const Bl return sum; } -} -} +} // namespace util +} // namespace osrm #endif // RANGE_TABLE_HPP diff --git a/include/util/rectangle.hpp b/include/util/rectangle.hpp index 2b2fb83ce..eb53396d1 100644 --- a/include/util/rectangle.hpp +++ b/include/util/rectangle.hpp @@ -171,7 +171,7 @@ struct RectangleInt2D max_lat != FixedLatitude{std::numeric_limits::min()}; } }; -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/serialization.hpp b/include/util/serialization.hpp index 6245c43f0..c4205e67d 100644 --- a/include/util/serialization.hpp +++ b/include/util/serialization.hpp @@ -143,8 +143,8 @@ void write(storage::tar::FileWriter &writer, storage::serialization::write( writer, name + "/search_tree_level_starts", rtree.m_tree_level_starts); } -} -} -} +} // namespace serialization +} // namespace util +} // namespace osrm #endif diff --git a/include/util/static_assert.hpp b/include/util/static_assert.hpp index 25484a57f..985324c96 100644 --- a/include/util/static_assert.hpp +++ b/include/util/static_assert.hpp @@ -20,7 +20,7 @@ template inline void static_assert_iter_categor static_assert(std::is_base_of::value, ""); } -} // ns util -} // ns osrm +} // namespace util +} // namespace osrm #endif // OSRM_STATIC_ASSERT_HPP diff --git a/include/util/static_graph.hpp b/include/util/static_graph.hpp index 6092dd955..a38ba68d1 100644 --- a/include/util/static_graph.hpp +++ b/include/util/static_graph.hpp @@ -36,7 +36,7 @@ template void write(storage::tar::FileWriter &writer, const std::string &name, const StaticGraph &graph); -} +} // namespace serialization namespace static_graph_details { diff --git a/include/util/static_rtree.hpp b/include/util/static_rtree.hpp index b0a3c76e3..6fbd59738 100644 --- a/include/util/static_rtree.hpp +++ b/include/util/static_rtree.hpp @@ -64,7 +64,7 @@ inline void write(storage::tar::FileWriter &writer, const std::string &name, const util::StaticRTree &rtree); -} +} // namespace serialization /*** * Static RTree for serving nearest neighbour queries @@ -559,11 +559,12 @@ class StaticRTree std::vector Nearest(const Coordinate input_coordinate, const std::size_t max_results) const { - return Nearest(input_coordinate, - [](const CandidateSegment &) { return std::make_pair(true, true); }, - [max_results](const std::size_t num_results, const CandidateSegment &) { - return num_results >= max_results; - }); + return Nearest( + input_coordinate, + [](const CandidateSegment &) { return std::make_pair(true, true); }, + [max_results](const std::size_t num_results, const CandidateSegment &) { + return num_results >= max_results; + }); } // Override filter and terminator for the desired behaviour. @@ -773,7 +774,7 @@ class StaticRTree //[2] "Nearest Neighbor Queries", N. Roussopulos et al; 1995; DOI: 10.1145/223784.223794 //[3] "Distance Browsing in Spatial Databases"; G. Hjaltason, H. Samet; 1999; ACM Trans. DB Sys // Vol.24 No.2, pp.265-318 -} -} +} // namespace util +} // namespace osrm #endif // STATIC_RTREE_HPP diff --git a/include/util/std_hash.hpp b/include/util/std_hash.hpp index b456ab1ca..b4010f439 100644 --- a/include/util/std_hash.hpp +++ b/include/util/std_hash.hpp @@ -36,6 +36,6 @@ template struct hash> return hash_val(pair.first, pair.second); } }; -} +} // namespace std #endif // STD_HASH_HPP diff --git a/include/util/string_util.hpp b/include/util/string_util.hpp index 35a70762e..3235d4915 100644 --- a/include/util/string_util.hpp +++ b/include/util/string_util.hpp @@ -125,7 +125,7 @@ inline std::size_t URIDecode(const std::string &input, std::string &output) } inline std::size_t URIDecodeInPlace(std::string &URI) { return URIDecode(URI, URI); } -} -} +} // namespace util +} // namespace osrm #endif // STRING_UTIL_HPP diff --git a/include/util/timed_histogram.hpp b/include/util/timed_histogram.hpp index 7653ebe1f..1e0a8bf83 100644 --- a/include/util/timed_histogram.hpp +++ b/include/util/timed_histogram.hpp @@ -88,7 +88,7 @@ template class std::vector frame_offsets; std::vector frame_counters; }; -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/timezones.hpp b/include/util/timezones.hpp index a00872064..fd7c85369 100644 --- a/include/util/timezones.hpp +++ b/include/util/timezones.hpp @@ -44,7 +44,7 @@ class Timezoner rtree_t rtree; std::vector local_times; }; -} -} +} // namespace updater +} // namespace osrm #endif diff --git a/include/util/timing_util.hpp b/include/util/timing_util.hpp index c248559df..29e9ba8d5 100644 --- a/include/util/timing_util.hpp +++ b/include/util/timing_util.hpp @@ -23,7 +23,7 @@ namespace util std::chrono::duration_cast(_X##_stop - _X##_start).count()) #define TIMER_MIN(_X) \ std::chrono::duration_cast(_X##_stop - _X##_start).count() -} -} +} // namespace util +} // namespace osrm #endif // TIMING_UTIL_HPP diff --git a/include/util/to_osm_link.hpp b/include/util/to_osm_link.hpp index ee388a684..0b583041e 100644 --- a/include/util/to_osm_link.hpp +++ b/include/util/to_osm_link.hpp @@ -25,7 +25,7 @@ inline std::string toOSMLink(const util::Coordinate &c) << toFloating(c.lat) << "&mlon=" << toFloating(c.lon); return link.str(); } -} -} +} // namespace util +} // namespace osrm #endif diff --git a/include/util/trigonometry_table.hpp b/include/util/trigonometry_table.hpp index 86cca41ce..c268d676f 100644 --- a/include/util/trigonometry_table.hpp +++ b/include/util/trigonometry_table.hpp @@ -431,7 +431,7 @@ inline double atan2_lookup(double y, double x) } return angle; } -} -} +} // namespace util +} // namespace osrm #endif // TRIGONOMETRY_TABLE_HPP diff --git a/include/util/typedefs.hpp b/include/util/typedefs.hpp index f29406d8b..7807b4baf 100644 --- a/include/util/typedefs.hpp +++ b/include/util/typedefs.hpp @@ -48,7 +48,7 @@ struct osm_way_id struct duplicated_node { }; -} +} // namespace tag using OSMNodeID = osrm::Alias; static_assert(std::is_pod(), "OSMNodeID is not a valid alias"); using OSMWayID = osrm::Alias; diff --git a/include/util/vector_tile.hpp b/include/util/vector_tile.hpp index d3d4978b1..9d4ae6e36 100644 --- a/include/util/vector_tile.hpp +++ b/include/util/vector_tile.hpp @@ -12,7 +12,7 @@ namespace vector_tile // Vector tiles are 4096 virtual pixels on each side const constexpr double EXTENT = 4096.0; const constexpr double BUFFER = 128.0; -} -} -} +} // namespace vector_tile +} // namespace util +} // namespace osrm #endif diff --git a/include/util/vector_view.hpp b/include/util/vector_view.hpp index 288029a70..3d9a2e2c1 100644 --- a/include/util/vector_view.hpp +++ b/include/util/vector_view.hpp @@ -268,7 +268,7 @@ struct is_view_or_vector std::is_same, VectorT>::value> { }; -} -} +} // namespace util +} // namespace osrm #endif // SHARED_MEMORY_VECTOR_WRAPPER_HPP diff --git a/include/util/viewport.hpp b/include/util/viewport.hpp index 211aa5745..9ff1c84c7 100644 --- a/include/util/viewport.hpp +++ b/include/util/viewport.hpp @@ -26,7 +26,7 @@ static constexpr unsigned MIN_ZOOM = 1; static constexpr double VIEWPORT_WIDTH = 8 * web_mercator::TILE_SIZE; static constexpr double VIEWPORT_HEIGHT = 5 * web_mercator::TILE_SIZE; static double INV_LOG_2 = 1. / std::log(2); -} +} // namespace detail inline unsigned getFittedZoom(util::Coordinate south_west, util::Coordinate north_east) { @@ -44,8 +44,8 @@ inline unsigned getFittedZoom(util::Coordinate south_west, util::Coordinate nort else return detail::MIN_ZOOM; } -} -} -} +} // namespace viewport +} // namespace util +} // namespace osrm #endif diff --git a/include/util/web_mercator.hpp b/include/util/web_mercator.hpp index 247e97e07..bb959a70d 100644 --- a/include/util/web_mercator.hpp +++ b/include/util/web_mercator.hpp @@ -22,7 +22,7 @@ const constexpr double MAXEXTENT = EARTH_RADIUS_WGS84 * boost::math::constants:: // ^ math functions are not constexpr since they have side-effects (setting errno) :( const constexpr double EPSG3857_MAX_LATITUDE = 85.051128779806592378; // 90(4*atan(exp(pi))/pi-1) const constexpr double MAX_LONGITUDE = 180.0; -} +} // namespace detail // Converts projected mercator degrees to PX const constexpr double DEGREE_TO_PX = detail::MAXEXTENT / 180.0; @@ -169,8 +169,8 @@ inline void xyzToMercator( maxx = static_cast(clamp(util::FloatLongitude{maxx})) * DEGREE_TO_PX; maxy = latToY(util::FloatLatitude{maxy}) * DEGREE_TO_PX; } -} -} -} +} // namespace web_mercator +} // namespace util +} // namespace osrm #endif diff --git a/include/util/xor_fast_hash.hpp b/include/util/xor_fast_hash.hpp index 0f2f3ba78..97a83fcd4 100644 --- a/include/util/xor_fast_hash.hpp +++ b/include/util/xor_fast_hash.hpp @@ -65,7 +65,7 @@ template class XORFastHash return table1[lsb] ^ table2[msb]; } }; -} -} +} // namespace util +} // namespace osrm #endif // XOR_FAST_HASH_HPP diff --git a/include/util/xor_fast_hash_storage.hpp b/include/util/xor_fast_hash_storage.hpp index 6d2d76baa..4746a5891 100644 --- a/include/util/xor_fast_hash_storage.hpp +++ b/include/util/xor_fast_hash_storage.hpp @@ -78,7 +78,7 @@ class XORFastHashStorage XORFastHash fast_hasher; unsigned current_timestamp; }; -} -} +} // namespace util +} // namespace osrm #endif // XOR_FAST_HASH_STORAGE_HPP diff --git a/scripts/format.sh b/scripts/format.sh index 6b14688dc..cd462756d 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -19,18 +19,18 @@ elif [[ ${OS} = "Darwin" ]] ; then fi # Discover clang-format -if type clang-format-3.8 2> /dev/null ; then - CLANG_FORMAT=clang-format-3.8 +if type clang-format-10.0.0 2> /dev/null ; then + CLANG_FORMAT=clang-format-10.0.0 elif type clang-format 2> /dev/null ; then # Clang format found, but need to check version CLANG_FORMAT=clang-format V=$(clang-format --version) - if [[ $V != *3.8* ]] ; then - echo "clang-format is not 3.8 (returned ${V})" + if [[ $V != *10.0* ]] ; then + echo "clang-format is not 10.0 (returned ${V})" #exit 1 fi else - echo "No appropriate clang-format found (expected clang-format-3.8, or clang-format)" + echo "No appropriate clang-format found (expected clang-format-10.0.0, or clang-format)" exit 1 fi diff --git a/src/benchmarks/alias.cpp b/src/benchmarks/alias.cpp index b2a4ad1da..f8ca5dd12 100644 --- a/src/benchmarks/alias.cpp +++ b/src/benchmarks/alias.cpp @@ -20,7 +20,7 @@ struct interger_alias struct double_alias { }; -} +} // namespace tag int main(int, char **) { diff --git a/src/benchmarks/match.cpp b/src/benchmarks/match.cpp index 7c1b3608b..932820e88 100644 --- a/src/benchmarks/match.cpp +++ b/src/benchmarks/match.cpp @@ -18,7 +18,8 @@ #include -int main(int argc, const char *argv[]) try +int main(int argc, const char *argv[]) +try { if (argc < 2) { diff --git a/src/benchmarks/static_rtree.cpp b/src/benchmarks/static_rtree.cpp index 5b642498d..d40d6390e 100644 --- a/src/benchmarks/static_rtree.cpp +++ b/src/benchmarks/static_rtree.cpp @@ -74,8 +74,8 @@ void benchmark(BenchStaticRTree &rtree, unsigned num_queries) return rtree.Nearest(q, 10); }); } -} -} +} // namespace benchmarks +} // namespace osrm int main(int argc, char **argv) { diff --git a/src/contractor/contractor_search.cpp b/src/contractor/contractor_search.cpp index e010723b8..f138f86ea 100644 --- a/src/contractor/contractor_search.cpp +++ b/src/contractor/contractor_search.cpp @@ -45,7 +45,7 @@ void relaxNode(ContractorHeap &heap, } } } -} +} // namespace void search(ContractorHeap &heap, const ContractorGraph &graph, @@ -83,5 +83,5 @@ void search(ContractorHeap &heap, relaxNode(heap, graph, node, node_weight, forbidden_node); } } -} -} +} // namespace contractor +} // namespace osrm diff --git a/src/contractor/graph_contractor.cpp b/src/contractor/graph_contractor.cpp index 8615156dd..8315a57c5 100644 --- a/src/contractor/graph_contractor.cpp +++ b/src/contractor/graph_contractor.cpp @@ -560,7 +560,7 @@ bool IsNodeIndependent(const util::XORFastHash<> &hash, } return true; } -} +} // namespace std::vector contractGraph(ContractorGraph &graph, std::vector node_is_uncontracted_, diff --git a/src/customize/customizer.cpp b/src/customize/customizer.cpp index 7c96617a6..27b376733 100644 --- a/src/customize/customizer.cpp +++ b/src/customize/customizer.cpp @@ -118,7 +118,7 @@ std::vector customizeFilteredMetrics(const partitioner::MultiLevelEd return metrics; } -} +} // namespace int Customizer::Run(const CustomizationConfig &config) { @@ -191,5 +191,5 @@ int Customizer::Run(const CustomizationConfig &config) return 0; } -} // namespace customizer$ +} // namespace customizer } // namespace osrm diff --git a/src/engine/douglas_peucker.cpp b/src/engine/douglas_peucker.cpp index 9a7bd500b..424f94940 100644 --- a/src/engine/douglas_peucker.cpp +++ b/src/engine/douglas_peucker.cpp @@ -119,5 +119,5 @@ std::vector douglasPeucker(std::vector::cons return simplified_geometry; } -} // ns engine -} // ns osrm +} // namespace engine +} // namespace osrm diff --git a/src/engine/engine_config.cpp b/src/engine/engine_config.cpp index ac7723ba9..c227a9b8a 100644 --- a/src/engine/engine_config.cpp +++ b/src/engine/engine_config.cpp @@ -27,5 +27,5 @@ bool EngineConfig::IsValid() const storage_config.IsValid()) && limits_valid; } -} -} +} // namespace engine +} // namespace osrm diff --git a/src/engine/guidance/assemble_overview.cpp b/src/engine/guidance/assemble_overview.cpp index 8086ba1ee..75def77a0 100644 --- a/src/engine/guidance/assemble_overview.cpp +++ b/src/engine/guidance/assemble_overview.cpp @@ -39,7 +39,7 @@ unsigned calculateOverviewZoomLevel(const std::vector &leg_geometri return util::viewport::getFittedZoom(south_west, north_east); } -} +} // namespace std::vector assembleOverview(const std::vector &leg_geometries, const bool use_simplification) diff --git a/src/engine/guidance/assemble_steps.cpp b/src/engine/guidance/assemble_steps.cpp index 68fa4dc11..0184baf14 100644 --- a/src/engine/guidance/assemble_steps.cpp +++ b/src/engine/guidance/assemble_steps.cpp @@ -48,7 +48,7 @@ std::pair getArriveBearings(const LegGeometry &leg_geometry, return std::make_pair( std::round(util::coordinate_calculation::bearing(pre_turn_coordinate, turn_coordinate)), 0); } -} // ns detail -} // ns engine -} // ns guidance -} // ns detail +} // namespace detail +} // namespace guidance +} // namespace engine +} // namespace osrm diff --git a/src/engine/guidance/collapse_scenario_detection.cpp b/src/engine/guidance/collapse_scenario_detection.cpp index 27efe856d..ff29bb756 100644 --- a/src/engine/guidance/collapse_scenario_detection.cpp +++ b/src/engine/guidance/collapse_scenario_detection.cpp @@ -181,9 +181,10 @@ bool isUTurn(const RouteStepIterator step_prior_to_intersection, const auto only_allowed_turn = (numberOfAllowedTurns(*step_leaving_intersection) == 1) && noIntermediaryIntersections(*step_entering_intersection); - return collapsable || isLinkRoad(*step_prior_to_intersection, - *step_entering_intersection, - *step_leaving_intersection) || + return collapsable || + isLinkRoad(*step_prior_to_intersection, + *step_entering_intersection, + *step_leaving_intersection) || only_allowed_turn; } diff --git a/src/engine/guidance/post_processing.cpp b/src/engine/guidance/post_processing.cpp index 2a0546f64..b5a280472 100644 --- a/src/engine/guidance/post_processing.cpp +++ b/src/engine/guidance/post_processing.cpp @@ -706,8 +706,9 @@ void applyOverrides(const datafacade::BaseDataFacade &facade, << " direction was " << osrm::guidance::instructionModifierToString( step_to_update->maneuver.instruction.direction_modifier) - << " now " << osrm::guidance::instructionModifierToString( - maneuver_relation.direction) + << " now " + << osrm::guidance::instructionModifierToString( + maneuver_relation.direction) << std::endl; step_to_update->maneuver.instruction.direction_modifier = maneuver_relation.direction; diff --git a/src/engine/guidance/verbosity_reduction.cpp b/src/engine/guidance/verbosity_reduction.cpp index a021fd1a8..3351c853c 100644 --- a/src/engine/guidance/verbosity_reduction.cpp +++ b/src/engine/guidance/verbosity_reduction.cpp @@ -38,29 +38,30 @@ std::vector suppressShortNameSegments(std::vector steps) // suppresses name segments that announce already known names or announce a name that will be // only available for a very short time - const auto reduce_verbosity_if_possible = [suppress, can_be_extended_to]( - RouteStepIterator ¤t_turn_itr, RouteStepIterator &previous_turn_itr) { - if (haveSameName(*previous_turn_itr, *current_turn_itr)) - suppress(*previous_turn_itr, *current_turn_itr); - else - { - // remember the location of the name change so we can advance the previous turn - const auto location_of_name_change = current_turn_itr; - auto distance = current_turn_itr->distance; - // sum up all distances that can be relevant to the name change - while (can_be_extended_to(*(current_turn_itr + 1)) && - distance < NAME_SEGMENT_CUTOFF_LENGTH) - { - ++current_turn_itr; - distance += current_turn_itr->distance; - } - - if (distance < NAME_SEGMENT_CUTOFF_LENGTH) + const auto reduce_verbosity_if_possible = + [suppress, can_be_extended_to](RouteStepIterator ¤t_turn_itr, + RouteStepIterator &previous_turn_itr) { + if (haveSameName(*previous_turn_itr, *current_turn_itr)) suppress(*previous_turn_itr, *current_turn_itr); else - previous_turn_itr = location_of_name_change; - } - }; + { + // remember the location of the name change so we can advance the previous turn + const auto location_of_name_change = current_turn_itr; + auto distance = current_turn_itr->distance; + // sum up all distances that can be relevant to the name change + while (can_be_extended_to(*(current_turn_itr + 1)) && + distance < NAME_SEGMENT_CUTOFF_LENGTH) + { + ++current_turn_itr; + distance += current_turn_itr->distance; + } + + if (distance < NAME_SEGMENT_CUTOFF_LENGTH) + suppress(*previous_turn_itr, *current_turn_itr); + else + previous_turn_itr = location_of_name_change; + } + }; BOOST_ASSERT(!hasTurnType(steps.back()) && hasWaypointType(steps.back())); for (auto previous_turn_itr = steps.begin(), current_turn_itr = std::next(previous_turn_itr); diff --git a/src/engine/hint.cpp b/src/engine/hint.cpp index bdd782382..6bc246c9d 100644 --- a/src/engine/hint.cpp +++ b/src/engine/hint.cpp @@ -57,5 +57,5 @@ bool operator==(const Hint &lhs, const Hint &rhs) std::ostream &operator<<(std::ostream &out, const Hint &hint) { return out << hint.ToBase64(); } -} // ns engine -} // ns osrm +} // namespace engine +} // namespace osrm diff --git a/src/engine/plugins/match.cpp b/src/engine/plugins/match.cpp index 5650b6609..59d7fccda 100644 --- a/src/engine/plugins/match.cpp +++ b/src/engine/plugins/match.cpp @@ -207,7 +207,6 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, { return routing_algorithms::DEFAULT_GPS_PRECISION * RADIUS_MULTIPLIER; } - }); } @@ -314,6 +313,6 @@ Status MatchPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, return Status::Ok; } -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm diff --git a/src/engine/plugins/nearest.cpp b/src/engine/plugins/nearest.cpp index 41f3742d8..b01d66dc8 100644 --- a/src/engine/plugins/nearest.cpp +++ b/src/engine/plugins/nearest.cpp @@ -60,6 +60,6 @@ Status NearestPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms return Status::Ok; } -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm diff --git a/src/engine/plugins/table.cpp b/src/engine/plugins/table.cpp index 5b517ac17..82572f661 100644 --- a/src/engine/plugins/table.cpp +++ b/src/engine/plugins/table.cpp @@ -156,6 +156,6 @@ Status TablePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, return Status::Ok; } -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm diff --git a/src/engine/plugins/tile.cpp b/src/engine/plugins/tile.cpp index 9a46f1d0c..511d6edaa 100644 --- a/src/engine/plugins/tile.cpp +++ b/src/engine/plugins/tile.cpp @@ -1,6 +1,5 @@ #include "guidance/turn_instruction.hpp" -#include "engine/plugins/plugin_base.hpp" #include "engine/plugins/plugin_base.hpp" #include "engine/plugins/tile.hpp" @@ -661,7 +660,7 @@ void encodeVectorTile(const DataFacadeBase &facade, tile.serialize(pbf_buffer); } -} +} // namespace Status TilePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, const api::TileParameters ¶meters, @@ -697,6 +696,6 @@ Status TilePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, return Status::Ok; } -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm diff --git a/src/engine/plugins/trip.cpp b/src/engine/plugins/trip.cpp index 74a4452aa..d949fcb60 100644 --- a/src/engine/plugins/trip.cpp +++ b/src/engine/plugins/trip.cpp @@ -204,8 +204,9 @@ Status TripPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, } BOOST_ASSERT(phantom_node_pairs.size() == number_of_locations); - if (fixed_start && fixed_end && (source_id >= parameters.coordinates.size() || - destination_id >= parameters.coordinates.size())) + if (fixed_start && fixed_end && + (source_id >= parameters.coordinates.size() || + destination_id >= parameters.coordinates.size())) { return Error("InvalidValue", "Invalid source or destination value.", result); } @@ -278,6 +279,6 @@ Status TripPlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithms, return Status::Ok; } -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm diff --git a/src/engine/plugins/viaroute.cpp b/src/engine/plugins/viaroute.cpp index 9b0f3ebfc..a95d17810 100644 --- a/src/engine/plugins/viaroute.cpp +++ b/src/engine/plugins/viaroute.cpp @@ -183,6 +183,6 @@ Status ViaRoutePlugin::HandleRequest(const RoutingAlgorithmsInterface &algorithm return Status::Ok; } -} -} -} +} // namespace plugins +} // namespace engine +} // namespace osrm diff --git a/src/engine/polyline_compressor.cpp b/src/engine/polyline_compressor.cpp index eca177980..ca9a4f2a0 100644 --- a/src/engine/polyline_compressor.cpp +++ b/src/engine/polyline_compressor.cpp @@ -75,6 +75,6 @@ std::int32_t decode_polyline_integer(std::string::const_iterator &first, result = ((result & 1) == 1) ? ~(result >> 1) : (result >> 1); return static_cast(result); } -} -} -} +} // namespace detail +} // namespace engine +} // namespace osrm diff --git a/src/engine/routing_algorithms/alternative_path_ch.cpp b/src/engine/routing_algorithms/alternative_path_ch.cpp index 2efd6fe19..107e98ea9 100644 --- a/src/engine/routing_algorithms/alternative_path_ch.cpp +++ b/src/engine/routing_algorithms/alternative_path_ch.cpp @@ -558,7 +558,7 @@ bool viaNodeCandidatePassesTTest(SearchEngineData &engine_working_dat } return (upper_bound <= t_test_path_weight); } -} // anon. namespace +} // namespace InternalManyRoutesResult alternativePathSearch(SearchEngineData &engine_working_data, const DataFacade &facade, @@ -853,4 +853,4 @@ InternalManyRoutesResult alternativePathSearch(SearchEngineData &engi } // namespace routing_algorithms } // namespace engine -} // namespace osrm} +} // namespace osrm diff --git a/src/engine/routing_algorithms/many_to_many_mld.cpp b/src/engine/routing_algorithms/many_to_many_mld.cpp index bd41f7aba..ceb37f302 100644 --- a/src/engine/routing_algorithms/many_to_many_mld.cpp +++ b/src/engine/routing_algorithms/many_to_many_mld.cpp @@ -443,9 +443,8 @@ void forwardRoutingStep(const DataFacade &facade, auto new_duration = source_duration + target_duration; auto new_distance = source_distance + target_distance; - if (new_weight >= 0 && - std::tie(new_weight, new_duration, new_distance) < - std::tie(current_weight, current_duration, current_distance)) + if (new_weight >= 0 && std::tie(new_weight, new_duration, new_distance) < + std::tie(current_weight, current_duration, current_distance)) { current_weight = new_weight; current_duration = new_duration; diff --git a/src/engine/routing_algorithms/map_matching.cpp b/src/engine/routing_algorithms/map_matching.cpp index 7d1b75901..7b2bc053e 100644 --- a/src/engine/routing_algorithms/map_matching.cpp +++ b/src/engine/routing_algorithms/map_matching.cpp @@ -65,7 +65,7 @@ inline void initializeHeap(SearchEngineData &eng const auto border_nodes_number = facade.GetMaxBorderNodeID() + 1; engine_working_data.InitializeOrClearFirstThreadLocalStorage(nodes_number, border_nodes_number); } -} +} // namespace template SubMatchingList mapMatching(SearchEngineData &engine_working_data, diff --git a/src/engine/search_engine_data.cpp b/src/engine/search_engine_data.cpp index 53912d7a1..fc35adbff 100644 --- a/src/engine/search_engine_data.cpp +++ b/src/engine/search_engine_data.cpp @@ -130,5 +130,5 @@ void SearchEngineData::InitializeOrClearManyToManyThreadLocalStorage( many_to_many_heap.reset(new ManyToManyQueryHeap(number_of_nodes, number_of_boundary_nodes)); } } -} -} +} // namespace engine +} // namespace osrm diff --git a/src/extractor/compressed_edge_container.cpp b/src/extractor/compressed_edge_container.cpp index 348afc5de..7510f85b0 100644 --- a/src/extractor/compressed_edge_container.cpp +++ b/src/extractor/compressed_edge_container.cpp @@ -396,5 +396,5 @@ std::unique_ptr CompressedEdgeContainer::ToSegmentData() return std::move(segment_data); } -} -} +} // namespace extractor +} // namespace osrm diff --git a/src/extractor/edge_based_graph_factory.cpp b/src/extractor/edge_based_graph_factory.cpp index 3684c1478..1e013fa33 100644 --- a/src/extractor/edge_based_graph_factory.cpp +++ b/src/extractor/edge_based_graph_factory.cpp @@ -51,7 +51,7 @@ template <> struct hash> 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, EdgesPipelineBufferPtr> processor_stage( tbb::filter::parallel, [&](const tbb::blocked_range &intersection_node_range) { - auto buffer = std::make_shared(); 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 delayed_data; tbb::filter_t 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); diff --git a/src/extractor/extraction_containers.cpp b/src/extractor/extraction_containers.cpp index be4264825..b1893f619 100644 --- a/src/extractor/extraction_containers.cpp +++ b/src/extractor/extraction_containers.cpp @@ -99,7 +99,7 @@ inline NodeID mapExternalToInternalNodeID(Iter first, Iter last, const OSMNodeID return (it == last || value < *it) ? SPECIAL_NODEID : static_cast(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) { diff --git a/src/extractor/extractor.cpp b/src/extractor/extractor.cpp index 3fb5ff1f0..064fbcccb 100644 --- a/src/extractor/extractor.cpp +++ b/src/extractor/extractor.cpp @@ -552,9 +552,9 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment, const auto &rel = static_cast(*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}); diff --git a/src/extractor/extractor_callbacks.cpp b/src/extractor/extractor_callbacks.cpp index cfe983106..caaddbcb7 100644 --- a/src/extractor/extractor_callbacks.cpp +++ b/src/extractor/extractor_callbacks.cpp @@ -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); } diff --git a/src/extractor/graph_compressor.cpp b/src/extractor/graph_compressor.cpp index 9371aeb9c..373571343 100644 --- a/src/extractor/graph_compressor.cpp +++ b/src/extractor/graph_compressor.cpp @@ -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 diff --git a/src/extractor/intersection/coordinate_extractor.cpp b/src/extractor/intersection/coordinate_extractor.cpp index d4551e253..2b67d6dcd 100644 --- a/src/extractor/intersection/coordinate_extractor.cpp +++ b/src/extractor/intersection/coordinate_extractor.cpp @@ -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 &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; } diff --git a/src/extractor/intersection/have_identical_names.cpp b/src/extractor/intersection/have_identical_names.cpp index 0dffc12fe..3714598ec 100644 --- a/src/extractor/intersection/have_identical_names.cpp +++ b/src/extractor/intersection/have_identical_names.cpp @@ -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 diff --git a/src/extractor/intersection/intersection.cpp b/src/extractor/intersection/intersection.cpp index f7cc789fe..8ab635fbd 100644 --- a/src/extractor/intersection/intersection.cpp +++ b/src/extractor/intersection/intersection.cpp @@ -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; } diff --git a/src/extractor/intersection/intersection_analysis.cpp b/src/extractor/intersection/intersection_analysis.cpp index bf09b8f57..dcf3b558d 100644 --- a/src/extractor/intersection/intersection_analysis.cpp +++ b/src/extractor/intersection/intersection_analysis.cpp @@ -248,7 +248,7 @@ getIntersectionOutgoingGeometries(const util::NodeBasedDynamicGraph &graph, }); return edge_geometries; } -} +} // namespace std::pair> getIntersectionGeometries(const util::NodeBasedDynamicGraph &graph, @@ -827,6 +827,6 @@ IntersectionEdge skipDegreeTwoNodes(const util::NodeBasedDynamicGraph &graph, In return road; } -} -} -} +} // namespace intersection +} // namespace extractor +} // namespace osrm diff --git a/src/extractor/intersection/mergable_road_detector.cpp b/src/extractor/intersection/mergable_road_detector.cpp index bbc5a8d93..0e3c1cfa4 100644 --- a/src/extractor/intersection/mergable_road_detector.cpp +++ b/src/extractor/intersection/mergable_road_detector.cpp @@ -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, diff --git a/src/extractor/intersection/node_based_graph_walker.cpp b/src/extractor/intersection/node_based_graph_walker.cpp index 23c33559e..a8b6401bd 100644 --- a/src/extractor/intersection/node_based_graph_walker.cpp +++ b/src/extractor/intersection/node_based_graph_walker.cpp @@ -70,12 +70,12 @@ SelectRoadByNameOnlyChoiceAndStraightness::SelectRoadByNameOnlyChoiceAndStraight { } -boost::optional 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 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 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 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) diff --git a/src/extractor/location_dependent_data.cpp b/src/extractor/location_dependent_data.cpp index 3140ee2f4..60186c2d6 100644 --- a/src/extractor/location_dependent_data.cpp +++ b/src/extractor/location_dependent_data.cpp @@ -218,7 +218,6 @@ std::vector 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 LocationDependentData::GetPropertyIndexes(const point_t return result; } -} -} +} // namespace extractor +} // namespace osrm diff --git a/src/extractor/maneuver_override_relation_parser.cpp b/src/extractor/maneuver_override_relation_parser.cpp index 94542eafb..a414c0150 100644 --- a/src/extractor/maneuver_override_relation_parser.cpp +++ b/src/extractor/maneuver_override_relation_parser.cpp @@ -136,5 +136,5 @@ ManeuverOverrideRelationParser::TryParse(const osmium::Relation &relation) const } return maneuver_override; } -} -} +} // namespace extractor +} // namespace osrm diff --git a/src/extractor/raster_source.cpp b/src/extractor/raster_source.cpp index 10b517ef7..08a6bd324 100644 --- a/src/extractor/raster_source.cpp +++ b/src/extractor/raster_source.cpp @@ -169,5 +169,5 @@ RasterContainer::GetRasterInterpolateFromSource(unsigned int source_id, double l } RasterCache *RasterCache::g_instance = NULL; -} -} +} // namespace extractor +} // namespace osrm diff --git a/src/extractor/restriction_parser.cpp b/src/extractor/restriction_parser.cpp index 7c8f27031..2065aa503 100644 --- a/src/extractor/restriction_parser.cpp +++ b/src/extractor/restriction_parser.cpp @@ -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 diff --git a/src/extractor/scripting_environment_lua.cpp b/src/extractor/scripting_environment_lua.cpp index 42b3eb11d..3d6bece1c 100644 --- a/src/extractor/scripting_environment_lua.cpp +++ b/src/extractor/scripting_environment_lua.cpp @@ -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); }); diff --git a/src/guidance/driveway_handler.cpp b/src/guidance/driveway_handler.cpp index 81984b474..ae779a5df 100644 --- a/src/guidance/driveway_handler.cpp +++ b/src/guidance/driveway_handler.cpp @@ -58,8 +58,9 @@ bool DrivewayHandler::canProcess(const NodeID /*nid*/, return static_cast(low_priority_count) + 2 == intersection.size(); } -Intersection DrivewayHandler:: -operator()(const NodeID nid, const EdgeID source_edge_id, Intersection intersection) const +Intersection DrivewayHandler::operator()(const NodeID nid, + const EdgeID source_edge_id, + Intersection intersection) const { auto road = std::find_if(intersection.begin() + 1, intersection.end(), [this](const auto &road) { diff --git a/src/guidance/guidance_processing.cpp b/src/guidance/guidance_processing.cpp index 6e6aae8d4..7dec2aff3 100644 --- a/src/guidance/guidance_processing.cpp +++ b/src/guidance/guidance_processing.cpp @@ -118,7 +118,6 @@ void annotateTurns(const util::NodeBasedDynamicGraph &node_based_graph, // tbb::filter_t, TurnsPipelineBufferPtr> guidance_stage( tbb::filter::parallel, [&](const tbb::blocked_range &intersection_node_range) { - auto buffer = std::make_shared(); buffer->nodes_processed = intersection_node_range.size(); @@ -302,7 +301,6 @@ void annotateTurns(const util::NodeBasedDynamicGraph &node_based_graph, tbb::filter_t guidance_output_stage( tbb::filter::serial_in_order, [&](auto buffer) { - guidance_progress.PrintAddition(buffer->nodes_processed); connectivity_checksum = buffer->checksum.update_checksum(connectivity_checksum); diff --git a/src/guidance/motorway_handler.cpp b/src/guidance/motorway_handler.cpp index 116369d10..4094a0d6a 100644 --- a/src/guidance/motorway_handler.cpp +++ b/src/guidance/motorway_handler.cpp @@ -92,8 +92,8 @@ bool MotorwayHandler::canProcess(const NodeID, return has_motorway || from_motorway; } -Intersection MotorwayHandler:: -operator()(const NodeID, const EdgeID via_eid, Intersection intersection) const +Intersection +MotorwayHandler::operator()(const NodeID, const EdgeID via_eid, Intersection intersection) const { // coming from motorway if (isMotorwayClass(via_eid, node_based_graph)) diff --git a/src/guidance/roundabout_handler.cpp b/src/guidance/roundabout_handler.cpp index a375c2ff8..90b813988 100644 --- a/src/guidance/roundabout_handler.cpp +++ b/src/guidance/roundabout_handler.cpp @@ -57,8 +57,9 @@ bool RoundaboutHandler::canProcess(const NodeID from_nid, return roundabout_type != RoundaboutType::None; } -Intersection RoundaboutHandler:: -operator()(const NodeID from_nid, const EdgeID via_eid, Intersection intersection) const +Intersection RoundaboutHandler::operator()(const NodeID from_nid, + const EdgeID via_eid, + Intersection intersection) const { const auto flags = getRoundaboutFlags(from_nid, via_eid, intersection); const auto roundabout_type = getRoundaboutType(node_based_graph.GetTarget(via_eid)); @@ -211,7 +212,9 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const std::unordered_set connected_names; const auto getNextOnRoundabout = [this, &roundabout_name_ids, &connected_names]( - const NodeID node, const bool roundabout, const bool circular) { + const NodeID node, + const bool roundabout, + const bool circular) { BOOST_ASSERT(roundabout != circular); EdgeID continue_edge = SPECIAL_EDGEID; for (const auto edge_id : node_based_graph.GetAdjacentEdgeRange(node)) diff --git a/src/guidance/sliproad_handler.cpp b/src/guidance/sliproad_handler.cpp index 08f8febf2..a7992322a 100644 --- a/src/guidance/sliproad_handler.cpp +++ b/src/guidance/sliproad_handler.cpp @@ -67,8 +67,9 @@ bool SliproadHandler::canProcess(const NodeID /*nid*/, // ^ a nid // ^ ab source_edge_id // ^ b intersection -Intersection SliproadHandler:: -operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection intersection) const +Intersection SliproadHandler::operator()(const NodeID /*nid*/, + const EdgeID source_edge_id, + Intersection intersection) const { BOOST_ASSERT(intersection.size() > 2); @@ -506,7 +507,6 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter candidate_data.name_id, // name_table, // street_name_suffix_table); // - }; const auto candidate_road_name_mismatch = std::all_of(begin(target_road_name_ids), // diff --git a/src/guidance/suppress_mode_handler.cpp b/src/guidance/suppress_mode_handler.cpp index c50579f22..a7ff5062c 100644 --- a/src/guidance/suppress_mode_handler.cpp +++ b/src/guidance/suppress_mode_handler.cpp @@ -61,8 +61,8 @@ bool SuppressModeHandler::canProcess(const NodeID, return (suppress_in_mode != end(suppressed)) && all_share_mode; } -Intersection SuppressModeHandler:: -operator()(const NodeID, const EdgeID, Intersection intersection) const +Intersection +SuppressModeHandler::operator()(const NodeID, const EdgeID, Intersection intersection) const { const auto first = begin(intersection); const auto last = end(intersection); @@ -77,5 +77,5 @@ operator()(const NodeID, const EdgeID, Intersection intersection) const return intersection; } -} -} +} // namespace guidance +} // namespace osrm diff --git a/src/guidance/turn_handler.cpp b/src/guidance/turn_handler.cpp index d7644bf7d..b187073ef 100644 --- a/src/guidance/turn_handler.cpp +++ b/src/guidance/turn_handler.cpp @@ -68,7 +68,7 @@ InputIt findOutermostForkCandidate(const InputIt begin, const InputIt end) return outermost - 1; } } -} +} // namespace namespace osrm { @@ -137,8 +137,8 @@ bool TurnHandler::canProcess(const NodeID, const EdgeID, const Intersection &) c // Handles and processes possible turns // Input parameters describe an intersection as described in // #IntersectionExplanation@intersection_handler.hpp -Intersection TurnHandler:: -operator()(const NodeID, const EdgeID via_edge, Intersection intersection) const +Intersection +TurnHandler::operator()(const NodeID, const EdgeID via_edge, Intersection intersection) const { if (intersection.size() == 1) return handleOneWayTurn(std::move(intersection)); diff --git a/src/guidance/turn_lane_augmentation.cpp b/src/guidance/turn_lane_augmentation.cpp index 2690c7ddb..07a8f7aa9 100644 --- a/src/guidance/turn_lane_augmentation.cpp +++ b/src/guidance/turn_lane_augmentation.cpp @@ -227,9 +227,8 @@ LaneDataVector handleRenamingSituations(const std::size_t none_index, lane_data[none_index].to = lane_data[none_index].from; } } - else if (has_through && - (lane_data.size() == 1 || - lane_data[none_index + 1].tag != extractor::TurnLaneType::straight)) + else if (has_through && (lane_data.size() == 1 || lane_data[none_index + 1].tag != + extractor::TurnLaneType::straight)) { lane_data[none_index].tag = extractor::TurnLaneType::straight; } diff --git a/src/guidance/turn_lane_handler.cpp b/src/guidance/turn_lane_handler.cpp index 06a56217d..ea9ad848f 100644 --- a/src/guidance/turn_lane_handler.cpp +++ b/src/guidance/turn_lane_handler.cpp @@ -655,7 +655,6 @@ std::pair TurnLaneHandler::partitionLaneData( data.from = std::min(turn_lane_data[lane].from, data.from); data.to = std::max(turn_lane_data[lane].to, data.to); } - }; LaneDataVector first, second; diff --git a/src/guidance/turn_lane_matcher.cpp b/src/guidance/turn_lane_matcher.cpp index 7f2d073fd..395c3d0f9 100644 --- a/src/guidance/turn_lane_matcher.cpp +++ b/src/guidance/turn_lane_matcher.cpp @@ -272,6 +272,6 @@ Intersection triviallyMatchLanesToTurns(Intersection intersection, return intersection; } -} // namespace lane_matching +} // namespace lanes } // namespace guidance } // namespace osrm diff --git a/src/nodejs/node_osrm.cpp b/src/nodejs/node_osrm.cpp index c5ca5c9c1..6c65d9d5e 100644 --- a/src/nodejs/node_osrm.cpp +++ b/src/nodejs/node_osrm.cpp @@ -149,7 +149,8 @@ inline void async(const Nan::FunctionCallbackInfo &info, { } - void Execute() override try + void Execute() override + try { osrm::engine::api::ResultT r; r = osrm::util::json::Object(); @@ -230,7 +231,8 @@ inline void asyncForTiles(const Nan::FunctionCallbackInfo &info, { } - void Execute() override try + void Execute() override + try { result = std::string(); const auto status = ((*osrm).*(service))(*params, result); diff --git a/src/osrm/contractor.cpp b/src/osrm/contractor.cpp index a91c542ab..8ef8c4260 100644 --- a/src/osrm/contractor.cpp +++ b/src/osrm/contractor.cpp @@ -9,4 +9,4 @@ namespace osrm void contract(const contractor::ContractorConfig &config) { contractor::Contractor(config).Run(); } -} // ns osrm +} // namespace osrm diff --git a/src/osrm/customizer.cpp b/src/osrm/customizer.cpp index 35563ecf4..194fc588e 100644 --- a/src/osrm/customizer.cpp +++ b/src/osrm/customizer.cpp @@ -9,4 +9,4 @@ namespace osrm void customize(const CustomizationConfig &config) { customizer::Customizer().Run(config); } -} // ns osrm +} // namespace osrm diff --git a/src/osrm/extractor.cpp b/src/osrm/extractor.cpp index c045c4727..dc71fb2fa 100644 --- a/src/osrm/extractor.cpp +++ b/src/osrm/extractor.cpp @@ -15,4 +15,4 @@ void extract(const extractor::ExtractorConfig &config) extractor::Extractor(config).run(scripting_environment); } -} // ns osrm +} // namespace osrm diff --git a/src/osrm/osrm.cpp b/src/osrm/osrm.cpp index 8658e264f..092b5c35f 100644 --- a/src/osrm/osrm.cpp +++ b/src/osrm/osrm.cpp @@ -92,4 +92,4 @@ engine::Status OSRM::Tile(const engine::api::TileParameters ¶ms, return engine_->Tile(params, result); } -} // ns osrm +} // namespace osrm diff --git a/src/osrm/partitioner.cpp b/src/osrm/partitioner.cpp index 981902ccd..ce3456b87 100644 --- a/src/osrm/partitioner.cpp +++ b/src/osrm/partitioner.cpp @@ -9,4 +9,4 @@ namespace osrm void partition(const PartitionerConfig &config) { partitioner::Partitioner().Run(config); } -} // ns osrm +} // namespace osrm diff --git a/src/partitioner/bisection_to_partition.cpp b/src/partitioner/bisection_to_partition.cpp index 650c0ab87..fe73b6ddd 100644 --- a/src/partitioner/bisection_to_partition.cpp +++ b/src/partitioner/bisection_to_partition.cpp @@ -109,7 +109,7 @@ void partitionLevel(const std::vector &node_to_bisection_id, } } } -} +} // namespace // Implements a greedy algorithm that split cells using the bisection until a target cell size is // reached @@ -140,5 +140,5 @@ bisectionToPartition(const std::vector &node_to_bisection_id, return std::make_tuple(std::move(partitions), std::move(num_cells)); } -} -} +} // namespace partitioner +} // namespace osrm diff --git a/src/partitioner/dinic_max_flow.cpp b/src/partitioner/dinic_max_flow.cpp index 502cf99db..fc8efc4d2 100644 --- a/src/partitioner/dinic_max_flow.cpp +++ b/src/partitioner/dinic_max_flow.cpp @@ -183,7 +183,6 @@ std::size_t DinicMaxFlow::BlockingFlow(FlowEdges &flow, // augment the flow along a path in the level graph const auto augment_flow = [&flow](const std::vector &path) { - // add/remove flow edges from the current residual graph const auto augment_one = [&flow](const NodeID from, const NodeID to) { // check if there is flow in the opposite direction diff --git a/src/partitioner/inertial_flow.cpp b/src/partitioner/inertial_flow.cpp index 833a1d98a..59a4aceb4 100644 --- a/src/partitioner/inertial_flow.cpp +++ b/src/partitioner/inertial_flow.cpp @@ -149,7 +149,7 @@ DinicMaxFlow::MinCut bestMinCut(const BisectionGraphView &view, return best; } -} +} // namespace DinicMaxFlow::MinCut computeInertialFlowCut(const BisectionGraphView &view, const std::size_t num_slopes, diff --git a/src/partitioner/renumber.cpp b/src/partitioner/renumber.cpp index 619bf2c59..9f3bee9d0 100644 --- a/src/partitioner/renumber.cpp +++ b/src/partitioner/renumber.cpp @@ -36,7 +36,7 @@ std::vector getHighestBorderLevel(const DynamicEdgeBasedGraph &graph, return border_level; } -} +} // namespace std::vector makePermutation(const DynamicEdgeBasedGraph &graph, const std::vector &partitions) @@ -66,5 +66,5 @@ std::vector makePermutation(const DynamicEdgeBasedGraph &graph, return util::orderingToPermutation(ordering); } -} -} +} // namespace partitioner +} // namespace osrm diff --git a/src/server/api/parameters_parser.cpp b/src/server/api/parameters_parser.cpp index db935fb5b..bfc4c2c20 100644 --- a/src/server/api/parameters_parser.cpp +++ b/src/server/api/parameters_parser.cpp @@ -62,7 +62,7 @@ boost::optional parseParameters(std::string::iterator &iter, return boost::none; } -} // ns detail +} // namespace detail template <> boost::optional parseParameters(std::string::iterator &iter, @@ -110,6 +110,6 @@ boost::optional parseParameters(std::string::iterat return detail::parseParameters>(iter, end); } -} // ns api -} // ns server -} // ns osrm +} // namespace api +} // namespace server +} // namespace osrm diff --git a/src/server/api/url_parser.cpp b/src/server/api/url_parser.cpp index ebd82341f..b5da6fcce 100644 --- a/src/server/api/url_parser.cpp +++ b/src/server/api/url_parser.cpp @@ -60,7 +60,7 @@ struct URLParser final : qi::grammar qi::rule percent_encoding; }; -} // anon. +} // namespace namespace osrm { @@ -93,6 +93,6 @@ boost::optional parseURL(std::string::iterator &iter, const std::stri return boost::none; } -} // api -} // server -} // osrm +} // namespace api +} // namespace server +} // namespace osrm diff --git a/src/server/connection.cpp b/src/server/connection.cpp index c6d29d269..d6441977f 100644 --- a/src/server/connection.cpp +++ b/src/server/connection.cpp @@ -211,5 +211,5 @@ std::vector Connection::compress_buffers(const std::vector &uncompre return compressed_data; } -} -} +} // namespace server +} // namespace osrm diff --git a/src/server/http/reply.cpp b/src/server/http/reply.cpp index b73e381a7..284d0c8fa 100644 --- a/src/server/http/reply.cpp +++ b/src/server/http/reply.cpp @@ -104,6 +104,6 @@ boost::asio::const_buffer reply::status_to_buffer(const reply::status_type statu } reply::reply() : status(ok) {} -} -} -} +} // namespace http +} // namespace server +} // namespace osrm diff --git a/src/server/request_handler.cpp b/src/server/request_handler.cpp index 3e7135bdf..f03ac3ac5 100644 --- a/src/server/request_handler.cpp +++ b/src/server/request_handler.cpp @@ -177,5 +177,5 @@ void RequestHandler::HandleRequest(const http::request ¤t_request, http::r << ", uri: " << current_request.uri; } } -} -} +} // namespace server +} // namespace osrm diff --git a/src/server/request_parser.cpp b/src/server/request_parser.cpp index e39c0e40b..3224bec31 100644 --- a/src/server/request_parser.cpp +++ b/src/server/request_parser.cpp @@ -298,5 +298,5 @@ bool RequestParser::is_digit(const int character) const { return character >= '0' && character <= '9'; } -} -} +} // namespace server +} // namespace osrm diff --git a/src/server/service/match_service.cpp b/src/server/service/match_service.cpp index aca391bf4..c6132724a 100644 --- a/src/server/service/match_service.cpp +++ b/src/server/service/match_service.cpp @@ -39,7 +39,7 @@ std::string getWrongOptionHelp(const engine::api::MatchParameters ¶meters) return help; } -} // anon. ns +} // namespace engine::Status MatchService::RunQuery(std::size_t prefix_length, std::string &query, @@ -78,6 +78,6 @@ engine::Status MatchService::RunQuery(std::size_t prefix_length, } return BaseService::routing_machine.Match(*parameters, result); } -} -} -} +} // namespace service +} // namespace server +} // namespace osrm diff --git a/src/server/service/nearest_service.cpp b/src/server/service/nearest_service.cpp index ca9811719..1b316acd3 100644 --- a/src/server/service/nearest_service.cpp +++ b/src/server/service/nearest_service.cpp @@ -33,7 +33,7 @@ std::string getWrongOptionHelp(const engine::api::NearestParameters ¶meters) return help; } -} // anon. ns +} // namespace engine::Status NearestService::RunQuery(std::size_t prefix_length, std::string &query, @@ -72,6 +72,6 @@ engine::Status NearestService::RunQuery(std::size_t prefix_length, } return BaseService::routing_machine.Nearest(*parameters, result); } -} -} -} +} // namespace service +} // namespace server +} // namespace osrm diff --git a/src/server/service/route_service.cpp b/src/server/service/route_service.cpp index 9459e7bbf..013fb4cf6 100644 --- a/src/server/service/route_service.cpp +++ b/src/server/service/route_service.cpp @@ -37,7 +37,7 @@ std::string getWrongOptionHelp(const engine::api::RouteParameters ¶meters) return help; } -} // anon. ns +} // namespace engine::Status RouteService::RunQuery(std::size_t prefix_length, std::string &query, @@ -76,6 +76,6 @@ engine::Status RouteService::RunQuery(std::size_t prefix_length, } return BaseService::routing_machine.Route(*parameters, result); } -} -} -} +} // namespace service +} // namespace server +} // namespace osrm diff --git a/src/server/service/table_service.cpp b/src/server/service/table_service.cpp index b2c1f6548..5166be0b9 100644 --- a/src/server/service/table_service.cpp +++ b/src/server/service/table_service.cpp @@ -68,7 +68,7 @@ std::string getWrongOptionHelp(const engine::api::TableParameters ¶meters) return help; } -} // anon. ns +} // namespace engine::Status TableService::RunQuery(std::size_t prefix_length, std::string &query, @@ -107,6 +107,6 @@ engine::Status TableService::RunQuery(std::size_t prefix_length, } return BaseService::routing_machine.Table(*parameters, result); } -} -} -} +} // namespace service +} // namespace server +} // namespace osrm diff --git a/src/server/service/tile_service.cpp b/src/server/service/tile_service.cpp index bdf7996d7..f518eac9f 100644 --- a/src/server/service/tile_service.cpp +++ b/src/server/service/tile_service.cpp @@ -47,6 +47,6 @@ engine::Status TileService::RunQuery(std::size_t prefix_length, result = std::string(); return BaseService::routing_machine.Tile(*parameters, result); } -} -} -} +} // namespace service +} // namespace server +} // namespace osrm diff --git a/src/server/service/trip_service.cpp b/src/server/service/trip_service.cpp index 20af63c12..33f325e3b 100644 --- a/src/server/service/trip_service.cpp +++ b/src/server/service/trip_service.cpp @@ -39,7 +39,7 @@ std::string getWrongOptionHelp(const engine::api::TripParameters ¶meters) return help; } -} // anon. ns +} // namespace engine::Status TripService::RunQuery(std::size_t prefix_length, std::string &query, @@ -80,6 +80,6 @@ engine::Status TripService::RunQuery(std::size_t prefix_length, } return BaseService::routing_machine.Trip(*parameters, result); } -} -} -} +} // namespace service +} // namespace server +} // namespace osrm diff --git a/src/server/service_handler.cpp b/src/server/service_handler.cpp index 81fc3f719..1dfe817bf 100644 --- a/src/server/service_handler.cpp +++ b/src/server/service_handler.cpp @@ -51,5 +51,5 @@ engine::Status ServiceHandler::RunQuery(api::ParsedURL parsed_url, return service->RunQuery(parsed_url.prefix_length, parsed_url.query, result); } -} -} +} // namespace server +} // namespace osrm diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index e3d5ede2b..9185d99c0 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -165,7 +165,7 @@ bool swapData(Monitor &monitor, return true; } -} +} // namespace void populateLayoutFromFile(const boost::filesystem::path &path, storage::BaseDataLayout &layout) { @@ -596,5 +596,5 @@ void Storage::PopulateUpdatableData(const SharedDataIndex &index) } } } -} -} +} // namespace storage +} // namespace osrm diff --git a/src/tools/components.cpp b/src/tools/components.cpp index 056edb460..dcd051518 100644 --- a/src/tools/components.cpp +++ b/src/tools/components.cpp @@ -107,8 +107,8 @@ struct FeatureWriter }; // -} -} +} // namespace tools +} // namespace osrm int main(int argc, char *argv[]) { diff --git a/src/tools/contract.cpp b/src/tools/contract.cpp index 37b62c245..289ec671b 100644 --- a/src/tools/contract.cpp +++ b/src/tools/contract.cpp @@ -142,7 +142,8 @@ return_code parseArguments(int argc, return return_code::ok; } -int main(int argc, char *argv[]) try +int main(int argc, char *argv[]) +try { util::LogPolicy::GetInstance().Unmute(); std::string verbosity; diff --git a/src/tools/customize.cpp b/src/tools/customize.cpp index da8e8ed68..3a63eb3b3 100644 --- a/src/tools/customize.cpp +++ b/src/tools/customize.cpp @@ -131,7 +131,8 @@ return_code parseArguments(int argc, return return_code::ok; } -int main(int argc, char *argv[]) try +int main(int argc, char *argv[]) +try { util::LogPolicy::GetInstance().Unmute(); std::string verbosity; diff --git a/src/tools/extract.cpp b/src/tools/extract.cpp index ba725e0c1..0cd1c7b4f 100644 --- a/src/tools/extract.cpp +++ b/src/tools/extract.cpp @@ -141,7 +141,8 @@ return_code parseArguments(int argc, return return_code::ok; } -int main(int argc, char *argv[]) try +int main(int argc, char *argv[]) +try { util::LogPolicy::GetInstance().Unmute(); extractor::ExtractorConfig extractor_config; diff --git a/src/tools/io-benchmark.cpp b/src/tools/io-benchmark.cpp index 598f23d20..7e4742fe9 100644 --- a/src/tools/io-benchmark.cpp +++ b/src/tools/io-benchmark.cpp @@ -45,8 +45,8 @@ void runStatistics(std::vector &timings_vector, Statistics &stats) timings_vector.begin(), timings_vector.end(), timings_vector.begin(), 0.0); stats.dev = std::sqrt(primary_sq_sum / timings_vector.size() - (stats.mean * stats.mean)); } -} -} +} // namespace tools +} // namespace osrm boost::filesystem::path test_path; diff --git a/src/tools/partition.cpp b/src/tools/partition.cpp index 6c34bac10..bbc8f10ad 100644 --- a/src/tools/partition.cpp +++ b/src/tools/partition.cpp @@ -185,7 +185,8 @@ return_code parseArguments(int argc, return return_code::ok; } -int main(int argc, char *argv[]) try +int main(int argc, char *argv[]) +try { util::LogPolicy::GetInstance().Unmute(); std::string verbosity; diff --git a/src/tools/routed.cpp b/src/tools/routed.cpp index 718e3e4d0..7aec139a7 100644 --- a/src/tools/routed.cpp +++ b/src/tools/routed.cpp @@ -220,7 +220,8 @@ inline unsigned generateServerProgramOptions(const int argc, return INIT_OK_DO_NOT_START_ENGINE; } -int main(int argc, const char *argv[]) try +int main(int argc, const char *argv[]) +try { util::LogPolicy::GetInstance().Unmute(); diff --git a/src/tools/store.cpp b/src/tools/store.cpp index 533f0d010..1504d9ed2 100644 --- a/src/tools/store.cpp +++ b/src/tools/store.cpp @@ -221,7 +221,8 @@ bool generateDataStoreOptions(const int argc, std::_Exit(128 + signum); } -int main(const int argc, const char *argv[]) try +int main(const int argc, const char *argv[]) +try { int signals[] = {SIGTERM, SIGSEGV, SIGINT, SIGILL, SIGABRT, SIGFPE}; for (auto sig : signals) diff --git a/src/updater/csv_source.cpp b/src/updater/csv_source.cpp index 3b1e5f258..a242a0c66 100644 --- a/src/updater/csv_source.cpp +++ b/src/updater/csv_source.cpp @@ -62,6 +62,6 @@ TurnLookupTable readTurnValues(const std::vector &paths) qi::double_ >> -(',' >> qi::double_)); return parser(paths); } -} -} -} +} // namespace csv +} // namespace updater +} // namespace osrm diff --git a/src/updater/updater.cpp b/src/updater/updater.cpp index 552910842..13f10aa29 100644 --- a/src/updater/updater.cpp +++ b/src/updater/updater.cpp @@ -69,7 +69,7 @@ template struct hash> return hash_val(std::get<0>(t), std::get<1>(t)); } }; -} +} // namespace std namespace osrm { @@ -162,9 +162,10 @@ updateSegmentData(const UpdaterConfig &config, // closure to convert SpeedSource value to weight and count fallbacks to durations std::atomic fallbacks_to_duration{0}; - auto convertToWeight = [&profile_properties, &fallbacks_to_duration]( - const SegmentWeight &existing_weight, const SpeedSource &value, double distance_in_meters) { - + auto convertToWeight = [&profile_properties, + &fallbacks_to_duration](const SegmentWeight &existing_weight, + const SpeedSource &value, + double distance_in_meters) { double rate = std::numeric_limits::quiet_NaN(); // if value.rate is not set, we fall back to duration @@ -527,7 +528,7 @@ updateConditionalTurns(std::vector &turn_weight_penalties, } return updated_turns; } -} +} // namespace EdgeID Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &edge_based_edge_list, @@ -774,9 +775,9 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &e { if (turn_weight_penalty < 0) { - util::Log(logWARNING) << "turn penalty " << turn_weight_penalty - << " is too negative: clamping turn weight to " - << weight_min_value; + util::Log(logWARNING) + << "turn penalty " << turn_weight_penalty + << " is too negative: clamping turn weight to " << weight_min_value; turn_weight_penalty = weight_min_value - new_weight; turn_weight_penalties[edge.data.turn_id] = turn_weight_penalty; } @@ -830,5 +831,5 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &e util::Log() << "Done reading edges in " << TIMER_MSEC(load_edges) << "ms."; return number_of_edge_based_nodes; } -} -} +} // namespace updater +} // namespace osrm diff --git a/src/util/assert.cpp b/src/util/assert.cpp index 0e8ab79c5..f8a9cc2e6 100644 --- a/src/util/assert.cpp +++ b/src/util/assert.cpp @@ -18,7 +18,7 @@ namespace std::terminate(); } -} +} // namespace // Boost.Assert only declares the following two functions and let's us define them here. namespace boost @@ -32,4 +32,4 @@ void assertion_failed_msg( { ::assertion_failed_msg_helper(expr, msg, function, file, line); } -} +} // namespace boost diff --git a/src/util/conditional_restrictions.cpp b/src/util/conditional_restrictions.cpp index ed37873c8..14aa2ea8a 100644 --- a/src/util/conditional_restrictions.cpp +++ b/src/util/conditional_restrictions.cpp @@ -16,8 +16,8 @@ inline std::ostream &operator<<(std::ostream &stream, const ConditionalRestricti return stream << restriction.value << "=" << restriction.condition; } #endif -} -} +} // namespace util +} // namespace osrm BOOST_FUSION_ADAPT_STRUCT(osrm::util::ConditionalRestriction, (std::string, value)(std::string, condition)) @@ -33,7 +33,7 @@ namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; -} +} // namespace template struct conditional_restrictions_grammar @@ -76,7 +76,7 @@ struct conditional_restrictions_grammar qi::rule restriction; qi::rule value, condition; }; -} +} // namespace detail std::vector ParseConditionalRestrictions(const std::string &str) { @@ -92,5 +92,5 @@ std::vector ParseConditionalRestrictions(const std::stri return result; } -} // util -} // osrm +} // namespace util +} // namespace osrm diff --git a/src/util/coordinate.cpp b/src/util/coordinate.cpp index 3d6fd030a..e9082399c 100644 --- a/src/util/coordinate.cpp +++ b/src/util/coordinate.cpp @@ -42,5 +42,5 @@ bool operator==(const FloatCoordinate lhs, const FloatCoordinate rhs) bool operator!=(const Coordinate lhs, const Coordinate rhs) { return !(lhs == rhs); } bool operator!=(const FloatCoordinate lhs, const FloatCoordinate rhs) { return !(lhs == rhs); } -} -} +} // namespace util +} // namespace osrm diff --git a/src/util/exception.cpp b/src/util/exception.cpp index 8e7f4d184..2788deace 100644 --- a/src/util/exception.cpp +++ b/src/util/exception.cpp @@ -18,5 +18,5 @@ namespace util void exception::anchor() const {} void RuntimeError::anchor() const {} -} -} +} // namespace util +} // namespace osrm diff --git a/src/util/fingerprint.cpp b/src/util/fingerprint.cpp index d5e8e7ede..303d318aa 100644 --- a/src/util/fingerprint.cpp +++ b/src/util/fingerprint.cpp @@ -91,5 +91,5 @@ bool FingerPrint::IsDataCompatible(const FingerPrint &other) const return IsValid() && other.major_version == major_version && other.minor_version == minor_version; } -} -} +} // namespace util +} // namespace osrm diff --git a/src/util/geojson_debug_policies.cpp b/src/util/geojson_debug_policies.cpp index 725b8078a..c45dde8d0 100644 --- a/src/util/geojson_debug_policies.cpp +++ b/src/util/geojson_debug_policies.cpp @@ -17,9 +17,9 @@ NodeIdVectorToLineString::NodeIdVectorToLineString( } // converts a vector of node ids into a linestring geojson feature -util::json::Object NodeIdVectorToLineString:: -operator()(const std::vector &node_ids, - const boost::optional &properties) const +util::json::Object +NodeIdVectorToLineString::operator()(const std::vector &node_ids, + const boost::optional &properties) const { util::json::Array coordinates; std::transform(node_ids.begin(), @@ -37,9 +37,9 @@ NodeIdVectorToMultiPoint::NodeIdVectorToMultiPoint( { } -util::json::Object NodeIdVectorToMultiPoint:: -operator()(const std::vector &node_ids, - const boost::optional &properties) const +util::json::Object +NodeIdVectorToMultiPoint::operator()(const std::vector &node_ids, + const boost::optional &properties) const { util::json::Array coordinates; std::transform(node_ids.begin(), @@ -51,18 +51,18 @@ operator()(const std::vector &node_ids, } //---------------------------------------------------------------- -util::json::Object CoordinateVectorToMultiPoint:: -operator()(const std::vector &input_coordinates, - const boost::optional &properties) const +util::json::Object +CoordinateVectorToMultiPoint::operator()(const std::vector &input_coordinates, + const boost::optional &properties) const { const auto coordinates = makeJsonArray(input_coordinates); return makeFeature("MultiPoint", std::move(coordinates), properties); } //---------------------------------------------------------------- -util::json::Object CoordinateVectorToLineString:: -operator()(const std::vector &input_coordinates, - const boost::optional &properties) const +util::json::Object +CoordinateVectorToLineString::operator()(const std::vector &input_coordinates, + const boost::optional &properties) const { const auto coordinates = makeJsonArray(input_coordinates); return makeFeature("LineString", std::move(coordinates), properties); diff --git a/src/util/glibc_workaround.cpp b/src/util/glibc_workaround.cpp index 19811bee1..ed185016f 100644 --- a/src/util/glibc_workaround.cpp +++ b/src/util/glibc_workaround.cpp @@ -25,7 +25,7 @@ void __throw_out_of_range_fmt(const char *err, ...) // Safe and over-simplified version. Ignore the format and print it as-is. __throw_out_of_range(err); } -} +} // namespace std #endif // _ENABLE_GLIBC_WORKAROUND #endif // GLIBC_WORKAROUND \ No newline at end of file diff --git a/src/util/log.cpp b/src/util/log.cpp index 0d9a06813..f8063c748 100644 --- a/src/util/log.cpp +++ b/src/util/log.cpp @@ -22,7 +22,7 @@ static const char MAGENTA[]{"\x1b[35m"}; // static const char GREEN[] { "\x1b[32m"}; // static const char BLUE[] { "\x1b[34m"}; // static const char CYAN[] { "\x1b[36m"}; -} +} // namespace void LogPolicy::Unmute() { m_is_mute = false; } @@ -150,5 +150,5 @@ UnbufferedLog::UnbufferedLog(LogLevel level_) { stream.flags(std::ios_base::unitbuf); } -} -} +} // namespace util +} // namespace osrm diff --git a/src/util/opening_hours.cpp b/src/util/opening_hours.cpp index 6d74c854e..e3ce583d9 100644 --- a/src/util/opening_hours.cpp +++ b/src/util/opening_hours.cpp @@ -125,7 +125,7 @@ namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; -} +} // namespace template struct opening_hours_grammar : qi::grammar()> @@ -398,7 +398,7 @@ struct opening_hours_grammar : qi::grammar uint2_p; qi::uint_parser uint4_p; }; -} +} // namespace detail std::vector ParseOpeningHours(const std::string &str) { @@ -431,5 +431,5 @@ bool CheckOpeningHours(const std::vector &input, const struct tm & return is_open; } -} // util -} // osrm +} // namespace util +} // namespace osrm diff --git a/src/util/timed_historgram.cpp b/src/util/timed_historgram.cpp index 706651069..92657e70c 100644 --- a/src/util/timed_historgram.cpp +++ b/src/util/timed_historgram.cpp @@ -8,5 +8,5 @@ namespace detail { std::atomic_uint operation = {0}; } -} -} +} // namespace util +} // namespace osrm diff --git a/src/util/timezones.cpp b/src/util/timezones.cpp index 264176a68..30e7b51b4 100644 --- a/src/util/timezones.cpp +++ b/src/util/timezones.cpp @@ -162,5 +162,5 @@ boost::optional Timezoner::operator()(const point_t &point) const } return boost::none; } -} -} +} // namespace updater +} // namespace osrm diff --git a/unit_tests/contractor/contracted_edge_container.cpp b/unit_tests/contractor/contracted_edge_container.cpp index 9418f73a4..50d6480f8 100644 --- a/unit_tests/contractor/contracted_edge_container.cpp +++ b/unit_tests/contractor/contracted_edge_container.cpp @@ -27,8 +27,8 @@ std::ostream &operator<<(std::ostream &out, const QueryEdge &edge) out << "{" << edge.source << ", " << edge.target << ", " << edge.data << "}"; return out; } -} -} +} // namespace contractor +} // namespace osrm BOOST_AUTO_TEST_SUITE(contracted_edge_container) diff --git a/unit_tests/contractor/helper.hpp b/unit_tests/contractor/helper.hpp index de9f6b618..e0dd159fd 100644 --- a/unit_tests/contractor/helper.hpp +++ b/unit_tests/contractor/helper.hpp @@ -38,7 +38,7 @@ inline contractor::ContractorGraph makeGraph(const std::vector &edges) return contractor::ContractorGraph{max_id + 1, std::move(input_edges)}; } -} -} +} // namespace unit_test +} // namespace osrm #endif diff --git a/unit_tests/engine/offline_facade.cpp b/unit_tests/engine/offline_facade.cpp index 1307450be..7c264e176 100644 --- a/unit_tests/engine/offline_facade.cpp +++ b/unit_tests/engine/offline_facade.cpp @@ -18,9 +18,9 @@ namespace offline struct Algorithm final { }; -} +} // namespace offline -} // routing_algorithms +} // namespace routing_algorithms // Define engine data for offline data facade template <> struct SearchEngineData @@ -386,7 +386,7 @@ class ContiguousInternalMemoryDataFacade } }; -} // datafacade +} // namespace datafacade // Fallback to MLD algorithm: requires from data facade MLD specific members namespace routing_algorithms @@ -427,11 +427,11 @@ void unpackPath(const FacadeT &facade, mld::unpackPath(facade, packed_path_begin, packed_path_end, phantom_nodes, unpacked_path); } -} // offline -} // routing_algorithms +} // namespace offline +} // namespace routing_algorithms -} // engine -} // osrm +} // namespace engine +} // namespace osrm BOOST_AUTO_TEST_SUITE(offline_facade) diff --git a/unit_tests/extractor/intersection_analysis_tests.cpp b/unit_tests/extractor/intersection_analysis_tests.cpp index 3dae9d3ff..c6a1ec228 100644 --- a/unit_tests/extractor/intersection_analysis_tests.cpp +++ b/unit_tests/extractor/intersection_analysis_tests.cpp @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(simple_intersection_connectivity) 1, 0, 0, 1, // from node 1 to nodes 0 and 4 1, 1, 0, 1 // from node 3 to nodes 0, 1 and 4 // clang-format on - ); + ); REQUIRE_SIZE_RANGE(connectivity_matrix(3), 0); // no incoming edges, empty matrix CHECK_EQUAL_RANGE(connectivity_matrix(4), 0); // from node 2 not allowed U-turn CHECK_EQUAL_RANGE(connectivity_matrix(5), @@ -140,14 +140,14 @@ BOOST_AUTO_TEST_CASE(simple_intersection_connectivity) 0, 1, // from node 0 to node 6 0, 1, // from node 6 a U-turn to node 6 // clang-format on - ); + ); CHECK_EQUAL_RANGE(connectivity_matrix(6), // clang-format off 1, 0, // from node 5 a U-turn to node 5 0, 1, // from node 7 a U-turn to node 7 // clang-format on - ); + ); } BOOST_AUTO_TEST_CASE(roundabout_intersection_connectivity) @@ -254,7 +254,7 @@ BOOST_AUTO_TEST_CASE(roundabout_intersection_connectivity) 0, 1, 0, 1, 0, 0, // from node 3 to nodes 2 and 4 0, 1, 0, 1, 0, 1 // from node 5 to nodes 2, 4 and 6 // clang-format on - ); + ); } BOOST_AUTO_TEST_CASE(skip_degree_two_nodes) diff --git a/unit_tests/library/limits.cpp b/unit_tests/library/limits.cpp index ea6182a7d..8db7ff24b 100644 --- a/unit_tests/library/limits.cpp +++ b/unit_tests/library/limits.cpp @@ -18,7 +18,7 @@ osrm::util::Coordinate getZeroCoordinate() { return {osrm::util::FloatLongitude{0}, osrm::util::FloatLatitude{0}}; } -} +} // namespace BOOST_AUTO_TEST_SUITE(limits) diff --git a/unit_tests/mocks/mock_datafacade.hpp b/unit_tests/mocks/mock_datafacade.hpp index 7b0dc8eff..4edcb9735 100644 --- a/unit_tests/mocks/mock_datafacade.hpp +++ b/unit_tests/mocks/mock_datafacade.hpp @@ -328,7 +328,7 @@ class MockDataFacade final : public MockBaseDataFacade, public MockAlgorithmData { }; -} // ns test -} // ns osrm +} // namespace test +} // namespace osrm #endif // MOCK_DATAFACADE_HPP diff --git a/unit_tests/partitioner/bisection_to_partition.cpp b/unit_tests/partitioner/bisection_to_partition.cpp index 2fadb1f92..28cd8aac7 100644 --- a/unit_tests/partitioner/bisection_to_partition.cpp +++ b/unit_tests/partitioner/bisection_to_partition.cpp @@ -149,7 +149,18 @@ BOOST_AUTO_TEST_CASE(power_of_two_case) 0 1 2 3 4 5 6 7 8 9 10 11 */ const std::vector ids_1 = { - 0b000, 0b000, 0b001, 0b001, 0b010, 0b010, 0b011, 0b011, 0b100, 0b100, 0b101, 0b101, + 0b000, + 0b000, + 0b001, + 0b001, + 0b010, + 0b010, + 0b011, + 0b011, + 0b100, + 0b100, + 0b101, + 0b101, }; // If cell sizes are not a factor of two we will see sub-optimal results like below @@ -276,7 +287,18 @@ BOOST_AUTO_TEST_CASE(non_factor_two_case) 0 1 2 3 4 5 6 7 8 9 10 11 */ const std::vector ids_1 = { - 0b000, 0b000, 0b001, 0b001, 0b010, 0b010, 0b011, 0b011, 0b100, 0b100, 0b101, 0b101, + 0b000, + 0b000, + 0b001, + 0b001, + 0b010, + 0b010, + 0b011, + 0b011, + 0b100, + 0b100, + 0b101, + 0b101, }; // If cell sizes are not a factor of two we will see sub-optimal results like below diff --git a/unit_tests/partitioner/cell_storage.cpp b/unit_tests/partitioner/cell_storage.cpp index 705371ab3..635583d82 100644 --- a/unit_tests/partitioner/cell_storage.cpp +++ b/unit_tests/partitioner/cell_storage.cpp @@ -34,7 +34,7 @@ auto makeGraph(const std::vector &mock_edges) std::sort(edges.begin(), edges.end()); return util::StaticGraph(max_id + 1, edges); } -} +} // namespace BOOST_AUTO_TEST_SUITE(cell_storage_tests) diff --git a/unit_tests/partitioner/multi_level_graph.cpp b/unit_tests/partitioner/multi_level_graph.cpp index 2a2562459..05a988440 100644 --- a/unit_tests/partitioner/multi_level_graph.cpp +++ b/unit_tests/partitioner/multi_level_graph.cpp @@ -39,7 +39,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector &mock std::sort(edges.begin(), edges.end()); return MultiLevelGraph(mlp, max_id + 1, edges); } -} +} // namespace BOOST_AUTO_TEST_SUITE(multi_level_graph) diff --git a/unit_tests/partitioner/remove_unconnected.cpp b/unit_tests/partitioner/remove_unconnected.cpp index 62687c199..b6fd17d40 100644 --- a/unit_tests/partitioner/remove_unconnected.cpp +++ b/unit_tests/partitioner/remove_unconnected.cpp @@ -44,7 +44,7 @@ auto makeGraph(const std::vector &mock_edges) std::sort(edges.begin(), edges.end()); return util::StaticGraph(max_id + 1, edges); } -} +} // namespace BOOST_AUTO_TEST_SUITE(remove_unconnected_tests) diff --git a/unit_tests/partitioner/renumber.cpp b/unit_tests/partitioner/renumber.cpp index 391220eae..6fa2898b1 100644 --- a/unit_tests/partitioner/renumber.cpp +++ b/unit_tests/partitioner/renumber.cpp @@ -39,7 +39,7 @@ auto makeGraph(const std::vector &mock_edges) std::sort(edges.begin(), edges.end()); return DynamicEdgeBasedGraph(max_id + 1, edges); } -} +} // namespace BOOST_AUTO_TEST_SUITE(renumber_tests) diff --git a/unit_tests/server/parameters_io.hpp b/unit_tests/server/parameters_io.hpp index 527614876..e7930aa2a 100644 --- a/unit_tests/server/parameters_io.hpp +++ b/unit_tests/server/parameters_io.hpp @@ -47,7 +47,7 @@ inline std::ostream &operator<<(std::ostream &out, api::RouteParameters::Overvie } return out; } -} +} // namespace api inline std::ostream &operator<<(std::ostream &out, Bearing bearing) { @@ -60,7 +60,7 @@ inline std::ostream &operator<<(std::ostream &out, Approach approach) out << static_cast(approach); return out; } -} -} +} // namespace engine +} // namespace osrm #endif diff --git a/unit_tests/server/parameters_parser.cpp b/unit_tests/server/parameters_parser.cpp index 42a4284b2..d327ef589 100644 --- a/unit_tests/server/parameters_parser.cpp +++ b/unit_tests/server/parameters_parser.cpp @@ -222,7 +222,9 @@ BOOST_AUTO_TEST_CASE(valid_route_urls) CHECK_EQUAL_RANGE(reference_4.hints, result_4->hints); std::vector> bearings_4 = { - boost::none, engine::Bearing{200, 10}, engine::Bearing{100, 5}, + boost::none, + engine::Bearing{200, 10}, + engine::Bearing{100, 5}, }; RouteParameters reference_5{false, false, @@ -323,9 +325,9 @@ BOOST_AUTO_TEST_CASE(valid_route_urls) hints_10, std::vector>{}, std::vector>{}}; - auto result_10 = parseParameters("1,2;3,4;5,6;7,8?steps=false&hints=" + - hints_10[0]->ToBase64() + ";;" + - hints_10[2]->ToBase64() + ";"); + auto result_10 = parseParameters( + "1,2;3,4;5,6;7,8?steps=false&hints=" + hints_10[0]->ToBase64() + ";;" + + hints_10[2]->ToBase64() + ";"); BOOST_CHECK(result_10); BOOST_CHECK_EQUAL(reference_10.steps, result_10->steps); BOOST_CHECK_EQUAL(reference_10.alternatives, result_10->alternatives); @@ -420,7 +422,10 @@ BOOST_AUTO_TEST_CASE(valid_route_urls) BOOST_CHECK_EQUAL(result_17->annotations, true); std::vector> approaches_18 = { - boost::none, engine::Approach::CURB, engine::Approach::UNRESTRICTED, engine::Approach::CURB, + boost::none, + engine::Approach::CURB, + engine::Approach::UNRESTRICTED, + engine::Approach::CURB, }; RouteParameters reference_18{false, false, diff --git a/unit_tests/server/url_parser.cpp b/unit_tests/server/url_parser.cpp index 2c3fa0f8d..58f6f6496 100644 --- a/unit_tests/server/url_parser.cpp +++ b/unit_tests/server/url_parser.cpp @@ -15,9 +15,9 @@ std::ostream &operator<<(std::ostream &out, const osrm::server::api::ParsedURL & return out; } -} -} -} +} // namespace api +} // namespace server +} // namespace osrm #include #include diff --git a/unit_tests/storage/serialization.cpp b/unit_tests/storage/serialization.cpp index 760f1faea..4b38e43d1 100644 --- a/unit_tests/storage/serialization.cpp +++ b/unit_tests/storage/serialization.cpp @@ -150,7 +150,11 @@ BOOST_AUTO_TEST_CASE(tar_serialize_deallocting_vector) BOOST_AUTO_TEST_CASE(buffer_serialize_map) { std::map map = { - {"foo", 1}, {"barrrr", 2}, {"bal", 3}, {"bazbar", 4}, {"foofofofo", 5}, + {"foo", 1}, + {"barrrr", 2}, + {"bal", 3}, + {"bazbar", 4}, + {"foofofofo", 5}, }; std::string buffer; diff --git a/unit_tests/util/group_by.cpp b/unit_tests/util/group_by.cpp index 0b5da8d66..68f421a6a 100644 --- a/unit_tests/util/group_by.cpp +++ b/unit_tests/util/group_by.cpp @@ -34,7 +34,7 @@ struct SubRangeCounter template void operator()(Range &&) { count += 1; } std::size_t count = 0; }; -} +} // namespace BOOST_AUTO_TEST_CASE(grouped_empty_test) { diff --git a/unit_tests/util/serialization.cpp b/unit_tests/util/serialization.cpp index d0c5e2c1c..dffb0ea03 100644 --- a/unit_tests/util/serialization.cpp +++ b/unit_tests/util/serialization.cpp @@ -88,7 +88,9 @@ BOOST_AUTO_TEST_CASE(tar_serialize_variable_indexed_data) {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}}; std::vector char_data = { - "HalloFoo", "ABCDEFGHIJKLMNOPQR", "ABCDEFGHIJKLMNOP", + "HalloFoo", + "ABCDEFGHIJKLMNOPQR", + "ABCDEFGHIJKLMNOP", }; for (const auto i : util::irange(0, offset_data.size()))