Compare commits

...

17 Commits

Author SHA1 Message Date
Dennis Luxen 015ba69f3e Merge branch 'master' into sf-ranges 2025-02-06 20:29:25 +01:00
Alexander Farber 61464fc2bd Fix no member named 'construct' in 'optional<type-parameter-0-0 &>' error in sol.hpp with Clang 19 (#7098) 2025-01-25 07:09:37 +00:00
Alexander Farber 6f235cca15 Use libtbb-dev/libtbb12 packages in Dockerfile-debian, sort packages alphabetically in both Dockerfiles (#7095)
* - Use libtbb-dev in builder stage and libtbb12 package in the runstage instead of building oneTBB v2021.12.0 from source code
- Remove wget package from builder stage, because it is not used
- Uppercase "FROM ... as" -> "FROM ... AS" to silence a "docker build" warning
- Sort packages alphabetically and put them on separate lines for easier comparison

* - Fix the warning "FromAsCasing: 'as' and 'FROM' keywords' casing do not match"
- Sort packages alphabetically and put them on separate lines for easier comparison

* Revert  -Wno-stringop-overflow

* Update the link to multi staged builds in the comment

* Update alpine:3.20.0 -> alpine:3.20.5
2025-01-12 16:28:56 +00:00
Siarhei Fedartsou 3614af7f64 Use std::string_view for key type in json::Object (#7062) 2024-11-03 18:23:23 +01:00
Siarhei Fedartsou 48e8382785 Remove unused bearing::get function (#7040)
* Remove unused bearing::get function

* Remove unused bearing::get function

* Remove unused bearing::get function

* Remove unused bearing::get function
2024-10-20 19:46:49 +02:00
Frédéric Rodrigo becfd8a56d Add optional support of cargo bike exclusion and width to bicyle profile (#7044) 2024-10-01 15:19:44 +03:00
Siarhei Fedartsou 4f1c62a768 Bump version of protozero to 1.7.1 (#6999) 2024-09-28 20:35:20 +02:00
Siarhei Fedartsou 09a716a9e5 Bump osmium to version 2.20.0 (#6997) 2024-09-28 20:35:05 +02:00
Siarhei Fedartsou 676f6d4704 Use std::popcount instead of __builtin_popcount (#7026) 2024-09-28 20:34:39 +02:00
Siarhei Fedartsou f636dbfd44 Use std::countl_zero instead of __builtin_clzll (#7025) 2024-09-28 20:34:23 +02:00
Siarhei Fedartsou 5f67e715af Add std::vector<...>::reserve in ContiguousInternalMemoryDataFacadeBase::GetOverridesThatStartAt (#7024) 2024-09-28 20:33:33 +02:00
Siarhei Fedartsou 0cd0340346 Use std::ranges::subrange instead of boost::iterator_range 2024-07-14 16:11:17 +02:00
Siarhei Fedartsou 8a31f2f5e3 Use std::ranges::subrange instead of boost::iterator_range 2024-07-14 15:58:02 +02:00
Siarhei Fedartsou 2faaeb7756 Use std::ranges::subrange instead of boost::iterator_range 2024-07-14 14:48:31 +02:00
Siarhei Fedartsou 8671fa7272 Use std::ranges::subrange instead of boost::iterator_range 2024-07-14 14:35:47 +02:00
Siarhei Fedartsou fd174a433a Use std::ranges::subrange instead of boost::iterator_range 2024-07-13 18:50:00 +02:00
Siarhei Fedartsou 01ab85192f Use std::ranges::subrange instead of boost::iterator_range 2024-07-13 18:42:15 +02:00
625 changed files with 1869 additions and 26190 deletions
+12 -5
View File
@@ -446,14 +446,14 @@ jobs:
if: steps.cache-boost.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ENABLE_CONAN != 'ON'
run: |
BOOST_VERSION="1.85.0"
BOOST_VERSION_UNDERSCORE="${BOOST_VERSION//./_}"
wget -q https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_UNDERSCORE}.tar.gz
tar xzf boost_${BOOST_VERSION_UNDERSCORE}.tar.gz
cd boost_${BOOST_VERSION_UNDERSCORE}
BOOST_VERSION_FLAVOR="${BOOST_VERSION}-b2-nodocs"
wget -q https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION_FLAVOR}.tar.gz
tar xzf boost-${BOOST_VERSION_FLAVOR}.tar.gz
cd boost-${BOOST_VERSION}
sudo ./bootstrap.sh
sudo ./b2 install
cd ..
sudo rm -rf boost_${BOOST_VERSION_UNDERSCORE}*
sudo rm -rf boost-${BOOST_VERSION}*
- name: Install dev dependencies
run: |
@@ -502,6 +502,13 @@ jobs:
conan config init
yq eval '.compiler.clang.version += ["18"]' -i "$HOME/.conan/settings.yml"
- name: Add Apple-clang 16 to list of Conan compilers # workaround for the issue that Conan 1.x doesn't know about Apple-clang 16
if: ${{ matrix.ENABLE_CONAN == 'ON' && matrix.runs-on == 'macos-14' }}
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_darwin_arm64 -O /usr/local/bin/yq && sudo chmod +x /usr/local/bin/yq
conan config init
yq eval '.compiler.apple-clang.version += ["16.0"]' -i "$HOME/.conan/settings.yml"
- name: Prepare build
run: |
mkdir ${OSRM_BUILD_DIR}
+2
View File
@@ -25,6 +25,7 @@
- NodeJS:
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
- Misc:
- CHANGED: Use std::string_view for key type in json::Object. [#7062](https://github.com/Project-OSRM/osrm-backend/pull/7062)
- CHANGED: Use thread_local instead of boost::thread_specific_ptr. [#6991](https://github.com/Project-OSRM/osrm-backend/pull/6991)
- CHANGED: Bump flatbuffers to v24.3.25 version. [#6988](https://github.com/Project-OSRM/osrm-backend/pull/6988)
- CHANGED: Add .reserve(...) to assembleGeometry function. [#6983](https://github.com/Project-OSRM/osrm-backend/pull/6983)
@@ -79,6 +80,7 @@
- ADDED: Extract prerelease/build information from package semver [#6839](https://github.com/Project-OSRM/osrm-backend/pull/6839)
- Profiles:
- FIXED: Bicycle and foot profiles now don't route on proposed ways [#6615](https://github.com/Project-OSRM/osrm-backend/pull/6615)
- ADDED: Add optional support of cargo bike exclusion and width to bicyle profile [#7044](https://github.com/Project-OSRM/osrm-backend/pull/7044)
- Routing:
- FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419)
- FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724)
+3
View File
@@ -56,6 +56,9 @@ endif()
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
if (POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
project(OSRM C CXX)
+29 -12
View File
@@ -1,20 +1,34 @@
FROM alpine:3.20.0 as alpine-mimalloc
FROM alpine:3.21.2 AS alpine-mimalloc
RUN apk add --no-cache mimalloc
RUN apk update && \
apk upgrade && \
apk add --no-cache \
boost-iostreams \
boost-program_options \
boost-thread \
mimalloc
ENV LD_PRELOAD=/usr/lib/libmimalloc.so.2
ENV MIMALLOC_LARGE_OS_PAGES=1
FROM alpine-mimalloc as builder
FROM alpine-mimalloc AS builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src && mkdir -p /opt
RUN apk add --no-cache \
cmake make git clang libbz2 libxml2 \
boost-dev boost-program_options boost-filesystem boost-iostreams boost-thread \
lua5.4-dev onetbb-dev expat-dev
RUN mkdir -p /src /opt && \
apk add --no-cache \
boost-dev \
boost-filesystem \
clang \
cmake \
expat-dev \
git \
libbz2 \
libxml2 \
lua5.4-dev \
make \
onetbb-dev
COPY . /src
WORKDIR /src
@@ -39,16 +53,18 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
rm -rf /src
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM alpine-mimalloc as runstage
FROM alpine-mimalloc AS runstage
COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt
RUN apk add --no-cache \
boost-program_options boost-date_time boost-iostreams boost-thread \
expat lua5.4 onetbb && \
boost-date_time \
expat \
lua5.4 \
onetbb && \
ldconfig /usr/local/lib
RUN /usr/local/bin/osrm-extract --help && \
@@ -60,3 +76,4 @@ RUN /usr/local/bin/osrm-extract --help && \
WORKDIR /opt
EXPOSE 5000
+30 -21
View File
@@ -1,21 +1,24 @@
FROM debian:bookworm-slim as builder
FROM debian:bookworm-slim AS builder
ARG DOCKER_TAG
ARG BUILD_CONCURRENCY
RUN mkdir -p /src && mkdir -p /opt
RUN apt-get update && \
apt-get -y --no-install-recommends install ca-certificates cmake make git gcc g++ libbz2-dev libxml2-dev wget \
libzip-dev libboost1.81-all-dev lua5.4 liblua5.4-dev pkg-config -o APT::Install-Suggests=0 -o APT::Install-Recommends=0
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
ldconfig /usr/local/lib && \
git clone --branch v2021.12.0 --single-branch https://github.com/oneapi-src/oneTBB.git && \
cd oneTBB && \
mkdir build && \
cd build && \
cmake -DTBB_TEST=OFF -DCMAKE_BUILD_TYPE=Release .. && \
cmake --build . && \
cmake --install .
RUN mkdir -p /src /opt && \
apt-get update && \
apt-get -y --no-install-recommends --no-install-suggests install \
ca-certificates \
cmake \
g++ \
gcc \
git \
libboost1.81-all-dev \
libbz2-dev \
liblua5.4-dev \
libtbb-dev \
libxml2-dev \
libzip-dev \
lua5.4 \
make \
pkg-config
COPY . /src
WORKDIR /src
@@ -41,19 +44,24 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
rm -rf /src
# Multistage build to reduce image size - https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
# Multistage build to reduce image size - https://docs.docker.com/build/building/multi-stage/#use-multi-stage-builds
# Only the content below ends up in the image, this helps remove /src from the image (which is large)
FROM debian:bookworm-slim as runstage
FROM debian:bookworm-slim AS runstage
COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt /opt
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libboost-program-options1.81.0 libboost-date-time1.81.0 libboost-iostreams1.81.0 libboost-thread1.81.0 \
expat liblua5.4-0 && \
apt-get install -y --no-install-recommends --no-install-suggests \
expat \
libboost-date-time1.81.0 \
libboost-iostreams1.81.0 \
libboost-program-options1.81.0 \
libboost-thread1.81.0 \
liblua5.4-0 \
libtbb12 && \
rm -rf /var/lib/apt/lists/* && \
# add /usr/local/lib to ldconfig to allow loading libraries from there
# Add /usr/local/lib to ldconfig to allow loading libraries from there
ldconfig /usr/local/lib
RUN /usr/local/bin/osrm-extract --help && \
@@ -65,3 +73,4 @@ RUN /usr/local/bin/osrm-extract --help && \
WORKDIR /opt
EXPOSE 5000
+3 -3
View File
@@ -100,9 +100,9 @@ class CellCustomizer
distances.front() =
inserted ? heap.GetData(destination).distance : INVALID_EDGE_DISTANCE;
weights.advance_begin(1);
durations.advance_begin(1);
distances.advance_begin(1);
weights.advance(1);
durations.advance(1);
distances.advance(1);
}
BOOST_ASSERT(weights.empty());
BOOST_ASSERT(durations.empty());
+3 -3
View File
@@ -136,7 +136,7 @@ class NearestAPI final : public BaseAPI
forward_geometry = facade.GetUncompressedForwardGeometry(geometry_id);
auto osm_node_id =
facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position));
facade.GetOSMNodeIDOfNode(forward_geometry[phantom_node.fwd_segment_position]);
to_node = static_cast<std::uint64_t>(osm_node_id);
}
@@ -146,14 +146,14 @@ class NearestAPI final : public BaseAPI
const auto geometry_id = facade.GetGeometryIndex(segment_id).id;
const auto geometry = facade.GetUncompressedForwardGeometry(geometry_id);
auto osm_node_id =
facade.GetOSMNodeIDOfNode(geometry(phantom_node.fwd_segment_position + 1));
facade.GetOSMNodeIDOfNode(geometry[phantom_node.fwd_segment_position + 1]);
from_node = static_cast<std::uint64_t>(osm_node_id);
}
else if (phantom_node.forward_segment_id.enabled && phantom_node.fwd_segment_position > 0)
{
// In the case of one way, rely on forward segment only
auto osm_node_id =
facade.GetOSMNodeIDOfNode(forward_geometry(phantom_node.fwd_segment_position - 1));
facade.GetOSMNodeIDOfNode(forward_geometry[phantom_node.fwd_segment_position - 1]);
from_node = static_cast<std::uint64_t>(osm_node_id);
}
-1
View File
@@ -13,7 +13,6 @@
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <boost/range/algorithm/copy.hpp>
namespace osrm
{
@@ -603,6 +603,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
auto found_range = std::equal_range(
m_maneuver_overrides.begin(), m_maneuver_overrides.end(), edge_based_node_id, Comp{});
results.reserve(std::distance(found_range.first, found_range.second));
std::for_each(found_range.first,
found_range.second,
[&](const auto &override)
+10 -11
View File
@@ -29,13 +29,11 @@
#include "util/typedefs.hpp"
#include "osrm/coordinate.hpp"
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/any_range.hpp>
#include <cstddef>
#include <engine/bearing.hpp>
#include <optional>
#include <ranges>
#include <string>
#include <string_view>
#include <utility>
@@ -50,20 +48,21 @@ class BaseDataFacade
using RTreeLeaf = extractor::EdgeBasedNodeSegment;
using NodeForwardRange =
boost::iterator_range<extractor::SegmentDataView::SegmentNodeVector::const_iterator>;
using NodeReverseRange = boost::reversed_range<const NodeForwardRange>;
std::ranges::subrange<extractor::SegmentDataView::SegmentNodeVector::const_iterator>;
using NodeReverseRange = std::ranges::reverse_view<NodeForwardRange>;
using WeightForwardRange =
boost::iterator_range<extractor::SegmentDataView::SegmentWeightVector::const_iterator>;
using WeightReverseRange = boost::reversed_range<const WeightForwardRange>;
std::ranges::subrange<extractor::SegmentDataView::SegmentWeightVector::const_iterator>;
using WeightReverseRange = std::ranges::reverse_view<WeightForwardRange>;
using DurationForwardRange =
boost::iterator_range<extractor::SegmentDataView::SegmentDurationVector::const_iterator>;
using DurationReverseRange = boost::reversed_range<const DurationForwardRange>;
std::ranges::subrange<extractor::SegmentDataView::SegmentDurationVector::const_iterator>;
using DurationReverseRange = std::ranges::reverse_view<DurationForwardRange>;
using DatasourceForwardRange =
boost::iterator_range<extractor::SegmentDataView::SegmentDatasourceVector::const_iterator>;
using DatasourceReverseRange = boost::reversed_range<const DatasourceForwardRange>;
std::ranges::subrange<extractor::SegmentDataView::SegmentDatasourceVector::const_iterator>;
using DatasourceReverseRange = std::ranges::reverse_view<DatasourceForwardRange>;
BaseDataFacade() {}
virtual ~BaseDataFacade() {}
+2 -2
View File
@@ -394,7 +394,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
alias_cast<EdgeDuration>(forward_durations[data.fwd_segment_position]);
EdgeDistance forward_distance =
to_alias<EdgeDistance>(util::coordinate_calculation::greatCircleDistance(
datafacade.GetCoordinateOfNode(forward_geometry(data.fwd_segment_position)),
datafacade.GetCoordinateOfNode(forward_geometry[data.fwd_segment_position]),
point_on_segment));
const auto reverse_weight_offset = alias_cast<EdgeWeight>(
@@ -426,7 +426,7 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
EdgeDistance reverse_distance =
to_alias<EdgeDistance>(util::coordinate_calculation::greatCircleDistance(
point_on_segment,
datafacade.GetCoordinateOfNode(forward_geometry(data.fwd_segment_position + 1))));
datafacade.GetCoordinateOfNode(forward_geometry[data.fwd_segment_position + 1])));
ratio = std::min(1.0, std::max(0.0, ratio));
if (data.forward_segment_id.id != SPECIAL_SEGMENTID)
@@ -61,7 +61,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id;
const auto source_geometry = facade.GetUncompressedForwardGeometry(source_geometry_id);
geometry.node_ids.push_back(source_geometry(source_segment_start_coordinate));
geometry.node_ids.push_back(source_geometry[source_segment_start_coordinate]);
auto cumulative_distance = 0.;
auto current_distance = 0.;
@@ -142,7 +142,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
LegGeometry::Annotation{current_distance,
duration,
weight,
forward_datasources(target_node.fwd_segment_position)});
forward_datasources[target_node.fwd_segment_position]});
}
else
{
@@ -154,7 +154,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
from_alias<double>(reversed_target ? target_node.reverse_weight
: target_node.forward_weight) /
facade.GetWeightMultiplier(),
forward_datasources(target_node.fwd_segment_position)});
forward_datasources[target_node.fwd_segment_position]});
}
geometry.segment_offsets.push_back(geometry.locations.size());
@@ -168,7 +168,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
const auto target_segment_end_coordinate =
target_node.fwd_segment_position + (reversed_target ? 0 : 1);
const auto target_geometry = facade.GetUncompressedForwardGeometry(target_geometry_id);
geometry.node_ids.push_back(target_geometry(target_segment_end_coordinate));
geometry.node_ids.push_back(target_geometry[target_segment_end_coordinate]);
BOOST_ASSERT(geometry.segment_distances.size() == geometry.segment_offsets.size() - 1);
BOOST_ASSERT(geometry.locations.size() > geometry.segment_distances.size());
+3 -3
View File
@@ -14,7 +14,7 @@
#include <string>
#include <vector>
#include <boost/range/iterator_range.hpp>
#include <ranges>
namespace osrm::engine::guidance
{
@@ -220,14 +220,14 @@ inline auto RouteStep::LanesToTheLeft() const
{
const auto &description = intersections.front().lane_description;
LaneID num_lanes_left = NumLanesToTheLeft();
return boost::make_iterator_range(description.begin(), description.begin() + num_lanes_left);
return std::ranges::subrange(description.begin(), description.begin() + num_lanes_left);
}
inline auto RouteStep::LanesToTheRight() const
{
const auto &description = intersections.front().lane_description;
LaneID num_lanes_right = NumLanesToTheRight();
return boost::make_iterator_range(description.end() - num_lanes_right, description.end());
return std::ranges::subrange(description.end() - num_lanes_right, description.end());
}
} // namespace osrm::engine::guidance
+2
View File
@@ -6,6 +6,8 @@
#include <algorithm>
#include <cctype>
#include <cstdint>
#include <limits>
#include <string>
namespace osrm::extractor
{
+2 -4
View File
@@ -5,8 +5,6 @@
#include "restriction_graph.hpp"
#include "util/typedefs.hpp"
#include <boost/range/adaptor/filtered.hpp>
#include <unordered_map>
#include <utility>
#include <vector>
@@ -26,7 +24,7 @@ template <typename RestrictionFilter> class NodeRestrictionMap
// Find all restrictions applicable to (from,via,*) turns
auto Restrictions(NodeID from, NodeID via) const
{
return getRange(from, via) | boost::adaptors::filtered(index_filter);
return getRange(from, via) | std::views::filter(index_filter);
};
// Find all restrictions applicable to (from,via,to) turns
@@ -34,7 +32,7 @@ template <typename RestrictionFilter> class NodeRestrictionMap
{
const auto turnFilter = [this, to](const auto &restriction)
{ return index_filter(restriction) && restriction->IsTurnRestricted(to); };
return getRange(from, via) | boost::adaptors::filtered(turnFilter);
return getRange(from, via) | std::views::filter(turnFilter);
};
private:
+3 -3
View File
@@ -6,7 +6,7 @@
#include "util/node_based_graph.hpp"
#include "util/std_hash.hpp"
#include "util/typedefs.hpp"
#include <ranges>
#include <unordered_map>
namespace osrm::extractor
@@ -102,9 +102,9 @@ struct RestrictionGraph
friend restriction_graph_details::transferBuilder;
friend RestrictionGraph constructRestrictionGraph(const std::vector<TurnRestriction> &);
using EdgeRange = boost::iterator_range<std::vector<RestrictionEdge>::const_iterator>;
using EdgeRange = std::ranges::subrange<std::vector<RestrictionEdge>::const_iterator>;
using RestrictionRange =
boost::iterator_range<std::vector<const TurnRestriction *>::const_iterator>;
std::ranges::subrange<std::vector<const TurnRestriction *>::const_iterator>;
using EdgeKey = std::pair<NodeID, NodeID>;
// Helper functions for iterating over node restrictions and edges
+17 -20
View File
@@ -7,11 +7,8 @@
#include "storage/shared_memory_ownership.hpp"
#include "storage/tar_fwd.hpp"
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/iterator_range.hpp>
#include <filesystem>
#include <ranges>
#include <string>
#include <unordered_map>
#include <vector>
@@ -79,12 +76,12 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = nodes.begin() + index[id];
const auto end = nodes.begin() + index[id + 1];
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
auto GetReverseGeometry(const DirectionalGeometryID id)
{
return boost::adaptors::reverse(GetForwardGeometry(id));
return GetForwardGeometry(id) | std::views::reverse;
}
auto GetForwardDurations(const DirectionalGeometryID id)
@@ -92,7 +89,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = fwd_durations.begin() + index[id] + 1;
const auto end = fwd_durations.begin() + index[id + 1];
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
auto GetReverseDurations(const DirectionalGeometryID id)
@@ -100,7 +97,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = rev_durations.begin() + index[id];
const auto end = rev_durations.begin() + index[id + 1] - 1;
return boost::adaptors::reverse(boost::make_iterator_range(begin, end));
return std::ranges::subrange(begin, end) | std::views::reverse;
}
auto GetForwardWeights(const DirectionalGeometryID id)
@@ -108,7 +105,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = fwd_weights.begin() + index[id] + 1;
const auto end = fwd_weights.begin() + index[id + 1];
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
auto GetReverseWeights(const DirectionalGeometryID id)
@@ -116,7 +113,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = rev_weights.begin() + index[id];
const auto end = rev_weights.begin() + index[id + 1] - 1;
return boost::adaptors::reverse(boost::make_iterator_range(begin, end));
return std::ranges::subrange(begin, end) | std::views::reverse;
}
auto GetForwardDatasources(const DirectionalGeometryID id)
@@ -124,7 +121,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = fwd_datasources.begin() + index[id] + 1;
const auto end = fwd_datasources.begin() + index[id + 1];
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
auto GetReverseDatasources(const DirectionalGeometryID id)
@@ -132,7 +129,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = rev_datasources.begin() + index[id];
const auto end = rev_datasources.begin() + index[id + 1] - 1;
return boost::adaptors::reverse(boost::make_iterator_range(begin, end));
return std::ranges::subrange(begin, end) | std::views::reverse;
}
auto GetForwardGeometry(const DirectionalGeometryID id) const
@@ -140,12 +137,12 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = nodes.cbegin() + index[id];
const auto end = nodes.cbegin() + index[id + 1];
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
auto GetReverseGeometry(const DirectionalGeometryID id) const
{
return boost::adaptors::reverse(GetForwardGeometry(id));
return GetForwardGeometry(id) | std::views::reverse;
}
auto GetForwardDurations(const DirectionalGeometryID id) const
@@ -153,7 +150,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = fwd_durations.cbegin() + index[id] + 1;
const auto end = fwd_durations.cbegin() + index[id + 1];
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
auto GetReverseDurations(const DirectionalGeometryID id) const
@@ -161,7 +158,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = rev_durations.cbegin() + index[id];
const auto end = rev_durations.cbegin() + index[id + 1] - 1;
return boost::adaptors::reverse(boost::make_iterator_range(begin, end));
return std::ranges::subrange(begin, end) | std::views::reverse;
}
auto GetForwardWeights(const DirectionalGeometryID id) const
@@ -169,7 +166,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = fwd_weights.cbegin() + index[id] + 1;
const auto end = fwd_weights.cbegin() + index[id + 1];
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
auto GetReverseWeights(const DirectionalGeometryID id) const
@@ -177,7 +174,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = rev_weights.cbegin() + index[id];
const auto end = rev_weights.cbegin() + index[id + 1] - 1;
return boost::adaptors::reverse(boost::make_iterator_range(begin, end));
return std::ranges::subrange(begin, end) | std::views::reverse;
}
auto GetForwardDatasources(const DirectionalGeometryID id) const
@@ -185,7 +182,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = fwd_datasources.cbegin() + index[id] + 1;
const auto end = fwd_datasources.cbegin() + index[id + 1];
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
auto GetReverseDatasources(const DirectionalGeometryID id) const
@@ -193,7 +190,7 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
const auto begin = rev_datasources.cbegin() + index[id];
const auto end = rev_datasources.cbegin() + index[id + 1] - 1;
return boost::adaptors::reverse(boost::make_iterator_range(begin, end));
return std::ranges::subrange(begin, end) | std::views::reverse;
}
auto GetNumberOfGeometries() const { return index.size() - 1; }
+1 -1
View File
@@ -30,7 +30,7 @@ struct V8Renderer
{
Napi::Value child;
std::visit(V8Renderer(env, child), keyValue.second);
obj.Set(keyValue.first, child);
obj.Set(keyValue.first.data(), child);
}
out = obj;
}
+2 -2
View File
@@ -5,7 +5,7 @@
#include <boost/iterator/filter_iterator.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/range/iterator_range.hpp>
#include <ranges>
#include <cstddef>
#include <cstdint>
@@ -40,7 +40,7 @@ class BisectionGraphView
// Iteration over all nodes (direct access into the node)
ConstNodeIterator Begin() const;
ConstNodeIterator End() const;
auto Nodes() const { return boost::make_iterator_range(begin, end); }
auto Nodes() const { return std::ranges::subrange(begin, end); }
// Re-Construct the ID of a node from a reference
NodeID GetID(const NodeT &node) const;
+10 -12
View File
@@ -14,9 +14,7 @@
#include "customizer/cell_metric.hpp"
#include <boost/iterator/iterator_facade.hpp>
#include <boost/range/iterator_range.hpp>
#include <ranges>
#include <tbb/parallel_sort.h>
#include <algorithm>
@@ -128,19 +126,19 @@ template <storage::Ownership Ownership> class CellStorageImpl
friend class ::boost::iterator_core_access;
ValuePtrT current;
const std::size_t stride;
std::size_t stride;
};
template <typename ValuePtr> auto GetOutRange(const ValuePtr ptr, const NodeID node) const
{
auto iter = std::find(source_boundary, source_boundary + num_source_nodes, node);
if (iter == source_boundary + num_source_nodes)
return boost::make_iterator_range(ptr, ptr);
return std::ranges::subrange(ptr, ptr);
auto row = std::distance(source_boundary, iter);
auto begin = ptr + num_destination_nodes * row;
auto end = begin + num_destination_nodes;
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
template <typename ValuePtr> auto GetInRange(const ValuePtr ptr, const NodeID node) const
@@ -148,14 +146,14 @@ template <storage::Ownership Ownership> class CellStorageImpl
auto iter =
std::find(destination_boundary, destination_boundary + num_destination_nodes, node);
if (iter == destination_boundary + num_destination_nodes)
return boost::make_iterator_range(ColumnIterator<ValuePtr>{},
ColumnIterator<ValuePtr>{});
return std::ranges::subrange(ColumnIterator<ValuePtr>{},
ColumnIterator<ValuePtr>{});
auto column = std::distance(destination_boundary, iter);
auto begin = ColumnIterator<ValuePtr>{ptr + column, num_destination_nodes};
auto end = ColumnIterator<ValuePtr>{
ptr + column + num_source_nodes * num_destination_nodes, num_destination_nodes};
return boost::make_iterator_range(begin, end);
return std::ranges::subrange(begin, end);
}
public:
@@ -173,13 +171,13 @@ template <storage::Ownership Ownership> class CellStorageImpl
auto GetSourceNodes() const
{
return boost::make_iterator_range(source_boundary, source_boundary + num_source_nodes);
return std::ranges::subrange(source_boundary, source_boundary + num_source_nodes);
}
auto GetDestinationNodes() const
{
return boost::make_iterator_range(destination_boundary,
destination_boundary + num_destination_nodes);
return std::ranges::subrange(destination_boundary,
destination_boundary + num_destination_nodes);
}
CellImpl(const CellData &data,
@@ -18,7 +18,7 @@
#include <numeric>
#include <vector>
#include <boost/range/adaptor/reversed.hpp>
#include <ranges>
namespace osrm::partitioner
{
@@ -281,7 +281,7 @@ template <storage::Ownership Ownership> class MultiLevelPartitionImpl final
// top down assign new cell ids
LevelID level = partitions.size();
for (const auto &partition : boost::adaptors::reverse(partitions))
for (const auto &partition : std::ranges::reverse_view(partitions))
{
BOOST_ASSERT(permutation.size() > 0);
CellID last_cell_id = partition[permutation.front()];
+11 -12
View File
@@ -8,8 +8,7 @@
#include <vector>
#include "util/typedefs.hpp"
#include <boost/range/iterator_range.hpp>
#include <ranges>
namespace osrm::partitioner
{
@@ -84,26 +83,26 @@ template <typename NodeEntryT, typename EdgeEntryT> class RemappableGraph
auto Edges(const NodeID nid)
{
return boost::make_iterator_range(edges.begin() + nodes[nid].edges_begin,
edges.begin() + nodes[nid].edges_end);
return std::ranges::subrange(edges.begin() + nodes[nid].edges_begin,
edges.begin() + nodes[nid].edges_end);
}
auto Edges(const NodeID nid) const
{
return boost::make_iterator_range(edges.begin() + nodes[nid].edges_begin,
edges.begin() + nodes[nid].edges_end);
return std::ranges::subrange(edges.begin() + nodes[nid].edges_begin,
edges.begin() + nodes[nid].edges_end);
}
auto Edges(const NodeT &node)
{
return boost::make_iterator_range(edges.begin() + node.edges_begin,
edges.begin() + node.edges_end);
return std::ranges::subrange(edges.begin() + node.edges_begin,
edges.begin() + node.edges_end);
}
auto Edges(const NodeT &node) const
{
return boost::make_iterator_range(edges.begin() + node.edges_begin,
edges.begin() + node.edges_end);
return std::ranges::subrange(edges.begin() + node.edges_begin,
edges.begin() + node.edges_end);
}
auto BeginEdges(const NodeID nid) const { return edges.begin() + nodes[nid].edges_begin; }
@@ -118,8 +117,8 @@ template <typename NodeEntryT, typename EdgeEntryT> class RemappableGraph
EdgeID EndEdgeID(const NodeID nid) const { return nodes[nid].edges_end; }
// iterate over all nodes
auto Nodes() { return boost::make_iterator_range(nodes.begin(), nodes.end()); }
auto Nodes() const { return boost::make_iterator_range(nodes.begin(), nodes.end()); }
auto Nodes() { return std::ranges::subrange(nodes.begin(), nodes.end()); }
auto Nodes() const { return std::ranges::subrange(nodes.begin(), nodes.end()); }
NodeID GetID(const NodeT &node) const
{
-40
View File
@@ -11,46 +11,6 @@ namespace osrm::util
namespace bearing
{
inline std::string get(const double heading)
{
BOOST_ASSERT(heading >= 0);
BOOST_ASSERT(heading <= 360);
if (heading <= 22.5)
{
return "N";
}
if (heading <= 67.5)
{
return "NE";
}
if (heading <= 112.5)
{
return "E";
}
if (heading <= 157.5)
{
return "SE";
}
if (heading <= 202.5)
{
return "S";
}
if (heading <= 247.5)
{
return "SW";
}
if (heading <= 292.5)
{
return "W";
}
if (heading <= 337.5)
{
return "NW";
}
return "N";
}
// Checks whether A is between B-range and B+range, all modulo 360
// e.g. A = 5, B = 5, range = 10 == true
// A = -6, B = 5, range = 10 == false
+4 -34
View File
@@ -2,43 +2,13 @@
#define OSRM_UTIL_BIT_RANGE_HPP
#include "util/msb.hpp"
#include <bit>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/range/iterator_range.hpp>
#include <ranges>
namespace osrm::util
{
namespace detail
{
template <typename T> std::size_t countOnes(T value)
{
static_assert(std::is_unsigned<T>::value, "Only unsigned types allowed");
std::size_t number_of_ones = 0;
while (value > 0)
{
auto index = msb(value);
value = value & ~(T{1} << index);
number_of_ones++;
}
return number_of_ones;
}
#if (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__))
inline std::size_t countOnes(std::uint8_t value)
{
return __builtin_popcount(std::uint32_t{value});
}
inline std::size_t countOnes(std::uint16_t value)
{
return __builtin_popcount(std::uint32_t{value});
}
inline std::size_t countOnes(unsigned int value) { return __builtin_popcount(value); }
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
template <typename DataT>
@@ -70,7 +40,7 @@ class BitIterator : public boost::iterator_facade<BitIterator<DataT>,
difference_type distance_to(const BitIterator &other) const
{
return detail::countOnes(m_value) - detail::countOnes(other.m_value);
return std::popcount(m_value) - std::popcount(other.m_value);
}
bool equal(const BitIterator &other) const { return m_value == other.m_value; }
@@ -88,7 +58,7 @@ class BitIterator : public boost::iterator_facade<BitIterator<DataT>,
// Returns range over all 1 bits of value
template <typename T> auto makeBitRange(const T value)
{
return boost::make_iterator_range(BitIterator<T>{value}, BitIterator<T>{});
return std::ranges::subrange(BitIterator<T>{value}, BitIterator<T>{});
}
} // namespace osrm::util
+1 -1
View File
@@ -104,7 +104,7 @@ using Value = std::variant<String, Number, Object, Array, True, False, Null>;
*/
struct Object
{
std::unordered_map<std::string, Value> values;
std::unordered_map<std::string_view, Value> values;
};
/**
+9 -8
View File
@@ -44,13 +44,13 @@ struct Comparator
bool operator()(const Object &lhs, const Object &rhs) const
{
std::set<std::string> lhs_keys;
std::set<std::string_view> lhs_keys;
for (const auto &key_value : lhs.values)
{
lhs_keys.insert(key_value.first);
}
std::set<std::string> rhs_keys;
std::set<std::string_view> rhs_keys;
for (const auto &key_value : rhs.values)
{
rhs_keys.insert(key_value.first);
@@ -60,7 +60,7 @@ struct Comparator
{
if (rhs_keys.find(key) == rhs_keys.end())
{
reason = rhs_path + " doesn't have key \"" + key + "\"";
reason = rhs_path + " doesn't have key \"" + std::string(key) + "\"";
return false;
}
}
@@ -69,7 +69,7 @@ struct Comparator
{
if (lhs_keys.find(key) == lhs_keys.end())
{
reason = lhs_path + " doesn't have key \"" + key + "\"";
reason = lhs_path + " doesn't have key \"" + std::string(key) + "\"";
return false;
}
}
@@ -81,10 +81,11 @@ struct Comparator
const auto &rhs_child = rhs.values.find(key)->second;
const auto &lhs_child = lhs.values.find(key)->second;
auto is_same =
std::visit(Comparator(reason, lhs_path + "." + key, rhs_path + "." + key),
lhs_child,
rhs_child);
auto is_same = std::visit(Comparator(reason,
lhs_path + "." + std::string(key),
rhs_path + "." + std::string(key)),
lhs_child,
rhs_child);
if (!is_same)
{
return false;
+4 -4
View File
@@ -97,7 +97,7 @@ template <typename Out> struct Renderer
void operator()(const Null &) { write<>("null"); }
private:
void write(const std::string &str);
void write(std::string_view str);
void write(const char *str, size_t size);
void write(char ch);
@@ -110,7 +110,7 @@ template <typename Out> struct Renderer
Out &out;
};
template <> void Renderer<std::vector<char>>::write(const std::string &str)
template <> void Renderer<std::vector<char>>::write(std::string_view str)
{
out.insert(out.end(), str.begin(), str.end());
}
@@ -122,7 +122,7 @@ template <> void Renderer<std::vector<char>>::write(const char *str, size_t size
template <> void Renderer<std::vector<char>>::write(char ch) { out.push_back(ch); }
template <> void Renderer<std::ostream>::write(const std::string &str) { out << str; }
template <> void Renderer<std::ostream>::write(std::string_view str) { out << str; }
template <> void Renderer<std::ostream>::write(const char *str, size_t size)
{
@@ -131,7 +131,7 @@ template <> void Renderer<std::ostream>::write(const char *str, size_t size)
template <> void Renderer<std::ostream>::write(char ch) { out << ch; }
template <> void Renderer<std::string>::write(const std::string &str) { out += str; }
template <> void Renderer<std::string>::write(std::string_view str) { out += str; }
template <> void Renderer<std::string>::write(const char *str, size_t size)
{
+7 -33
View File
@@ -1,50 +1,24 @@
#ifndef OSRM_UTIL_MSB_HPP
#define OSRM_UTIL_MSB_HPP
#include <bit>
#include <boost/assert.hpp>
#include <climits>
#include <cstdint>
#include <utility>
#include <limits>
namespace osrm::util
{
// get the msb of an integer
// return 0 for integers without msb
template <typename T> std::size_t msb(T value)
{
BOOST_ASSERT(value > 0);
static_assert(std::is_integral<T>::value && !std::is_signed<T>::value, "Integer required.");
std::size_t msb = 0;
while (value > 0)
{
value >>= 1u;
msb++;
}
BOOST_ASSERT(msb > 0);
return msb - 1;
constexpr auto MSB_INDEX = std::numeric_limits<unsigned char>::digits * sizeof(T) - 1;
return MSB_INDEX - std::countl_zero(value);
}
#if (defined(__clang__) || defined(__GNUC__) || defined(__GNUG__))
inline std::size_t msb(unsigned long long v)
{
BOOST_ASSERT(v > 0);
constexpr auto MSB_INDEX = CHAR_BIT * sizeof(unsigned long long) - 1;
return MSB_INDEX - __builtin_clzll(v);
}
inline std::size_t msb(unsigned long v)
{
BOOST_ASSERT(v > 0);
constexpr auto MSB_INDEX = CHAR_BIT * sizeof(unsigned long) - 1;
return MSB_INDEX - __builtin_clzl(v);
}
inline std::size_t msb(unsigned int v)
{
BOOST_ASSERT(v > 0);
constexpr auto MSB_INDEX = CHAR_BIT * sizeof(unsigned int) - 1;
return MSB_INDEX - __builtin_clz(v);
}
#endif
} // namespace osrm::util
#endif
+2
View File
@@ -340,6 +340,8 @@ template <typename T, std::size_t Bits, storage::Ownership Ownership> class Pack
{
}
ReferenceT operator[](difference_type n) const { return container->operator[](index + n); }
private:
void increment() { ++index; }
void decrement() { --index; }
+2
View File
@@ -42,6 +42,8 @@ class VectorViewIterator : public boost::iterator_facade<VectorViewIterator<Data
explicit VectorViewIterator() : m_value(nullptr) {}
explicit VectorViewIterator(DataT *x) : m_value(x) {}
reference operator[](difference_type n) const { return m_value[n]; }
private:
void increment() { ++m_value; }
void decrement() { --m_value; }
+48
View File
@@ -35,6 +35,10 @@ function setup()
turn_bias = 1.4,
use_public_transport = true,
-- Exclude narrow ways, in particular to route with cargo bike
width = nil, -- Cargo bike could 0.5 width, in meters
exclude_cargo_bike = false,
allowed_start_modes = Set {
mode.cycling,
mode.pushing_bike
@@ -243,6 +247,27 @@ function process_node(profile, node, result)
end
end
if profile.exclude_cargo_bike then
local cargo_bike = node:get_value_by_key("cargo_bike")
if cargo_bike and cargo_bike == "no" then
result.barrier = true
end
end
-- width
if profile.width then
-- From barrier=cycle_barrier or other barriers
local maxwidth_physical = node:get_value_by_key("maxwidth:physical")
local maxwidth_physical_meter = maxwidth_physical and Measure.parse_value_meters(maxwidth_physical) or 99
local opening = node:get_value_by_key("opening")
local opening_meter = opening and Measure.parse_value_meters(opening) or 99
local width_meter = math.min(maxwidth_physical_meter, opening_meter)
if width_meter and width_meter < profile.width then
result.barrier = true
end
end
-- check if node is a traffic light
result.traffic_lights = TrafficSignal.get_value(node)
end
@@ -299,6 +324,8 @@ function handle_bicycle_tags(profile,way,result,data)
bike_push_handler(profile,way,result,data)
-- width should be after bike_push
width_handler(profile,way,result,data)
-- maxspeed
limit( result, data.maxspeed, data.maxspeed_forward, data.maxspeed_backward )
@@ -453,6 +480,27 @@ function cycleway_handler(profile,way,result,data)
end
end
function width_handler(profile,way,result,data)
if profile.exclude_cargo_bike then
local cargo_bike = way:get_value_by_key("cargo_bike")
if cargo_bike and cargo_bike == "no" then
result.forward_mode = mode.inaccessible
result.backward_mode = mode.inaccessible
end
end
if profile.width then
local width = way:get_value_by_key("width")
if width then
local width_meter = Measure.parse_value_meters(width)
if width_meter and width_meter < profile.width then
result.forward_mode = mode.inaccessible
result.backward_mode = mode.inaccessible
end
end
end
end
function bike_push_handler(profile,way,result,data)
-- pushing bikes - if no other mode found
if result.forward_mode == mode.inaccessible or result.backward_mode == mode.inaccessible or
+1 -1
View File
@@ -93,7 +93,7 @@ function run_benchmarks_for_folder {
echo "Took: ${DIFF}s"
done
done
for ALGORITHM in ch mld; do
for BENCH in nearest table trip route match; do
echo "Running random $BENCH $ALGORITHM"
+2 -2
View File
@@ -10,7 +10,7 @@ set -o nounset
# http://git.661346.n2.nabble.com/subtree-merges-lose-prefix-after-rebase-td7332850.html
OSMIUM_PATH="osmcode/libosmium"
OSMIUM_TAG=v2.14.0
OSMIUM_TAG=v2.20.0
SOL_PATH="ThePhD/sol2"
SOL_TAG=v3.3.0
@@ -22,7 +22,7 @@ MICROTAR_PATH="rxi/microtar"
MICROTAR_TAG=v0.1.0
PROTOZERO_PATH="mapbox/protozero"
PROTOZERO_TAG=v1.6.2
PROTOZERO_TAG=v1.7.1
VTZERO_PATH="mapbox/vtzero"
VTZERO_TAG=v1.1.0
+8 -1
View File
@@ -9,12 +9,17 @@
#include <rapidjson/document.h>
#include <sstream>
#include <stdexcept>
#include <unordered_set>
using namespace osrm;
namespace
{
// we use std::string_view as a key in the object, so since here we have dynamic keys we have to
// "hold" them somewhere okay for tests...
static std::unordered_set<std::string> gKeysHolder;
void convert(const rapidjson::Value &value, json::Value &result)
{
if (value.IsString())
@@ -32,7 +37,8 @@ void convert(const rapidjson::Value &value, json::Value &result)
{
json::Value member;
convert(itr->value, member);
object.values.emplace(itr->name.GetString(), std::move(member));
auto keyItr = gKeysHolder.emplace(itr->name.GetString()).first;
object.values.emplace(*keyItr, std::move(member));
}
result = std::move(object);
}
@@ -122,6 +128,7 @@ int main(int argc, char **argv)
if (std::string{out_vec.begin(), out_vec.end()} != out_str || out_str != out_ss_str)
{
std::cerr << "Vector/string results are not equal\n";
throw std::logic_error("Vector/stringstream/string results are not equal");
}
return EXIT_SUCCESS;
-1
View File
@@ -13,7 +13,6 @@
#include <boost/assert.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/range/iterator_range.hpp>
#include <algorithm>
#include <cmath>
+4 -3
View File
@@ -482,9 +482,10 @@ void encodeVectorTile(const DataFacadeBase &facade,
reverse_duration_range[reverse_duration_range.size() -
edge.fwd_segment_position - 1];
const auto forward_datasource_idx =
forward_datasource_range(edge.fwd_segment_position);
const auto reverse_datasource_idx = reverse_datasource_range(
reverse_datasource_range.size() - edge.fwd_segment_position - 1);
forward_datasource_range[edge.fwd_segment_position];
const auto reverse_datasource_idx =
reverse_datasource_range[reverse_datasource_range.size() -
edge.fwd_segment_position - 1];
const auto is_startpoint = edge.is_startpoint;
@@ -2,7 +2,7 @@
#include "engine/routing_algorithms/routing_base_ch.hpp"
#include <boost/assert.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <ranges>
#include <limits>
#include <memory>
@@ -106,7 +106,7 @@ void forwardRoutingStep(const DataFacade<Algorithm> &facade,
search_space_with_buckets.end(),
heapNode.node,
NodeBucket::Compare());
for (const auto &current_bucket : boost::make_iterator_range(bucket_list))
for (const auto &current_bucket : std::ranges::subrange(bucket_list.first, bucket_list.second))
{
// Get target id from bucket entry
const auto column_index = current_bucket.column_index;
@@ -2,7 +2,7 @@
#include "engine/routing_algorithms/routing_base_mld.hpp"
#include <boost/assert.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <ranges>
#include <limits>
#include <memory>
@@ -148,8 +148,8 @@ void relaxOutgoingEdges(
}
}
++destination;
shortcut_durations.advance_begin(1);
shortcut_distances.advance_begin(1);
shortcut_durations.advance(1);
shortcut_distances.advance(1);
}
BOOST_ASSERT(shortcut_durations.empty());
BOOST_ASSERT(shortcut_distances.empty());
@@ -169,8 +169,8 @@ void relaxOutgoingEdges(
if (shortcut_weight != INVALID_EDGE_WEIGHT && heapNode.node != to)
{
const auto to_weight = heapNode.weight + shortcut_weight;
const auto to_duration = heapNode.data.duration + shortcut_durations.front();
const auto to_distance = heapNode.data.distance + shortcut_distances.front();
const auto to_duration = heapNode.data.duration + *shortcut_durations.begin();
const auto to_distance = heapNode.data.distance + *shortcut_distances.begin();
const auto toHeapNode = query_heap.GetHeapNodeIfWasInserted(to);
if (!toHeapNode)
{
@@ -189,8 +189,8 @@ void relaxOutgoingEdges(
}
}
++source;
shortcut_durations.advance_begin(1);
shortcut_distances.advance_begin(1);
shortcut_durations.advance(1);
shortcut_distances.advance(1);
}
BOOST_ASSERT(shortcut_durations.empty());
BOOST_ASSERT(shortcut_distances.empty());
@@ -426,7 +426,7 @@ void forwardRoutingStep(const DataFacade<Algorithm> &facade,
search_space_with_buckets.end(),
heapNode.node,
NodeBucket::Compare());
for (const auto &current_bucket : boost::make_iterator_range(bucket_list))
for (const auto &current_bucket : std::ranges::subrange(bucket_list.first, bucket_list.second))
{
// Get target id from bucket entry
const auto column_idx = current_bucket.column_index;
+2 -5
View File
@@ -968,11 +968,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
buffer->continuous_data.push_back(edge_with_data);
// get conditional restrictions that apply to this turn
const auto &restrictions =
conditional_node_restriction_map.Restrictions(
incoming_edge.node,
outgoing_edge.node,
outgoing_edge_target);
auto restrictions = conditional_node_restriction_map.Restrictions(
incoming_edge.node, outgoing_edge.node, outgoing_edge_target);
for (const auto &restriction : restrictions)
{
buffer->conditionals.push_back(
@@ -424,13 +424,11 @@ double findEdgeLength(const IntersectionEdgeGeometries &geometries, const EdgeID
}
template <typename RestrictionsRange>
bool isTurnRestricted(const RestrictionsRange &restrictions, const NodeID to)
bool isTurnRestricted(RestrictionsRange restrictions, const NodeID to)
{
// Check if any of the restrictions would prevent a turn to 'to'
return std::any_of(restrictions.begin(),
restrictions.end(),
[&to](const auto &restriction)
{ return restriction->IsTurnRestricted(to); });
return std::ranges::any_of(
restrictions, [&to](const auto &restriction) { return restriction->IsTurnRestricted(to); });
}
bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph,
+5 -7
View File
@@ -5,8 +5,6 @@
#include "util/timing_util.hpp"
#include <util/for_each_pair.hpp>
#include <boost/range/algorithm/copy.hpp>
namespace osrm::extractor
{
@@ -276,16 +274,16 @@ RestrictionGraph constructRestrictionGraph(const std::vector<TurnRestriction> &t
RestrictionGraph::RestrictionRange RestrictionGraph::GetRestrictions(RestrictionID id) const
{
const auto &node = nodes[id];
return boost::make_iterator_range(restrictions.begin() + node.restrictions_begin_idx,
restrictions.begin() + node.restrictions_begin_idx +
node.num_restrictions);
return std::ranges::subrange(restrictions.begin() + node.restrictions_begin_idx,
restrictions.begin() + node.restrictions_begin_idx +
node.num_restrictions);
}
RestrictionGraph::EdgeRange RestrictionGraph::GetEdges(RestrictionID id) const
{
const auto &node = nodes[id];
return boost::make_iterator_range(edges.begin() + node.edges_begin_idx,
edges.begin() + node.edges_begin_idx + node.num_edges);
return std::ranges::subrange(edges.begin() + node.edges_begin_idx,
edges.begin() + node.edges_begin_idx + node.num_edges);
}
} // namespace osrm::extractor
+1 -1
View File
@@ -124,7 +124,7 @@ bisectionToPartition(const std::vector<BisectionID> &node_to_bisection_id,
std::vector<std::uint32_t> num_cells(max_cell_sizes.size());
int level_idx = max_cell_sizes.size() - 1;
for (auto max_cell_size : boost::adaptors::reverse(max_cell_sizes))
for (auto max_cell_size : std::ranges::reverse_view(max_cell_sizes))
{
BOOST_ASSERT(level_idx >= 0);
partitionLevel(node_to_bisection_id, max_cell_size, permutation, cells);
+5 -5
View File
@@ -252,11 +252,11 @@ updateSegmentData(const UpdaterConfig &config,
// In this case we want it oriented from in forward directions
auto rev_weights_range =
boost::adaptors::reverse(segment_data.GetReverseWeights(geometry_id));
segment_data.GetReverseWeights(geometry_id) | std::views::reverse;
auto rev_durations_range =
boost::adaptors::reverse(segment_data.GetReverseDurations(geometry_id));
segment_data.GetReverseDurations(geometry_id) | std::views::reverse;
auto rev_datasources_range =
boost::adaptors::reverse(segment_data.GetReverseDatasources(geometry_id));
segment_data.GetReverseDatasources(geometry_id) | std::views::reverse;
bool rev_was_updated = false;
for (const auto segment_offset :
@@ -337,11 +337,11 @@ updateSegmentData(const UpdaterConfig &config,
auto new_fwd_durations_range = segment_data.GetForwardDurations(geometry_id);
auto new_fwd_datasources_range = segment_data.GetForwardDatasources(geometry_id);
auto new_rev_durations_range =
boost::adaptors::reverse(segment_data.GetReverseDurations(geometry_id));
segment_data.GetReverseDurations(geometry_id) | std::views::reverse;
auto new_rev_datasources_range = segment_data.GetReverseDatasources(geometry_id);
auto old_fwd_durations_range = segment_data_backup->GetForwardDurations(geometry_id);
auto old_rev_durations_range =
boost::adaptors::reverse(segment_data_backup->GetReverseDurations(geometry_id));
segment_data_backup->GetReverseDurations(geometry_id) | std::views::reverse;
for (const auto segment_offset :
util::irange<std::size_t>(0, new_fwd_durations_range.size()))
+4 -1
View File
@@ -1,5 +1,5 @@
---
Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-macro-parentheses,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-llvmlibc-*,-llvm-qualified-auto,-misc-macro-parentheses,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-unused-parameters,-modernize-avoid-c-arrays,-modernize-make-unique,-modernize-raw-string-literal,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-implicit-bool-cast,-readability-implicit-bool-conversion,-readability-magic-numbers,-readability-qualified-auto'
Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-macro-parentheses,-cert-dcl21-cpp,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-macro-usage,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-vararg,-fuchsia-*,-google-runtime-references,-hicpp-avoid-c-arrays,-hicpp-invalid-access-moved,-hicpp-no-array-decay,-hicpp-no-assembler,-hicpp-vararg,-llvmlibc-*,-llvm-qualified-auto,-misc-macro-parentheses,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-unused-parameters,-modernize-avoid-c-arrays,-modernize-make-unique,-modernize-raw-string-literal,-modernize-use-trailing-return-type,-readability-avoid-const-params-in-decls,-readability-convert-member-functions-to-static,-readability-function-cognitive-complexity,-readability-identifier-length,-readability-implicit-bool-cast,-readability-implicit-bool-conversion,-readability-magic-numbers,-readability-qualified-auto'
#
# For a list of check options, see:
# https://clang.llvm.org/extra/clang-tidy/checks/list.html
@@ -137,6 +137,9 @@ Checks: '*,-abseil-string-find-str-contains,-altera-*,-android-cloexec-*,-bugpro
# This is header only library, so the declaration and implementation are
# often the same and we want to have the const in implementations.
#
# readability-convert-member-functions-to-static
# Reports too many false positives
#
# readability-function-cognitive-complexity
# Sometimes the large functions are needed.
#
@@ -7,7 +7,13 @@ runs:
run: mkdir build
shell: bash
- name: Configure
run: cmake -LA .. -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DBUILD_HEADERS=OFF -DBUILD_BENCHMARKS=ON -DOsmium_DEBUG=TRUE -DPROTOZERO_INCLUDE_DIR=${GITHUB_WORKSPACE}/../protozero/include
run: |
cmake -LA .. \
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DBUILD_HEADERS=OFF \
-DBUILD_BENCHMARKS=ON \
-DOsmium_DEBUG=TRUE \
-DPROTOZERO_INCLUDE_DIR=${GITHUB_WORKSPACE}/../protozero/include
shell: bash
working-directory: build
@@ -5,7 +5,7 @@ runs:
steps:
- name: Install packages
run: |
sudo apt-get update -q
sudo apt-get update -qq
sudo apt-get install -yq \
doxygen \
libboost-dev \
@@ -16,8 +16,5 @@ runs:
libsparsehash-dev \
ruby-json \
spatialite-bin
test "$CC" = clang-6.0 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-6.0
test "$CC" = clang-8 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-8
test "$CC" = clang-13 && sudo apt-get install -yq --no-install-suggests --no-install-recommends clang-13
shell: bash
+109 -131
View File
@@ -3,14 +3,13 @@ name: CI
on: [ push, pull_request ]
jobs:
linux:
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
name: [Ubuntu-18, Ubuntu-20, Ubuntu-21, Debian-9, Debian-10, Debian-11, Debian-Testing, Debian-Experimental, Fedora-34]
name: [Ubuntu-18, Ubuntu-20, Ubuntu-22, Debian-10, Debian-11, Debian-12, Debian-Testing, Debian-Experimental, Fedora-35, Fedora-36, Fedora-37, Fedora-38]
build_type: [Dev]
cpp_compiler: [g++]
cpp_version: [c++11]
@@ -19,122 +18,136 @@ jobs:
# Uses gcc 7.5.0, clang 6.0.0, cmake 3.10.2
image: "ubuntu:18.04"
ubuntu: 18
installer: apt
- name: Ubuntu-20
# Uses gcc 9.3.0, clang 10.0.0, cmake 3.16.3
image: "ubuntu:20.04"
ubuntu: 20
installer: apt
- name: Ubuntu-21
# Uses gcc 10.3.0, clang, 12.0.0, cmake 3.18.4
image: "ubuntu:21.04"
ubuntu: 21
installer: apt
- name: Debian-9
# Uses gcc 6.3.0, clang 3.8.1, cmake 3.7.2
image: "debian:stretch"
installer: apt
- name: Ubuntu-22
# Uses gcc 12.2.0, clang 15.0.7, cmake 3.24.2
image: "ubuntu:22.04"
ubuntu: 22
CXXFLAGS: -Wno-stringop-overread
- name: Debian-10
# Uses gcc 8.3.0, clang 7.0.1, cmake 3.13.4
image: "debian:buster"
installer: apt
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
installer: apt
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
installer: apt
cpp_version: c++17
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
installer: apt
cpp_version: c++20
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
installer: apt
c_compiler: clang
cpp_compiler: clang++
- name: Debian-11
image: "debian:bullseye"
c_compiler: clang
cpp_compiler: clang++
cpp_version: c++17
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
installer: apt
c_compiler: clang
cpp_compiler: clang++
cpp_version: c++20
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
installer: apt
build_type: RelWithDebInfo
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
installer: apt
c_compiler: clang
cpp_compiler: clang++
- name: Debian-11
# Uses gcc 10.2.1, clang 11.0.1, cmake 3.18.4
image: "debian:bullseye"
installer: apt
c_compiler: clang
cpp_compiler: clang++
CXXFLAGS: -fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer
LDFLAGS: -fsanitize=address,undefined,integer
- name: Debian-Testing
# Uses gcc 10.3.0, clang 11.1.0, cmake 3.21.3
image: "debian:testing"
installer: apt
CXXFLAGS: -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer
LDFLAGS: -fsanitize=address,undefined
- name: Debian-12
# Uses gcc 12.2.0, clang 15.0.6, cmake 3.25.1
image: "debian:bookworm"
CXXFLAGS: -Wno-stringop-overread
- name: Debian-12
image: "debian:bookworm"
cpp_version: c++17
CXXFLAGS: -Wno-stringop-overread
- name: Debian-12
image: "debian:bookworm"
cpp_version: c++20
CXXFLAGS: -Wno-stringop-overread
- name: Debian-12
image: "debian:bookworm"
c_compiler: clang
cpp_compiler: clang++
- name: Debian-12
image: "debian:bookworm"
c_compiler: clang
cpp_compiler: clang++
cpp_version: c++17
- name: Debian-12
image: "debian:bookworm"
c_compiler: clang
cpp_compiler: clang++
cpp_version: c++20
- name: Debian-12
image: "debian:bookworm"
build_type: RelWithDebInfo
CXXFLAGS: -Wno-stringop-overread
- name: Debian-12
image: "debian:bookworm"
c_compiler: clang
cpp_compiler: clang++
CXXFLAGS: -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer
LDFLAGS: -fsanitize=address,undefined
- name: Debian-Testing
image: "debian:testing"
CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference
- name: Debian-Testing
# Uses gcc 10.3.0, clang 11.1.0, cmake 3.21.3
image: "debian:testing"
installer: apt
c_compiler: clang
cpp_compiler: clang++
- name: Debian-Experimental
# Uses gcc 11, clang 14, cmake 3.21.3
image: "debian:experimental"
installer: apt
CXXFLAGS: -Wno-stringop-overread
CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference
- name: Debian-Experimental
# Uses gcc 11, clang 14, cmake 3.21.3
image: "debian:experimental"
installer: apt
c_compiler: clang-14
cpp_compiler: clang++-14
- name: Fedora-34
# Uses gcc 11.2.1, clang 12.0.1, cmake 3.20.5
image: "fedora:34"
installer: dnf
CXXFLAGS: -Wno-stringop-overread
c_compiler: clang
cpp_compiler: clang++
- name: Fedora-35
# Uses gcc 11.2.1, clang 12.0.1, cmake 3.20.5
image: "fedora:35"
installer: dnf
CXXFLAGS: -Wno-stringop-overread
- name: Fedora-36
# Uses gcc 12.2.0, clang 14.0.5, cmake 3.24.2
image: "fedora:36"
CXXFLAGS: -Wno-stringop-overread
- name: Fedora-37
# Uses gcc 12.3.1, clang 15.0.7, cmake 3.26.4
image: "fedora:37"
CXXFLAGS: -Wno-stringop-overread
- name: Fedora-38
# Uses gcc 13.0.1, clang 16.0.5, cmake 3.26.4
image: "fedora:38"
CXXFLAGS: -Wno-stringop-overread -Wno-dangling-reference
container:
image: ${{ matrix.image }}
env:
LANG: en_US.UTF-8
BUILD_TYPE: ${{ matrix.build_type }}
CXXFLAGS: ${{ matrix.CXXFLAGS }}
LDFLAGS: ${{ matrix.LDFLAGS }}
CC: ${{ matrix.c_compiler }}
CXX: ${{ matrix.cpp_compiler }}
CXXFLAGS: ${{ matrix.CXXFLAGS }}
LDFLAGS: ${{ matrix.LDFLAGS }}
CPP_VERSION: ${{ matrix.cpp_version }}
WITH_PROJ: ON
APT_LISTCHANGES_FRONTEND: none
DEBIAN_FRONTEND: noninteractive
steps:
- name: Prepare container (apt)
shell: bash
if: startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:')
run: |
export APT_LISTCHANGES_FRONTEND=none
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -y \
apt-get install -yq \
clang \
cmake \
doxygen \
@@ -154,16 +167,13 @@ jobs:
ruby-json \
spatialite-bin \
zlib1g-dev
shell: bash
if: matrix.installer == 'apt'
- name: Install compiler
shell: bash
run: |
export APT_LISTCHANGES_FRONTEND=none
export DEBIAN_FRONTEND=noninteractive
apt-get install -y clang-14
if: matrix.cpp_compiler == 'clang++-14'
run: apt-get install -yq clang-14
- name: Prepare container (dnf)
shell: bash
if: startsWith(matrix.image, 'fedora:')
run: |
dnf install --quiet --assumeyes \
boost-devel \
@@ -185,9 +195,7 @@ jobs:
sparsehash-devel \
spatialite-tools \
zlib-devel
shell: bash
if: matrix.installer == 'dnf'
# Use v1 of checkout because v2 doesn't work with submodules
# Use v1 of checkout because v3 doesn't work with submodules
- uses: actions/checkout@v1
with:
submodules: true
@@ -197,21 +205,23 @@ jobs:
- uses: ./.github/actions/ctest
ubuntu-latest:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 40
env:
CC: clang-13
CXX: clang++-13
CC: clang-15
CXX: clang++-15
BUILD_TYPE: Dev
WITH_PROJ: ON
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Install new clang
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm-snapshot.asc
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main'
sudo apt-get update -qq
sudo apt-get install -yq clang-15
shell: bash
- uses: ./.github/actions/install-ubuntu
- uses: ./.github/actions/install-protozero
@@ -219,16 +229,27 @@ jobs:
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest
macos10-dev:
runs-on: macos-10.15
macos:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os:
- "macos-11"
- "macos-12"
- "macos-13"
build_type: [Dev]
include:
- os: "macos-12"
build_type: Release
runs-on: ${{ matrix.os }}
env:
CC: clang
CXX: clang++
BUILD_TYPE: Dev
BUILD_TYPE: ${{ matrix.build_type }}
WITH_PROJ: OFF
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- uses: ./.github/actions/install-macos
@@ -237,47 +258,17 @@ jobs:
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest
macos11-dev:
runs-on: macos-11
timeout-minutes: 60
env:
CC: clang
CXX: clang++
BUILD_TYPE: Dev
WITH_PROJ: OFF
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-macos
- uses: ./.github/actions/install-protozero
- uses: ./.github/actions/cmake
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest
macos11-release:
runs-on: macos-11
timeout-minutes: 60
env:
CC: clang
CXX: clang++
BUILD_TYPE: Release
WITH_PROJ: OFF
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-macos
- uses: ./.github/actions/install-protozero
- uses: ./.github/actions/cmake
- uses: ./.github/actions/build
- uses: ./.github/actions/ctest
windows-2019-minimal:
runs-on: windows-2019
windows-minimal:
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
os:
- windows-2019
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- uses: ./.github/actions/install-windows
@@ -289,7 +280,7 @@ jobs:
windows-2019-full:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- uses: ./.github/actions/install-windows
@@ -301,16 +292,3 @@ jobs:
- uses: ./.github/actions/build-windows
- uses: ./.github/actions/ctest-windows
windows-2022-minimal:
runs-on: windows-2022
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-windows
- uses: ./.github/actions/install-protozero
- uses: ./.github/actions/cmake-windows
- uses: ./.github/actions/build-windows
- uses: ./.github/actions/ctest-windows
+21 -22
View File
@@ -3,7 +3,6 @@ name: clang-tidy
on: workflow_dispatch
jobs:
clang-tidy:
runs-on: ubuntu-latest
strategy:
@@ -14,9 +13,9 @@ jobs:
- image: "debian:bullseye"
clang: 11
- image: "debian:testing"
clang: 12
clang: 15
- image: "debian:experimental"
clang: 14
clang: 15
container:
image: ${{ matrix.image }}
env:
@@ -25,29 +24,29 @@ jobs:
CXX: clang++-${{ matrix.clang }}
CPP_VERSION: c++11
WITH_PROJ: ON
APT_LISTCHANGES_FRONTEND: none
DEBIAN_FRONTEND: noninteractive
steps:
- name: Prepare container (apt)
run: |
export APT_LISTCHANGES_FRONTEND=none
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -y \
clang-${{ matrix.clang }} \
clang-tidy-${{ matrix.clang }} \
cmake \
git \
libboost-dev \
libbz2-dev \
libexpat1-dev \
libgdal-dev \
libgeos++-dev \
liblz4-dev \
libproj-dev \
libsparsehash-dev \
make \
zlib1g-dev
apt-get install -yq \
clang-${{ matrix.clang }} \
clang-tidy-${{ matrix.clang }} \
cmake \
git \
libboost-dev \
libbz2-dev \
libexpat1-dev \
libgdal-dev \
libgeos++-dev \
liblz4-dev \
libproj-dev \
libsparsehash-dev \
make \
zlib1g-dev
shell: bash
# Use v1 of checkout because v2 doesn't work with submodules
# Use v1 of checkout because v3 doesn't work with submodules
- uses: actions/checkout@v1
with:
submodules: true
@@ -58,7 +57,7 @@ jobs:
shell: bash
working-directory: build
- name: Upload Log
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: always()
with:
name: clang-tidy-${{ matrix.clang }}-log
-53
View File
@@ -1,53 +0,0 @@
#-----------------------------------------------------------------------------
#
# Configuration for YouCompleteMe Vim plugin
#
# https://valloric.github.io/YouCompleteMe/
#
#-----------------------------------------------------------------------------
from os.path import realpath, dirname
basedir = dirname(realpath(__file__))
# some default flags
# for more information install clang-3.2-doc package and
# check UsersManual.html
flags = [
'-Werror',
'-Wall',
'-Wextra',
'-pedantic',
'-Wno-return-type',
'-Wno-unused-parameter',
'-Wno-unused-variable',
'-std=c++11',
# '-x' and 'c++' also required
# use 'c' for C projects
'-x',
'c++',
# workaround for https://github.com/Valloric/YouCompleteMe/issues/303
# also see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=800618
'-isystem',
'/usr/lib/ycmd/clang_includes/',
# libosmium include dirs
'-I%s/include' % basedir,
'-I%s/test/include' % basedir,
'-I%s/test/data-test/include' % basedir,
# include third party libraries
'-I/usr/include/gdal',
]
# youcompleteme is calling this function to get flags
# You can also set database for flags. Check: JSONCompilationDatabase.html in
# clang-3.2-doc package
def FlagsForFile( filename ):
return {
'flags': flags,
'do_cache': True
}
+35 -1
View File
@@ -12,6 +12,38 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Fixed
## [2.20.0] - 2023-09-20
### Changed
* Optionally allow fractional seconds in timestamps in OSM files.
* Enable `posix_fadvise` usage on FreeBSD.
* Make parsing PBFs a bit less picky.
* Various small code cleanups.
### Fixed
* Don't use class template arguments on `GeometryFactory` constructor
definition.
## [2.19.0] - 2023-01-19
### Changed
* Mark RapidJSON support as deprecated.
* Update included Catch to v2.13.10.
* Remove deprecated BoolVector class.
* Remove deprecated NWRIdSet class.
* Remove deprecated AssemblerConfig constructor.
* Print start of offending string in overlong string exception.
* Implement `set_thread_name()` on FreeBSD.
* Some small code cleanups.
### Fixed
* Fix return type in `MembersDatabaseCommon::count_not_removed()`.
* Make bzip2 unit tests pass on musl-based systems.
* Fix bug in members database test case.
## [2.18.0] - 2022-02-07
@@ -1253,7 +1285,9 @@ long time. These will not be part of the next version of libosmium:
Doxygen (up to version 1.8.8). This version contains a workaround to fix
this.
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.18.0...HEAD
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.20.0...HEAD
[2.20.0]: https://github.com/osmcode/libosmium/compare/v2.19.0...v2.20.0
[2.19.0]: https://github.com/osmcode/libosmium/compare/v2.18.9...v2.19.0
[2.18.0]: https://github.com/osmcode/libosmium/compare/v2.17.3...v2.18.0
[2.17.3]: https://github.com/osmcode/libosmium/compare/v2.17.2...v2.17.3
[2.17.2]: https://github.com/osmcode/libosmium/compare/v2.17.1...v2.17.2
+2 -2
View File
@@ -39,7 +39,7 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Cover
project(libosmium)
set(LIBOSMIUM_VERSION_MAJOR 2)
set(LIBOSMIUM_VERSION_MINOR 18)
set(LIBOSMIUM_VERSION_MINOR 20)
set(LIBOSMIUM_VERSION_PATCH 0)
set(LIBOSMIUM_VERSION
@@ -427,7 +427,7 @@ endif()
#
#-----------------------------------------------------------------------------
message(STATUS "Looking for clang-tidy")
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11)
find_program(CLANG_TIDY NAMES clang-tidy clang-tidy-16 clang-tidy-15 clang-tidy-14 clang-tidy-13 clang-tidy-12 clang-tidy-11)
if(CLANG_TIDY)
message(STATUS "Looking for clang-tidy - found ${CLANG_TIDY}")
+1 -2
View File
@@ -136,8 +136,7 @@ directory, some data tests in `test/osm-testdata` and tests of the examples in
`test/examples`. They are built by the default cmake config. Run `ctest` to
run them. We can always use more tests.
Tests are run automatically using Github Actions (Linux/macOS) and Appveyor
(Windows) services.
Tests are run automatically using Github Actions.
## Documenting the code
+2 -12
View File
@@ -7,8 +7,6 @@ A fast and flexible C++ library for working with OpenStreetMap data.
Libosmium works on Linux, macOS and Windows.
[![Github Build Status](https://github.com/osmcode/libosmium/workflows/CI/badge.svg?branch=master)](https://github.com/osmcode/libosmium/actions)
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/yy099a4vxcb604rn/branch/master?svg=true)](https://ci.appveyor.com/project/lonvia/libosmium-eq41p/branch/master)
[![Coverage Status](https://codecov.io/gh/osmcode/libosmium/branch/master/graph/badge.svg)](https://codecov.io/gh/osmcode/libosmium)
[![Packaging status](https://repology.org/badge/tiny-repos/libosmium.svg)](https://repology.org/metapackage/libosmium)
Please see the [Libosmium manual](https://osmcode.org/libosmium/manual.html)
@@ -17,9 +15,8 @@ for more details than this README can provide.
## Prerequisites
Because Libosmium uses many C++11 features you need a modern compiler and
standard C++ library. Osmium needs at least GCC 4.8 or clang (LLVM) 3.4.
(Some parts may work with older versions.)
You need a C++11 compiler and standard C++ library. Osmium needs at least GCC
4.8 or clang (LLVM) 3.4. (Some parts may work with older versions.)
Different parts of Libosmium (and the applications built on top of it) need
different libraries. You DO NOT NEED to install all of them, just install those
@@ -88,13 +85,6 @@ See the
for instructions.
## Switching from the old Osmium
If you have been using the old version of Osmium at
https://github.com/joto/osmium you might want to read about the [changes
needed](https://osmcode.org/libosmium/manual.html#changes-from-old-versions-of-osmium).
## License
Libosmium is available under the Boost Software License. See LICENSE.
@@ -47,7 +47,7 @@ int main(int argc, char* argv[]) {
try {
const std::string input_filename{argv[1]};
osmium::memory::Buffer buffer{osmium::io::read_file(input_filename)};
const osmium::memory::Buffer buffer{osmium::io::read_file(input_filename)};
const auto& map_factory = osmium::index::MapFactory<osmium::unsigned_object_id_type, osmium::Location>::instance();
@@ -18,12 +18,12 @@ int main(int argc, char* argv[]) {
}
try {
std::string input_filename{argv[1]};
std::string output_filename{argv[2]};
const std::string input_filename{argv[1]};
const std::string output_filename{argv[2]};
osmium::io::Reader reader{input_filename};
osmium::io::File output_file{output_filename, "pbf"};
osmium::io::Header header;
const osmium::io::File output_file{output_filename, "pbf"};
const osmium::io::Header header;
osmium::io::Writer writer{output_file, header, osmium::io::overwrite::allow};
while (osmium::memory::Buffer buffer = reader.read()) { // NOLINT(bugprone-use-after-move) Bug in clang-tidy https://bugs.llvm.org/show_bug.cgi?id=36516
+8 -1
View File
@@ -24,6 +24,11 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
SET PATH=C:/projects/bzip2.v140.1.0.6.9/build/native/bin/x64/%config%;%PATH%
nuget install lz4 -Version 1.3.1.2
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
SET PATH=C:/projects/lz4.1.3.1.2/build/native/bin/x64/%config%;%PATH%
CD libosmium
ECHO config^: %config%
@@ -52,7 +57,9 @@ SET CMAKE_CMD=cmake .. -LA -G "Visual Studio 14 Win64" ^
-DEXPAT_INCLUDE_DIR=C:/projects/expat.v140.2.2.5/build/native/include ^
-DEXPAT_LIBRARY=C:/projects/expat.v140.2.2.5/build/native/lib/x64/%config%/libexpat%libpostfix%.lib ^
-DBZIP2_INCLUDE_DIR=C:/projects/bzip2.v140.1.0.6.9/build/native/include ^
-DBZIP2_LIBRARIES=C:/projects/bzip2.v140.1.0.6.9/build/native/lib/x64/%config%/libbz2%libpostfix%.lib
-DBZIP2_LIBRARIES=C:/projects/bzip2.v140.1.0.6.9/build/native/lib/x64/%config%/libbz2%libpostfix%.lib ^
-DLZ4_INCLUDE_DIR=C:/projects/lz4.1.3.1.2/build/native/include ^
-DLZ4_LIBRARY=C:/projects/lz4.1.3.1.2/build/native/lib/x64/%config%/liblz4%libpostfix%.lib
ECHO calling^: %CMAKE_CMD%
%CMAKE_CMD%
+2 -1
View File
@@ -16,8 +16,9 @@ call C:\msys64\mingw64\bin\gem.cmd install json
REM Workaround for problem with spatialite (see https://github.com/osmcode/libosmium/issues/262)
copy /y C:\msys64\mingw64\bin\libreadline8.dll C:\msys64\mingw64\bin\libreadline7.dll
echo "Setting PROJ_LIB variable for correct PROJ.4 working"
echo "Setting PROJ_LIB/DATA variable for correct PROJ.4 working"
set PROJ_LIB=c:\msys64\mingw64\share\proj
set PROJ_DATA=c:\msys64\mingw64\share\proj
set CXXFLAGS=-Wno-stringop-overflow
+2 -2
View File
@@ -74,8 +74,8 @@ class AmenityHandler : public osmium::handler::Handler {
c.y += nr.lat();
}
c.x /= nr_list.size();
c.y /= nr_list.size();
c.x /= static_cast<double>(nr_list.size());
c.y /= static_cast<double>(nr_list.size());
return c;
}
+2 -2
View File
@@ -122,11 +122,11 @@ int main(int argc, char* argv[]) {
return 1;
}
osmium::io::File input_file{argv[2]};
const osmium::io::File input_file{argv[2]};
// Configuration for the multipolygon assembler. Here the default settings
// are used, but you could change multiple settings.
osmium::area::Assembler::config_type assembler_config;
const osmium::area::Assembler::config_type assembler_config;
// Set up a filter matching only forests. This will be used to only build
// areas with matching tags.
+2 -2
View File
@@ -153,8 +153,8 @@ int main(int argc, char* argv[]) {
}
// Get input and output file names from command line.
std::string input_file_name{argv[1]};
std::string output_file_name{argv[2]};
const std::string input_file_name{argv[1]};
const std::string output_file_name{argv[2]};
try {
// Initialize Reader
+2 -2
View File
@@ -68,7 +68,7 @@ int main(int argc, char* argv[]) {
try {
// The Reader is initialized here with an osmium::io::File, but could
// also be directly initialized with a file name.
osmium::io::File input_file{argv[1]};
const osmium::io::File input_file{argv[1]};
osmium::io::Reader reader{input_file};
// Create an instance of our own CountHandler and push the data from the
@@ -88,7 +88,7 @@ int main(int argc, char* argv[]) {
// (though not this one) can use huge amounts of data. So checking actual
// memore usage is often useful and can be done easily with this class.
// (Currently only works on Linux, not macOS and Windows.)
osmium::MemoryUsage memory;
const osmium::MemoryUsage memory;
std::cout << "\nMemory used: " << memory.peak() << " MBytes\n";
} catch (const std::exception& e) {
+2 -2
View File
@@ -40,11 +40,11 @@ int main(int argc, char* argv[]) {
}
// Get output file name from command line.
std::string output_file_name{argv[1]};
const std::string output_file_name{argv[1]};
// If output file name is "-", this means STDOUT. Set the OPL file type
// in this case. Otherwise take the file type from the file name suffix.
osmium::io::File output_file{output_file_name, output_file_name == "-" ? ".opl" : ""};
const osmium::io::File output_file{output_file_name, output_file_name == "-" ? ".opl" : ""};
try {
// Create a buffer where all objects will live. Use a sensible initial
+1 -1
View File
@@ -43,7 +43,7 @@ int main(int argc, char* argv[]) {
// Get entity types from command line if there is a 2nd argument.
if (argc == 3) {
read_types = osmium::osm_entity_bits::nothing;
std::string types = argv[2];
const std::string types = argv[2];
if (types.find('n') != std::string::npos) {
read_types |= osmium::osm_entity_bits::node;
}
+7 -7
View File
@@ -165,31 +165,31 @@ int main(int argc, char* argv[]) {
reader.close();
// Write out node, way, and relation offset indexes to disk.
IndexFile nodes_idx{output_dir + "/nodes.idx"};
const IndexFile nodes_idx{output_dir + "/nodes.idx"};
node_index.dump_as_list(nodes_idx.fd());
IndexFile ways_idx{output_dir + "/ways.idx"};
const IndexFile ways_idx{output_dir + "/ways.idx"};
way_index.dump_as_list(ways_idx.fd());
IndexFile relations_idx{output_dir + "/relations.idx"};
const IndexFile relations_idx{output_dir + "/relations.idx"};
relation_index.dump_as_list(relations_idx.fd());
// Sort the maps (so later binary search will work on them) and write
// them to disk.
map_node2way.sort();
IndexFile node2way_idx{output_dir + "/node2way.map"};
const IndexFile node2way_idx{output_dir + "/node2way.map"};
map_node2way.dump_as_list(node2way_idx.fd());
map_node2relation.sort();
IndexFile node2relation_idx{output_dir + "/node2rel.map"};
const IndexFile node2relation_idx{output_dir + "/node2rel.map"};
map_node2relation.dump_as_list(node2relation_idx.fd());
map_way2relation.sort();
IndexFile way2relation_idx{output_dir + "/way2rel.map"};
const IndexFile way2relation_idx{output_dir + "/way2rel.map"};
map_way2relation.dump_as_list(way2relation_idx.fd());
map_relation2relation.sort();
IndexFile relation2relation_idx{output_dir + "/rel2rel.map"};
const IndexFile relation2relation_idx{output_dir + "/rel2rel.map"};
map_relation2relation.dump_as_list(relation2relation_idx.fd());
} catch (const std::exception& e) {
// All exceptions used by the Osmium library derive from std::exception.
@@ -47,10 +47,10 @@ int main(int argc, char* argv[]) {
try {
// The input file, deduce file format from file suffix.
osmium::io::File input_file{argv[1]};
const osmium::io::File input_file{argv[1]};
// The output file, force XML OSM file format.
osmium::io::File output_file{argv[2], "osm"};
const osmium::io::File output_file{argv[2], "osm"};
// Initialize Reader for the input file.
// Read only changesets (will ignore nodes, ways, and
+7 -7
View File
@@ -67,8 +67,8 @@ public:
IndexAccess(const IndexAccess&) = delete;
IndexAccess& operator=(const IndexAccess&) = delete;
IndexAccess(IndexAccess&&) = delete;
IndexAccess& operator=(IndexAccess&&) = delete;
IndexAccess(IndexAccess&&) noexcept = delete;
IndexAccess& operator=(IndexAccess&&) noexcept = delete;
virtual ~IndexAccess() noexcept = default;
@@ -106,7 +106,7 @@ public:
~IndexAccessDense() noexcept override = default;
void dump() const override {
index_type index{this->fd()};
const index_type index{this->fd()};
for (std::size_t i = 0; i < index.size(); ++i) {
if (index.get(i) != TValue{}) {
@@ -116,7 +116,7 @@ public:
}
bool search(const osmium::unsigned_object_id_type& key) const override {
index_type index{this->fd()};
const index_type index{this->fd()};
try {
TValue value = index.get(key);
@@ -153,7 +153,7 @@ public:
~IndexAccessSparse() noexcept override = default;
void dump() const override {
index_type index{this->fd()};
const index_type index{this->fd()};
for (const auto& element : index) {
std::cout << element.first << " " << element.second << "\n";
@@ -164,7 +164,7 @@ public:
using element_type = typename index_type::element_type;
index_type index{this->fd()};
element_type elem{key, TValue{}};
const element_type elem{key, TValue{}};
const auto positions = std::equal_range(index.begin(),
index.end(),
elem,
@@ -347,7 +347,7 @@ int run(const IndexAccess<TValue>& index, const Options& options) {
int main(int argc, char* argv[]) {
// Parse command line options.
Options options{argc, argv};
const Options options{argc, argv};
// Open the index file.
const int fd = ::open(options.filename(), O_RDWR);
+2 -2
View File
@@ -27,11 +27,11 @@ int main(int argc, char* argv[]) {
try {
// The Reader is initialized here with an osmium::io::File, but could
// also be directly initialized with a file name.
osmium::io::File input_file{argv[1]};
const osmium::io::File input_file{argv[1]};
osmium::io::Reader reader{input_file};
// OSM data comes in buffers, read until there are no more.
while (osmium::memory::Buffer buffer = reader.read()) {
while (const osmium::memory::Buffer buffer = reader.read()) {
// do nothing
}
@@ -34,14 +34,14 @@ int main(int argc, char* argv[]) {
try {
// The Reader is initialized here with an osmium::io::File, but could
// also be directly initialized with a file name.
osmium::io::File input_file{argv[1]};
const osmium::io::File input_file{argv[1]};
osmium::io::Reader reader{input_file};
// Initialize progress bar, enable it only if STDERR is a TTY.
osmium::ProgressBar progress{reader.file_size(), osmium::isatty(2)};
// OSM data comes in buffers, read until there are no more.
while (osmium::memory::Buffer buffer = reader.read()) {
while (const osmium::memory::Buffer buffer = reader.read()) {
// Update progress bar for each buffer.
progress.update(reader.offset());
}
+1 -1
View File
@@ -68,7 +68,7 @@ int main(int argc, char* argv[]) {
// Create a tile at this location. This will also internally use the
// Mercator projection and then calculate the tile coordinates.
const osmium::geom::Tile tile{uint32_t(zoom), location};
const osmium::geom::Tile tile{static_cast<uint32_t>(zoom), location};
std::cout << "Tile: zoom=" << tile.z << " x=" << tile.x << " y=" << tile.y << "\n";
}
+2 -2
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -213,7 +213,7 @@ namespace osmium {
// Now create the Area object and add the attributes and tags
// from the relation.
bool okay = create_area(out_buffer, relation, members);
const bool okay = create_area(out_buffer, relation, members);
if (okay) {
out_buffer.commit();
} else {
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -124,15 +124,6 @@ namespace osmium {
AssemblerConfig() noexcept = default;
/**
* Constructor
* @deprecated Use default constructor and set values afterwards.
*/
explicit AssemblerConfig(ProblemReporter* pr, bool d = false) :
problem_reporter(pr),
debug_level(d) {
}
}; // struct AssemblerConfig
} // namespace area
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -332,10 +332,10 @@ namespace osmium {
if (!way.nodes().empty() && way.is_closed() && !way.tags().empty()) {
const auto d = std::count_if(way.tags().cbegin(), way.tags().cend(), std::cref(filter()));
if (d > 0) {
osmium::tags::KeyFilter::iterator way_fi_begin(std::cref(filter()), way.tags().cbegin(), way.tags().cend());
osmium::tags::KeyFilter::iterator way_fi_end(std::cref(filter()), way.tags().cend(), way.tags().cend());
osmium::tags::KeyFilter::iterator area_fi_begin(std::cref(filter()), area_tags.cbegin(), area_tags.cend());
osmium::tags::KeyFilter::iterator area_fi_end(std::cref(filter()), area_tags.cend(), area_tags.cend());
const osmium::tags::KeyFilter::iterator way_fi_begin(std::cref(filter()), way.tags().cbegin(), way.tags().cend());
const osmium::tags::KeyFilter::iterator way_fi_end(std::cref(filter()), way.tags().cend(), way.tags().cend());
const osmium::tags::KeyFilter::iterator area_fi_begin(std::cref(filter()), area_tags.cbegin(), area_tags.cend());
const osmium::tags::KeyFilter::iterator area_fi_end(std::cref(filter()), area_tags.cend(), area_tags.cend());
#ifdef __cpp_lib_robust_nonmodifying_seq_ops
if (!std::equal(way_fi_begin, way_fi_end, area_fi_begin, area_fi_end)) {
#else
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -608,7 +608,7 @@ namespace osmium {
void create_rings_simple_case() {
auto count_remaining = m_segment_list.size();
for (slocation& sl : m_locations) {
for (const slocation& sl : m_locations) {
const NodeRefSegment& segment = m_segment_list[sl.item];
if (!segment.is_done()) {
count_remaining -= add_new_ring(sl);
@@ -671,7 +671,7 @@ namespace osmium {
std::cerr << " Trying to merge " << open_ring_its.size() << " open rings (try_to_merge)\n";
}
std::vector<location_to_ring_map> xrings = create_location_to_ring_map(open_ring_its);
const auto xrings = create_location_to_ring_map(open_ring_its);
auto it = xrings.cbegin();
while (it != xrings.cend()) {
@@ -825,7 +825,7 @@ namespace osmium {
find_inner_outer_complex();
ProtoRing* outer_ring = find_enclosing_ring(ring_min->ring().min_segment());
bool ring_min_is_outer = !outer_ring;
const bool ring_min_is_outer = !outer_ring;
if (debug()) {
std::cerr << " Open ring is " << (ring_min_is_outer ? "outer" : "inner") << " ring\n";
}
@@ -924,7 +924,7 @@ namespace osmium {
// Now find all the rest of the rings (ie not starting at split locations)
if (count_remaining > 0) {
for (slocation& sl : m_locations) {
for (const slocation& sl : m_locations) {
const NodeRefSegment& segment = m_segment_list[sl.item];
if (!segment.is_done()) {
count_remaining -= add_new_ring_complex(sl);
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -193,7 +193,7 @@ namespace osmium {
const char* role_name() const noexcept {
static const std::array<const char*, 4> names = {{"unknown", "outer", "inner", "empty"}};
return names[int(m_role)];
return names[static_cast<int>(m_role)];
}
const osmium::Way* way() const noexcept {
@@ -327,9 +327,9 @@ namespace osmium {
if ((d > 0 && na >= 0 && na <= d && nb >= 0 && nb <= d) ||
(d < 0 && na <= 0 && na >= d && nb <= 0 && nb >= d)) {
const double ua = double(na) / d;
const double ua = static_cast<double>(na) / static_cast<double>(d);
const vec i = p0 + ua * (p1 - p0);
return osmium::Location{int32_t(i.x), int32_t(i.y)};
return osmium::Location{static_cast<int32_t>(i.x), static_cast<int32_t>(i.y)};
}
return osmium::Location{};
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -86,16 +86,16 @@ namespace osmium {
int64_t m_num;
#endif
int64_t m_sum;
int64_t m_sum = 0;
public:
explicit ProtoRing(NodeRefSegment* segment) noexcept :
m_min_segment(segment),
m_min_segment(segment)
#ifdef OSMIUM_DEBUG_RING_NO
m_num(next_num()),
, m_num(next_num())
#endif
m_sum(0) {
{
add_segment_back(segment);
}
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -333,7 +333,7 @@ namespace osmium {
}
if (y_range_overlap(s1, s2)) {
osmium::Location intersection{calculate_intersection(s1, s2)};
const osmium::Location intersection{calculate_intersection(s1, s2)};
if (intersection) {
++found_intersections;
if (m_debug) {
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -89,12 +89,12 @@ namespace osmium {
// scale vector
constexpr inline vec operator*(double s, const vec& v) noexcept {
return vec{int64_t(s * v.x), int64_t(s * v.y)};
return vec{static_cast<int64_t>(s * static_cast<double>(v.x)), static_cast<int64_t>(s * static_cast<double>(v.y))};
}
// scale vector
constexpr inline vec operator*(const vec& v, double s) noexcept {
return vec{int64_t(s * v.x), int64_t(s * v.y)};
return vec{static_cast<int64_t>(s * static_cast<double>(v.x)), static_cast<int64_t>(s * static_cast<double>(v.y))};
}
// equality
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -75,15 +75,15 @@ namespace osmium {
void set_object(gdalcpp::Feature& feature) {
const char t[2] = {osmium::item_type_to_char(m_object_type), '\0'};
feature.set_field("obj_type", t);
feature.set_field("obj_id", int32_t(m_object_id));
feature.set_field("nodes", int32_t(m_nodes));
feature.set_field("obj_id", static_cast<int32_t>(m_object_id));
feature.set_field("nodes", static_cast<int32_t>(m_nodes));
}
void write_point(const char* problem_type, osmium::object_id_type id1, osmium::object_id_type id2, osmium::Location location) {
gdalcpp::Feature feature{m_layer_perror, m_ogr_factory.create_point(location)};
set_object(feature);
feature.set_field("id1", double(id1));
feature.set_field("id2", double(id2));
feature.set_field("id1", static_cast<double>(id1));
feature.set_field("id2", static_cast<double>(id2));
feature.set_field("problem", problem_type);
feature.add_to_layer();
}
@@ -176,7 +176,7 @@ namespace osmium {
try {
gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)};
set_object(feature);
feature.set_field("id1", int32_t(way.id()));
feature.set_field("id1", static_cast<int32_t>(way.id()));
feature.set_field("id2", 0);
feature.set_field("problem", "way_in_multiple_rings");
feature.add_to_layer();
@@ -192,7 +192,7 @@ namespace osmium {
try {
gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)};
set_object(feature);
feature.set_field("id1", int32_t(way.id()));
feature.set_field("id1", static_cast<int32_t>(way.id()));
feature.set_field("id2", 0);
feature.set_field("problem", "inner_with_same_tags");
feature.add_to_layer();
@@ -208,7 +208,7 @@ namespace osmium {
try {
gdalcpp::Feature feature{m_layer_lerror, m_ogr_factory.create_linestring(way)};
set_object(feature);
feature.set_field("id1", int32_t(way.id()));
feature.set_field("id1", static_cast<int32_t>(way.id()));
feature.set_field("id2", 0);
feature.set_field("problem", "duplicate_way");
feature.add_to_layer();
@@ -229,7 +229,7 @@ namespace osmium {
try {
gdalcpp::Feature feature{m_layer_ways, m_ogr_factory.create_linestring(way)};
set_object(feature);
feature.set_field("way_id", int32_t(way.id()));
feature.set_field("way_id", static_cast<int32_t>(way.id()));
feature.add_to_layer();
} catch (const osmium::geometry_error&) {
// XXX
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -125,8 +125,8 @@ namespace osmium {
if (value_length > osmium::max_osm_string_length) {
throw std::length_error{"OSM tag value is too long"};
}
add_size(append_with_zero(key, osmium::memory::item_size_type(key_length)));
add_size(append_with_zero(value, osmium::memory::item_size_type(value_length)));
add_size(append_with_zero(key, static_cast<osmium::memory::item_size_type>(key_length)));
add_size(append_with_zero(value, static_cast<osmium::memory::item_size_type>(value_length)));
}
/**
@@ -142,8 +142,8 @@ namespace osmium {
if (value.size() > osmium::max_osm_string_length) {
throw std::length_error{"OSM tag value is too long"};
}
add_size(append(key.data(), osmium::memory::item_size_type(key.size()) + 1));
add_size(append(value.data(), osmium::memory::item_size_type(value.size()) + 1));
add_size(append(key.data(), static_cast<osmium::memory::item_size_type>(key.size()) + 1));
add_size(append(value.data(), static_cast<osmium::memory::item_size_type>(value.size()) + 1));
}
/**
@@ -240,8 +240,8 @@ namespace osmium {
if (length > osmium::max_osm_string_length) {
throw std::length_error{"OSM relation member role is too long"};
}
member.set_role_size(osmium::string_size_type(length) + 1);
add_size(append_with_zero(role, osmium::memory::item_size_type(length)));
member.set_role_size(static_cast<osmium::string_size_type>(length) + 1);
add_size(append_with_zero(role, static_cast<osmium::memory::item_size_type>(length)));
add_padding(true);
}
@@ -330,16 +330,16 @@ namespace osmium {
if (length > osmium::max_osm_string_length) {
throw std::length_error{"OSM user name is too long"};
}
comment.set_user_size(osmium::string_size_type(length) + 1);
add_size(append_with_zero(user, osmium::memory::item_size_type(length)));
comment.set_user_size(static_cast<osmium::string_size_type>(length) + 1);
add_size(append_with_zero(user, static_cast<osmium::memory::item_size_type>(length)));
}
void add_text(osmium::ChangesetComment& comment, const char* text, const std::size_t length) {
if (length > std::numeric_limits<osmium::changeset_comment_size_type>::max() - 1) {
throw std::length_error{"OSM changeset comment is too long"};
}
comment.set_text_size(osmium::changeset_comment_size_type(length) + 1);
add_size(append_with_zero(text, osmium::memory::item_size_type(length)));
comment.set_text_size(static_cast<osmium::changeset_comment_size_type>(length) + 1);
add_size(append_with_zero(text, static_cast<osmium::memory::item_size_type>(length)));
add_padding(true);
}
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+4 -4
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
@@ -166,7 +166,7 @@ namespace osmium {
public:
GeometryFactory<TGeomImpl, TProjection>() :
GeometryFactory() :
m_projection(),
m_impl(m_projection.epsg()) {
}
@@ -175,7 +175,7 @@ namespace osmium {
* Constructor for default initialized projection.
*/
template <typename... TArgs>
explicit GeometryFactory<TGeomImpl, TProjection>(TArgs&&... args) :
explicit GeometryFactory(TArgs&&... args) :
m_projection(),
m_impl(m_projection.epsg(), std::forward<TArgs>(args)...) {
}
@@ -185,7 +185,7 @@ namespace osmium {
* projection is moved into the GeometryFactory.
*/
template <typename... TArgs>
explicit GeometryFactory<TGeomImpl, TProjection>(TProjection&& projection, TArgs&&... args) :
explicit GeometryFactory(TProjection&& projection, TArgs&&... args) :
m_projection(std::move(projection)),
m_impl(m_projection.epsg(), std::forward<TArgs>(args)...) {
}
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003
+1 -1
View File
@@ -5,7 +5,7 @@
This file is part of Osmium (https://osmcode.org/libosmium).
Copyright 2013-2022 Jochen Topf <jochen@topf.org> and others (see README).
Copyright 2013-2023 Jochen Topf <jochen@topf.org> and others (see README).
Boost Software License - Version 1.0 - August 17th, 2003

Some files were not shown because too many files have changed in this diff Show More