...
 
Commits (12)
...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
language: generic language: generic
sudo: false dist: xenial
dist: trusty
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
...@@ -32,182 +30,138 @@ addons_shortcuts: ...@@ -32,182 +30,138 @@ addons_shortcuts:
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.5'] packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.5']
addons_clang38: &clang38 addons_clang38: &clang38
apt: apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ] packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.8']
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.8']
addons_clang39: &clang39 addons_clang39: &clang39
apt: apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ] packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.9']
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-3.9']
addons_clang50: &clang50 addons_clang50: &clang50
apt: apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest', 'llvm-toolchain-trusty-5.0' ] sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-5.0', 'g++-6', 'gcc-6'] packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-5.0', 'g++-6', 'gcc-6']
addons_clang60: &clang60 addons_clang60: &clang60
apt: apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest', 'llvm-toolchain-trusty-6.0' ] sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-6.0', 'g++-6', 'gcc-6'] packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'clang-6.0', 'g++-6', 'gcc-6']
addons_gcc48: &gcc48 addons_gcc48: &gcc48
apt: apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ] packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.8', 'gcc-4.8' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.8', 'gcc-4.8' ]
addons_gcc49: &gcc49 addons_gcc49: &gcc49
apt: apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ] packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.9', 'gcc-4.9' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-4.9', 'gcc-4.9' ]
addons_gcc5: &gcc5 addons_gcc5: &gcc5
apt: apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ] packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-5', 'gcc-5' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-5', 'gcc-5' ]
addons_gcc6: &gcc6 addons_gcc6: &gcc6
apt: apt:
sources: [ 'ubuntu-toolchain-r-test', 'boost-latest' ] sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libboost1.55-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-6', 'gcc-6' ] packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-6', 'gcc-6' ]
addons_gcc7: &gcc7
apt:
sources: [ 'ubuntu-toolchain-r-test' ]
packages: [ 'libboost-all-dev', 'libgdal-dev', 'libproj-dev', 'libsparsehash-dev', 'spatialite-bin', 'g++-7', 'gcc-7' ]
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
matrix: matrix:
include: include:
# 1/ Linux Clang Builds # Linux Clang Builds
- os: linux
compiler: linux-clang35-release
env: CC='clang-3.5' CXX='clang++-3.5' BUILD_TYPE='Release'
addons: *clang35
- os: linux - os: linux
compiler: linux-clang35-dev compiler: linux-clang35-dev
env: CC='clang-3.5' CXX='clang++-3.5' BUILD_TYPE='Dev' env: CC='clang-3.5' CXX='clang++-3.5' BUILD_TYPE='Dev'
addons: *clang35 addons: *clang35
dist: trusty
- os: linux
compiler: linux-clang38-release
env: CC='clang-3.8' CXX='clang++-3.8' BUILD_TYPE='Release'
addons: *clang38
- os: linux - os: linux
compiler: linux-clang38-dev compiler: linux-clang38-dev
env: CC='clang-3.8' CXX='clang++-3.8' BUILD_TYPE='Dev' env: CC='clang-3.8' CXX='clang++-3.8' BUILD_TYPE='Dev'
addons: *clang38 addons: *clang38
- os: linux
compiler: linux-clang39-release
env: CC='clang-3.9' CXX='clang++-3.9' BUILD_TYPE='Release'
addons: *clang39
- os: linux - os: linux
compiler: linux-clang39-dev compiler: linux-clang39-dev
env: CC='clang-3.9' CXX='clang++-3.9' BUILD_TYPE='Dev' env: CC='clang-3.9' CXX='clang++-3.9' BUILD_TYPE='Dev'
addons: *clang39 addons: *clang39
- os: linux
compiler: linux-clang50-release
env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Release'
addons: *clang50
- os: linux - os: linux
compiler: linux-clang50-dev compiler: linux-clang50-dev
env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Dev' env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Dev'
addons: *clang50 addons: *clang50
- os: linux - os: linux
compiler: linux-clang60-release compiler: linux-clang60-dev
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Release' env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Dev'
addons: *clang60 addons: *clang60
- os: linux - os: linux
compiler: linux-clang60-dev compiler: linux-clang60-debug
env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Dev' env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Debug'
CXXFLAGS="-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
LDFLAGS="-fsanitize=address,undefined,integer"
addons: *clang60 addons: *clang60
# Disabled because it creates false-positives on the old travis systems
# - os: linux
# compiler: linux-clang50-debug
# env: CC='clang-5.0' CXX='clang++-5.0' BUILD_TYPE='Debug'
# CXXFLAGS="-fsanitize=address,undefined,integer -fno-sanitize-recover=all -fno-omit-frame-pointer"
# LDFLAGS="-fsanitize=address,undefined,integer"
# # LSAN doesn't work on container-based system
# sudo: required
# addons: *clang50
# 2/ Linux GCC Builds
- os: linux - os: linux
compiler: linux-gcc48-release compiler: linux-clang60-release
env: CC='gcc-4.8' CXX='g++-4.8' BUILD_TYPE='Release' env: CC='clang-6.0' CXX='clang++-6.0' BUILD_TYPE='Release'
CXXFLAGS='-Wno-return-type' addons: *clang60
addons: *gcc48
# Linux GCC Builds
- os: linux - os: linux
compiler: linux-gcc48-dev compiler: linux-gcc48-dev
env: CC='gcc-4.8' CXX='g++-4.8' BUILD_TYPE='Dev' env: CC='gcc-4.8' CXX='g++-4.8' BUILD_TYPE='Dev'
CXXFLAGS='-Wno-return-type' CXXFLAGS='-Wno-return-type'
addons: *gcc48 addons: *gcc48
- os: linux
compiler: linux-gcc49-release
env: CC='gcc-4.9' CXX='g++-4.9' BUILD_TYPE='Release'
addons: *gcc49
- os: linux - os: linux
compiler: linux-gcc49-dev compiler: linux-gcc49-dev
env: CC='gcc-4.9' CXX='g++-4.9' BUILD_TYPE='Dev' env: CC='gcc-4.9' CXX='g++-4.9' BUILD_TYPE='Dev'
addons: *gcc49 addons: *gcc49
- os: linux
compiler: linux-gcc5-release
env: CC='gcc-5' CXX='g++-5' BUILD_TYPE='Release'
addons: *gcc5
- os: linux - os: linux
compiler: linux-gcc5-dev compiler: linux-gcc5-dev
env: CC='gcc-5' CXX='g++-5' BUILD_TYPE='Dev' env: CC='gcc-5' CXX='g++-5' BUILD_TYPE='Dev'
addons: *gcc5 addons: *gcc5
- os: linux
compiler: linux-gcc6-release
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Release'
addons: *gcc6
- os: linux - os: linux
compiler: linux-gcc6-dev compiler: linux-gcc6-dev
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Dev' env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Dev'
addons: *gcc6 addons: *gcc6
- os: linux - os: linux
compiler: linux-gcc6-coverage compiler: linux-gcc7-dev
env: CC='gcc-6' CXX='g++-6' BUILD_TYPE='Coverage' env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Dev'
addons: *gcc6 addons: *gcc7
# 3/ OSX Clang Builds - os: linux
- os: osx compiler: linux-gcc7-coverage
osx_image: xcode6.4 env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Coverage'
compiler: xcode64-clang-release addons: *gcc7
env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
- os: linux
compiler: linux-gcc7-release
env: CC='gcc-7' CXX='g++-7' BUILD_TYPE='Release'
addons: *gcc7
# OSX Clang Builds
- os: osx - os: osx
osx_image: xcode6.4 osx_image: xcode8.3
compiler: xcode64-clang-dev compiler: xcode83-clang-dev
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev' env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
- os: osx - os: osx
osx_image: xcode7 osx_image: xcode9.4
compiler: xcode7-clang-release compiler: xcode94-clang-dev
env: CC='clang' CXX='clang++' BUILD_TYPE='Release' env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
- os: osx - os: osx
osx_image: xcode7 osx_image: xcode10.1
compiler: xcode7-clang-dev compiler: xcode10-clang-dev
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev' env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
- os: osx - os: osx
osx_image: xcode8.3 osx_image: xcode10.1
compiler: xcode8-clang-release compiler: xcode10-clang-release
env: CC='clang' CXX='clang++' BUILD_TYPE='Release' env: CC='clang' CXX='clang++' BUILD_TYPE='Release'
- os: osx
osx_image: xcode8.3
compiler: xcode8-clang-dev
env: CC='clang' CXX='clang++' BUILD_TYPE='Dev'
install: install:
- git clone --quiet --depth 1 https://github.com/mapbox/protozero.git ../protozero - git clone --quiet --depth 1 https://github.com/mapbox/protozero.git ../protozero
......
...@@ -13,6 +13,34 @@ This project adheres to [Semantic Versioning](https://semver.org/). ...@@ -13,6 +13,34 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Fixed ### Fixed
## [2.15.0] - 2018-12-07
### Added
* Function `dump_as_array()` to dump sparse array indexes.
* Set the `xml_josm_upload` header option when reading XML files.
* New function `OSMObject::remove_tags()` marks tags on OSM objects as
removed.
* More tests.
### Changed
* When reading OSM files Libosmium now has less memory overhead, especially
when reading PBF files. This works by using more, but smaller buffers.
* The `TagsFilter` class is now based on the `TagsFilterBase` template
class which allows setting the result type. This allows the filter to
return more data depending on the rule that matched.
* Use enums for many constants instead of (static) const(expr) variables.
* Make `chunk_bits` in `IdSetDense` configurable.
* Hardcode `%lld` format instead of using `<cinttypes>` PRI macro.
* Update included gdalcpp to version 1.2.0.
### Fixed
* The gzip/bzip2 compression code was overhauled and is better tested now.
This fixes some bugs on Windows.
## [2.14.2] - 2018-07-23 ## [2.14.2] - 2018-07-23
### Fixed ### Fixed
...@@ -869,7 +897,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). ...@@ -869,7 +897,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
Doxygen (up to version 1.8.8). This version contains a workaround to fix Doxygen (up to version 1.8.8). This version contains a workaround to fix
this. this.
[unreleased]: https://github.com/osmcode/libosmium/compare/v2.14.2...HEAD [unreleased]: https://github.com/osmcode/libosmium/compare/v2.15.0...HEAD
[2.15.0]: https://github.com/osmcode/libosmium/compare/v2.14.2...v2.15.0
[2.14.2]: https://github.com/osmcode/libosmium/compare/v2.14.1...v2.14.2 [2.14.2]: https://github.com/osmcode/libosmium/compare/v2.14.1...v2.14.2
[2.14.1]: https://github.com/osmcode/libosmium/compare/v2.14.0...v2.14.1 [2.14.1]: https://github.com/osmcode/libosmium/compare/v2.14.0...v2.14.1
[2.14.0]: https://github.com/osmcode/libosmium/compare/v2.13.1...v2.14.0 [2.14.0]: https://github.com/osmcode/libosmium/compare/v2.13.1...v2.14.0
......
...@@ -12,20 +12,35 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") ...@@ -12,20 +12,35 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
# Project version # Configurations
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS_COVERAGE
"-g -O0 -fno-inline-functions -fno-inline --coverage ${extra_coverage_flags_}"
CACHE STRING "Flags used by the compiler during coverage builds.")
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
"--coverage"
CACHE STRING "Flags used by the linker during coverage builds.")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Coverage" set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel;Dev;Coverage"
CACHE STRING CACHE STRING
"List of available configuration types" "List of available configuration types"
FORCE) FORCE)
#-----------------------------------------------------------------------------
#
# Project version
#
#-----------------------------------------------------------------------------
project(libosmium) project(libosmium)
set(LIBOSMIUM_VERSION_MAJOR 2) set(LIBOSMIUM_VERSION_MAJOR 2)
set(LIBOSMIUM_VERSION_MINOR 14) set(LIBOSMIUM_VERSION_MINOR 15)
set(LIBOSMIUM_VERSION_PATCH 2) set(LIBOSMIUM_VERSION_PATCH 0)
set(LIBOSMIUM_VERSION set(LIBOSMIUM_VERSION
"${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}") "${LIBOSMIUM_VERSION_MAJOR}.${LIBOSMIUM_VERSION_MINOR}.${LIBOSMIUM_VERSION_PATCH}")
...@@ -100,14 +115,6 @@ endif() ...@@ -100,14 +115,6 @@ endif()
# set(extra_coverage_flags_ "-fkeep-inline-functions") # set(extra_coverage_flags_ "-fkeep-inline-functions")
#endif() #endif()
set(CMAKE_CXX_FLAGS_COVERAGE
"-g -O0 -fno-inline-functions -fno-inline --coverage ${extra_coverage_flags_}"
CACHE STRING "Flags used by the compiler during coverage builds.")
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
"--coverage"
CACHE STRING "Flags used by the linker during coverage builds.")
if(CMAKE_BUILD_TYPE STREQUAL "Coverage") if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
if(BUILD_EXAMPLES OR BUILD_HEADERS OR BUILD_BENCHMARKS) if(BUILD_EXAMPLES OR BUILD_HEADERS OR BUILD_BENCHMARKS)
message(WARNING "Coverage builds don't work for anything but the tests") message(WARNING "Coverage builds don't work for anything but the tests")
......
...@@ -68,7 +68,7 @@ cmake: ...@@ -68,7 +68,7 @@ cmake:
This will build the examples and tests. Call `ctest` to run the tests. This will build the examples and tests. Call `ctest` to run the tests.
For more detals see the For more details see the
[Building Libosmium](https://osmcode.org/libosmium/manual.html#building-libosmium) [Building Libosmium](https://osmcode.org/libosmium/manual.html#building-libosmium)
chapter in the manual. chapter in the manual.
......
...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
os: Visual Studio 2017
platform: x64
clone_depth: 1
#-----------------------------------------------------------------------------
environment: environment:
matrix: matrix:
- config: MSYS2 - config: MSYS2
...@@ -17,12 +25,7 @@ environment: ...@@ -17,12 +25,7 @@ environment:
- config: Release - config: Release
autocrlf: false autocrlf: false
clone_depth: 1 #-----------------------------------------------------------------------------
# Operating system (build VM template)
os: Visual Studio 2015
platform: x64
# scripts that are called at very beginning, before repo cloning # scripts that are called at very beginning, before repo cloning
init: init:
......
...@@ -46,7 +46,7 @@ SET CMAKE_CMD=cmake .. -LA -G "Visual Studio 14 Win64" ^ ...@@ -46,7 +46,7 @@ SET CMAKE_CMD=cmake .. -LA -G "Visual Studio 14 Win64" ^
-DOsmium_DEBUG=TRUE ^ -DOsmium_DEBUG=TRUE ^
-DCMAKE_BUILD_TYPE=%config% ^ -DCMAKE_BUILD_TYPE=%config% ^
-DBUILD_HEADERS=OFF ^ -DBUILD_HEADERS=OFF ^
-DBOOST_ROOT=C:/Libraries/boost_1_63_0 ^ -DBOOST_ROOT=C:/Libraries/boost_1_67_0 ^
-DZLIB_INCLUDE_DIR=C:/projects/zlib-vc140-static-64.1.2.11/lib/native/include ^ -DZLIB_INCLUDE_DIR=C:/projects/zlib-vc140-static-64.1.2.11/lib/native/include ^
-DZLIB_LIBRARY=C:/projects/zlib-vc140-static-64.1.2.11/lib/native/libs/x64/static/%config%/zlibstatic.lib ^ -DZLIB_LIBRARY=C:/projects/zlib-vc140-static-64.1.2.11/lib/native/libs/x64/static/%config%/zlibstatic.lib ^
-DEXPAT_INCLUDE_DIR=C:/projects/expat.v140.2.2.5/build/native/include ^ -DEXPAT_INCLUDE_DIR=C:/projects/expat.v140.2.2.5/build/native/include ^
...@@ -68,7 +68,7 @@ msbuild libosmium.sln ^ ...@@ -68,7 +68,7 @@ msbuild libosmium.sln ^
/p:PlatformToolset=v140 %avlogger% /p:PlatformToolset=v140 %avlogger%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ctest --output-on-failure -C %config% -E testdata-overview ctest --output-on-failure -C %config%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR IF %ERRORLEVEL% NEQ 0 GOTO ERROR
GOTO DONE GOTO DONE
......
...@@ -71,6 +71,9 @@ find_path(OSMIUM_INCLUDE_DIR osmium/version.hpp ...@@ -71,6 +71,9 @@ find_path(OSMIUM_INCLUDE_DIR osmium/version.hpp
# Check libosmium version number # Check libosmium version number
if(Osmium_FIND_VERSION) if(Osmium_FIND_VERSION)
if(NOT EXISTS "${OSMIUM_INCLUDE_DIR}/osmium/version.hpp")
message(FATAL_ERROR "Missing ${OSMIUM_INCLUDE_DIR}/osmium/version.hpp. Either your libosmium version is too old, or libosmium wasn't found in the place you said.")
endif()
file(STRINGS "${OSMIUM_INCLUDE_DIR}/osmium/version.hpp" _libosmium_version_define REGEX "#define LIBOSMIUM_VERSION_STRING") file(STRINGS "${OSMIUM_INCLUDE_DIR}/osmium/version.hpp" _libosmium_version_define REGEX "#define LIBOSMIUM_VERSION_STRING")
if("${_libosmium_version_define}" MATCHES "#define LIBOSMIUM_VERSION_STRING \"([0-9.]+)\"") if("${_libosmium_version_define}" MATCHES "#define LIBOSMIUM_VERSION_STRING \"([0-9.]+)\"")
set(_libosmium_version "${CMAKE_MATCH_1}") set(_libosmium_version "${CMAKE_MATCH_1}")
......
libosmium (2.15.0-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
-- Bas Couwenberg <sebastic@debian.org> Mon, 17 Dec 2018 09:48:55 +0100
libosmium (2.15.0-1) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.2.1, no changes.
* Update watch file to limit matches to archive path.
-- Bas Couwenberg <sebastic@debian.org> Sat, 08 Dec 2018 09:55:16 +0100
libosmium (2.14.2-2) unstable; urgency=medium
* Drop autopkgtest to test installability.
* Add lintian override for testsuite-autopkgtest-missing.
-- Bas Couwenberg <sebastic@debian.org> Tue, 31 Jul 2018 20:31:10 +0200
libosmium (2.14.2-1~bpo9+1) stretch-backports; urgency=medium libosmium (2.14.2-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports. * Rebuild for stretch-backports.
......
...@@ -15,7 +15,7 @@ Build-Depends: debhelper (>= 9), ...@@ -15,7 +15,7 @@ Build-Depends: debhelper (>= 9),
libprotozero-dev (>= 1.6.3), libprotozero-dev (>= 1.6.3),
libsparsehash-dev, libsparsehash-dev,
zlib1g-dev zlib1g-dev
Standards-Version: 4.1.5 Standards-Version: 4.2.1
Vcs-Browser: https://salsa.debian.org/debian-gis-team/libosmium/ Vcs-Browser: https://salsa.debian.org/debian-gis-team/libosmium/
Vcs-Git: https://salsa.debian.org/debian-gis-team/libosmium.git -b stretch-backports Vcs-Git: https://salsa.debian.org/debian-gis-team/libosmium.git -b stretch-backports
Homepage: https://osmcode.org/libosmium/ Homepage: https://osmcode.org/libosmium/
......
# Not worth the effort
testsuite-autopkgtest-missing
# Test installability
Depends: @
Test-Command: /bin/true
...@@ -4,4 +4,4 @@ dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,\ ...@@ -4,4 +4,4 @@ dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,\
uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/,\ uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/,\
filenamemangle=s/(?:.*\/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/libosmium-$1.$2/ \ filenamemangle=s/(?:.*\/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/libosmium-$1.$2/ \
https://github.com/osmcode/libosmium/releases \ https://github.com/osmcode/libosmium/releases \
(?:.*/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) (?:.*?/archive/)?(?:rel|v|libosmium)[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
This diff is collapsed.
...@@ -105,7 +105,9 @@ namespace osmium { ...@@ -105,7 +105,9 @@ namespace osmium {
struct slocation { struct slocation {
static constexpr const uint32_t invalid_item = 1u << 30u; enum {
invalid_item = 1u << 30u
};
uint32_t item : 31; uint32_t item : 31;
uint32_t reverse : 1; uint32_t reverse : 1;
......
...@@ -147,14 +147,14 @@ namespace osmium { ...@@ -147,14 +147,14 @@ namespace osmium {
m_debug(debug) { m_debug(debug) {
} }
~SegmentList() noexcept = default;
SegmentList(const SegmentList&) = delete; SegmentList(const SegmentList&) = delete;
SegmentList(SegmentList&&) = delete; SegmentList(SegmentList&&) = delete;
SegmentList& operator=(const SegmentList&) = delete; SegmentList& operator=(const SegmentList&) = delete;
SegmentList& operator=(SegmentList&&) = delete; SegmentList& operator=(SegmentList&&) = delete;
~SegmentList() noexcept = default;
/// The number of segments in the list. /// The number of segments in the list.
std::size_t size() const noexcept { std::size_t size() const noexcept {
return m_segments.size(); return m_segments.size();
...@@ -181,7 +181,7 @@ namespace osmium { ...@@ -181,7 +181,7 @@ namespace osmium {
return m_segments[n]; return m_segments[n];
} }
NodeRefSegment& operator[](std::size_t n) noexcept { NodeRefSegment& operator[](const std::size_t n) noexcept {
assert(n < m_segments.size()); assert(n < m_segments.size());
return m_segments[n]; return m_segments[n];
} }
...@@ -206,7 +206,7 @@ namespace osmium { ...@@ -206,7 +206,7 @@ namespace osmium {
* Enable or disable debug output to stderr. This is used * Enable or disable debug output to stderr. This is used
* for debugging libosmium itself. * for debugging libosmium itself.
*/ */
void enable_debug_output(bool debug = true) noexcept { void enable_debug_output(const bool debug = true) noexcept {
m_debug = debug; m_debug = debug;
} }
......
...@@ -68,8 +68,6 @@ namespace osmium { ...@@ -68,8 +68,6 @@ namespace osmium {
detail::BasicAssembler(config) { detail::BasicAssembler(config) {
} }
~GeomAssembler() noexcept = default;
/** /**
* Assemble an area from the given way. * Assemble an area from the given way.
* *
......
...@@ -85,8 +85,13 @@ namespace osmium { ...@@ -85,8 +85,13 @@ namespace osmium {
area_stats m_stats; area_stats m_stats;
static constexpr size_t initial_output_buffer_size = 1024 * 1024; enum {
static constexpr size_t max_buffer_size_for_flush = 100 * 1024; initial_output_buffer_size = 1024ul * 1024ul
};
enum {
max_buffer_size_for_flush = 100ul * 1024ul
};
void flush_output_buffer() { void flush_output_buffer() {
if (this->callback()) { if (this->callback()) {
......
...@@ -764,7 +764,7 @@ namespace osmium { ...@@ -764,7 +764,7 @@ namespace osmium {
template <typename TBuilder, typename THandler, typename... TArgs> template <typename TBuilder, typename THandler, typename... TArgs>
inline typename std::enable_if<is_handled_by<THandler, TArgs...>::value>::type inline typename std::enable_if<is_handled_by<THandler, TArgs...>::value>::type
add_list(osmium::builder::Builder& parent, const TArgs&... args) { add_list(osmium::builder::Builder& parent, const TArgs&... args) {
TBuilder builder(parent.buffer(), &parent); TBuilder builder{parent.buffer(), &parent};
(void)std::initializer_list<int>{ (void)std::initializer_list<int>{
(THandler::set_value(builder, args), 0)... (THandler::set_value(builder, args), 0)...
}; };
...@@ -792,7 +792,7 @@ namespace osmium { ...@@ -792,7 +792,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_node_handlers, TArgs...>::value, "Attribute not allowed in add_node()"); static_assert(detail::are_all_handled_by<detail::any_node_handlers, TArgs...>::value, "Attribute not allowed in add_node()");
{ {
NodeBuilder builder(buffer); NodeBuilder builder{buffer};
detail::add_basic<detail::node_handler>(builder, args...); detail::add_basic<detail::node_handler>(builder, args...);
detail::add_user(builder, args...); detail::add_user(builder, args...);
...@@ -815,7 +815,7 @@ namespace osmium { ...@@ -815,7 +815,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_way_handlers, TArgs...>::value, "Attribute not allowed in add_way()"); static_assert(detail::are_all_handled_by<detail::any_way_handlers, TArgs...>::value, "Attribute not allowed in add_way()");
{ {
WayBuilder builder(buffer); WayBuilder builder{buffer};
detail::add_basic<detail::object_handler>(builder, args...); detail::add_basic<detail::object_handler>(builder, args...);
detail::add_user(builder, args...); detail::add_user(builder, args...);
...@@ -839,7 +839,7 @@ namespace osmium { ...@@ -839,7 +839,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_relation_handlers, TArgs...>::value, "Attribute not allowed in add_relation()"); static_assert(detail::are_all_handled_by<detail::any_relation_handlers, TArgs...>::value, "Attribute not allowed in add_relation()");
{ {
RelationBuilder builder(buffer); RelationBuilder builder{buffer};
detail::add_basic<detail::object_handler>(builder, args...); detail::add_basic<detail::object_handler>(builder, args...);
detail::add_user(builder, args...); detail::add_user(builder, args...);
...@@ -863,7 +863,7 @@ namespace osmium { ...@@ -863,7 +863,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_changeset_handlers, TArgs...>::value, "Attribute not allowed in add_changeset()"); static_assert(detail::are_all_handled_by<detail::any_changeset_handlers, TArgs...>::value, "Attribute not allowed in add_changeset()");
{ {
ChangesetBuilder builder(buffer); ChangesetBuilder builder{buffer};
detail::add_basic<detail::changeset_handler>(builder, args...); detail::add_basic<detail::changeset_handler>(builder, args...);
detail::add_user(builder, args...); detail::add_user(builder, args...);
...@@ -887,7 +887,7 @@ namespace osmium { ...@@ -887,7 +887,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::any_area_handlers, TArgs...>::value, "Attribute not allowed in add_area()"); static_assert(detail::are_all_handled_by<detail::any_area_handlers, TArgs...>::value, "Attribute not allowed in add_area()");
{ {
AreaBuilder builder(buffer); AreaBuilder builder{buffer};
detail::add_basic<detail::object_handler>(builder, args...); detail::add_basic<detail::object_handler>(builder, args...);
detail::add_user(builder, args...); detail::add_user(builder, args...);
...@@ -914,7 +914,7 @@ namespace osmium { ...@@ -914,7 +914,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::nodes_handler, TArgs...>::value, "Attribute not allowed in add_way_node_list()"); static_assert(detail::are_all_handled_by<detail::nodes_handler, TArgs...>::value, "Attribute not allowed in add_way_node_list()");
{ {
WayNodeListBuilder builder(buffer); WayNodeListBuilder builder{buffer};
(void)std::initializer_list<int>{ (void)std::initializer_list<int>{
(detail::nodes_handler::set_value(builder, args), 0)... (detail::nodes_handler::set_value(builder, args), 0)...
}; };
...@@ -936,7 +936,7 @@ namespace osmium { ...@@ -936,7 +936,7 @@ namespace osmium {
static_assert(detail::are_all_handled_by<detail::tags_handler, TArgs...>::value, "Attribute not allowed in add_tag_list()"); static_assert(detail::are_all_handled_by<detail::tags_handler, TArgs...>::value, "Attribute not allowed in add_tag_list()");
{ {
TagListBuilder builder(buffer); TagListBuilder builder{buffer};
(void)std::initializer_list<int>{ (void)std::initializer_list<int>{
(detail::tags_handler::set_value(builder, args), 0)... (detail::tags_handler::set_value(builder, args), 0)...
}; };
......
...@@ -65,7 +65,7 @@ namespace osmium { ...@@ -65,7 +65,7 @@ namespace osmium {
explicit Builder(osmium::memory::Buffer& buffer, Builder* parent, osmium::memory::item_size_type size) : explicit Builder(osmium::memory::Buffer& buffer, Builder* parent, osmium::memory::item_size_type size) :
m_buffer(buffer), m_buffer(buffer),
m_parent(parent), m_parent(parent),
m_item_offset(buffer.written()) { m_item_offset(buffer.written() - buffer.committed()) {
reserve_space(size); reserve_space(size);
assert(buffer.is_aligned()); assert(buffer.is_aligned());
if (m_parent) { if (m_parent) {
...@@ -80,7 +80,7 @@ namespace osmium { ...@@ -80,7 +80,7 @@ namespace osmium {
} }
#ifdef NDEBUG #ifdef NDEBUG
~Builder() = default; ~Builder() noexcept = default;
#else #else
~Builder() noexcept { ~Builder() noexcept {
m_buffer.decrement_builder_count(); m_buffer.decrement_builder_count();
...@@ -88,7 +88,7 @@ namespace osmium { ...@@ -88,7 +88,7 @@ namespace osmium {
#endif #endif
osmium::memory::Item& item() const { osmium::memory::Item& item() const {
return *reinterpret_cast<osmium::memory::Item*>(m_buffer.data() + m_item_offset); return *reinterpret_cast<osmium::memory::Item*>(m_buffer.data() + m_buffer.committed() + m_item_offset);
} }
unsigned char* reserve_space(std::size_t size) { unsigned char* reserve_space(std::size_t size) {
......
...@@ -98,6 +98,10 @@ namespace osmium { ...@@ -98,6 +98,10 @@ namespace osmium {
*/ */
struct Tile { struct Tile {
enum {
max_zoom = 30u
};
/// x coordinate /// x coordinate
uint32_t x; uint32_t x;
...@@ -119,7 +123,7 @@ namespace osmium { ...@@ -119,7 +123,7 @@ namespace osmium {
x(tx), x(tx),
y(ty), y(ty),
z(zoom) { z(zoom) {
assert(zoom <= 30u); assert(zoom <= max_zoom);
assert(x < num_tiles_in_zoom(zoom)); assert(x < num_tiles_in_zoom(zoom));
assert(y < num_tiles_in_zoom(zoom)); assert(y < num_tiles_in_zoom(zoom));
} }
...@@ -134,7 +138,7 @@ namespace osmium { ...@@ -134,7 +138,7 @@ namespace osmium {
*/ */
explicit Tile(uint32_t zoom, const osmium::Location& location) : explicit Tile(uint32_t zoom, const osmium::Location& location) :
z(zoom) { z(zoom) {
assert(zoom <= 30u); assert(zoom <= max_zoom);
assert(location.valid()); assert(location.valid());
const auto coordinates = lonlat_to_mercator(location); const auto coordinates = lonlat_to_mercator(location);
x = mercx_to_tilex(zoom, coordinates.x); x = mercx_to_tilex(zoom, coordinates.x);
...@@ -151,7 +155,7 @@ namespace osmium { ...@@ -151,7 +155,7 @@ namespace osmium {
*/ */
explicit Tile(uint32_t zoom, const osmium::geom::Coordinates& coordinates) : explicit Tile(uint32_t zoom, const osmium::geom::Coordinates& coordinates) :
z(zoom) { z(zoom) {
assert(zoom <= 30u); assert(zoom <= max_zoom);
x = mercx_to_tilex(zoom, coordinates.x); x = mercx_to_tilex(zoom, coordinates.x);
y = mercy_to_tiley(zoom, coordinates.y); y = mercy_to_tiley(zoom, coordinates.y);
} }
...@@ -162,7 +166,7 @@ namespace osmium { ...@@ -162,7 +166,7 @@ namespace osmium {
* each be between 0 and 2^zoom-1. * each be between 0 and 2^zoom-1.
*/ */
bool valid() const noexcept { bool valid() const noexcept {
if (z > 30) { if (z > max_zoom) {
return false; return false;
} }
const auto max = num_tiles_in_zoom(z); const auto max = num_tiles_in_zoom(z);
......
...@@ -46,7 +46,9 @@ namespace osmium { ...@@ -46,7 +46,9 @@ namespace osmium {
namespace detail { namespace detail {
constexpr size_t mmap_vector_size_increment = 1024 * 1024; enum {
mmap_vector_size_increment = 1024ul * 1024ul
};
/** /**
* This is a base class for implementing classes that look like * This is a base class for implementing classes that look like
...@@ -58,12 +60,12 @@ namespace osmium { ...@@ -58,12 +60,12 @@ namespace osmium {
protected: protected:
size_t m_size = 0; std::size_t m_size = 0;
osmium::TypedMemoryMapping<T> m_mapping; osmium::TypedMemoryMapping<T> m_mapping;
public: public:
mmap_vector_base(int fd, size_t capacity, size_t size = 0) : mmap_vector_base(const int fd, const std::size_t capacity, const std::size_t size = 0) :
m_size(size), m_size(size),
m_mapping(capacity, osmium::MemoryMapping::mapping_mode::write_shared, fd) { m_mapping(capacity, osmium::MemoryMapping::mapping_mode::write_shared, fd) {
assert(size <= capacity); assert(size <= capacity);
...@@ -71,7 +73,7 @@ namespace osmium { ...@@ -71,7 +73,7 @@ namespace osmium {
shrink_to_fit(); shrink_to_fit();
} }
explicit mmap_vector_base(size_t capacity = mmap_vector_size_increment) : explicit mmap_vector_base(const std::size_t capacity = mmap_vector_size_increment) :
m_mapping(capacity) { m_mapping(capacity) {
std::fill_n(data(), capacity, osmium::index::empty_value<T>()); std::fill_n(data(), capacity, osmium::index::empty_value<T>());
} }
...@@ -88,11 +90,11 @@ namespace osmium { ...@@ -88,11 +90,11 @@ namespace osmium {
m_mapping.unmap(); m_mapping.unmap();
} }
size_t capacity() const noexcept { std::size_t capacity() const noexcept {
return m_mapping.size(); return m_mapping.size();
} }
size_t size() const noexcept { std::size_t size() const noexcept {
return m_size; return m_size;
} }
...@@ -108,17 +110,17 @@ namespace osmium { ...@@ -108,17 +110,17 @@ namespace osmium {
return m_mapping.begin(); return m_mapping.begin();
} }
const_reference operator[](size_t n) const { const_reference operator[](const std::size_t n) const {
assert(n < m_size); assert(n < m_size);
return data()[n]; return data()[n];
} }
reference operator[](size_t n) { reference operator[](const std::size_t n) {
assert(n < m_size); assert(n < m_size);
return data()[n]; return data()[n];
} }
value_type at(size_t n) const { value_type at(const std::size_t n) const {
if (n >= m_size) { if (n >= m_size) {
throw std::out_of_range{"out of range"}; throw std::out_of_range{"out of range"};
} }
...@@ -140,17 +142,17 @@ namespace osmium { ...@@ -140,17 +142,17 @@ namespace osmium {
data()[m_size - 1] = value; data()[m_size - 1] = value;
} }
void reserve(size_t new_capacity) { void reserve(const std::size_t new_capacity) {
if (new_capacity > capacity()) { if (new_capacity > capacity()) {
const size_t old_capacity = capacity(); const std::size_t old_capacity = capacity();
m_mapping.resize(new_capacity); m_mapping.resize(new_capacity);
std::fill(data() + old_capacity, data() + new_capacity, osmium::index::empty_value<value_type>()); std::fill(data() + old_capacity, data() + new_capacity, osmium::index::empty_value<value_type>());
} }
} }
void resize(size_t new_size) { void resize(const std::size_t new_size) {
if (new_size > capacity()) { if (new_size > capacity()) {
reserve(new_size + osmium::detail::mmap_vector_size_increment); reserve(new_size + mmap_vector_size_increment);
} }
m_size = new_size; m_size = new_size;
} }
......
...@@ -53,7 +53,7 @@ namespace osmium { ...@@ -53,7 +53,7 @@ namespace osmium {
template <typename T> template <typename T>
class mmap_vector_file : public mmap_vector_base<T> { class mmap_vector_file : public mmap_vector_base<T> {
static std::size_t filesize(int fd) { static std::size_t filesize(const int fd) {
const auto size = osmium::file_size(fd); const auto size = osmium::file_size(fd);
if (size % sizeof(T) != 0) { if (size % sizeof(T) != 0) {
...@@ -71,10 +71,10 @@ namespace osmium { ...@@ -71,10 +71,10 @@ namespace osmium {
osmium::detail::mmap_vector_size_increment) { osmium::detail::mmap_vector_size_increment) {
} }
explicit mmap_vector_file(int fd) : explicit mmap_vector_file(const int fd) :
mmap_vector_base<T>( mmap_vector_base<T>(
fd, fd,
std::max(osmium::detail::mmap_vector_size_increment, filesize(fd)), std::max(static_cast<std::size_t>(mmap_vector_size_increment), filesize(fd)),
filesize(fd)) { filesize(fd)) {
} }
......
...@@ -39,8 +39,10 @@ DEALINGS IN THE SOFTWARE. ...@@ -39,8 +39,10 @@ DEALINGS IN THE SOFTWARE.
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
#include <memory>
#include <utility> #include <utility>
namespace osmium { namespace osmium {
namespace index { namespace index {
...@@ -221,6 +223,26 @@ namespace osmium { ...@@ -221,6 +223,26 @@ namespace osmium {
std::sort(m_vector.begin(), m_vector.end()); std::sort(m_vector.begin(), m_vector.end());
} }
void dump_as_array(const int fd) final {
constexpr const size_t value_size = sizeof(TValue);
constexpr const size_t buffer_size = (10L * 1024L * 1024L) / value_size;
std::unique_ptr<TValue[]> output_buffer{new TValue[buffer_size]};
size_t buffer_start_id = 0;
for (auto it = cbegin(); it != cend();) {
std::fill_n(output_buffer.get(), buffer_size, osmium::index::empty_value<TValue>());
size_t offset = 0;
for (; offset < buffer_size && it != end(); ++offset) {
if (buffer_start_id + offset == it->first) {
output_buffer[offset] = it->second;
++it;
}
}
osmium::io::detail::reliable_write(fd, reinterpret_cast<const unsigned char*>(output_buffer.get()), offset * value_size);
buffer_start_id += buffer_size;
}
}
void dump_as_list(const int fd) final { void dump_as_list(const int fd) final {
osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(m_vector.data()), byte_size()); osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(m_vector.data()), byte_size());
} }
......
...@@ -95,30 +95,44 @@ namespace osmium { ...@@ -95,30 +95,44 @@ namespace osmium {
}; // class IdSet }; // class IdSet
template <typename T> namespace detail {
// This value is a compromise. For node Ids it could be bigger
// which would mean less (but larger) memory allocations. For
// relations Ids it could be smaller, because they would all fit
// into a smaller allocation.
enum : std::size_t {
default_chunk_bits = 22u
};
} // namespace detail
template <typename T, std::size_t chunk_bits = detail::default_chunk_bits>
class IdSetDense; class IdSetDense;
/** /**
* Const_iterator for iterating over a IdSetDense. * Const_iterator for iterating over a IdSetDense.
*/ */
template <typename T> template <typename T, std::size_t chunk_bits>
class IdSetDenseIterator { class IdSetDenseIterator {
static_assert(std::is_unsigned<T>::value, "Needs unsigned type"); static_assert(std::is_unsigned<T>::value, "Needs unsigned type");
static_assert(sizeof(T) >= 4, "Needs at least 32bit type"); static_assert(sizeof(T) >= 4, "Needs at least 32bit type");
const IdSetDense<T>* m_set; using id_set = IdSetDense<T, chunk_bits>;
const id_set* m_set;
T m_value; T m_value;
T m_last; T m_last;
void next() noexcept { void next() noexcept {
while (m_value != m_last && !m_set->get(m_value)) { while (m_value != m_last && !m_set->get(m_value)) {
const T cid = IdSetDense<T>::chunk_id(m_value); const T cid = id_set::chunk_id(m_value);
assert(cid < m_set->m_data.size()); assert(cid < m_set->m_data.size());
if (!m_set->m_data[cid]) { if (!m_set->m_data[cid]) {
m_value = (cid + 1) << (IdSetDense<T>::chunk_bits + 3); m_value = (cid + 1) << (chunk_bits + 3);
} else { } else {
const auto slot = m_set->m_data[cid][IdSetDense<T>::offset(m_value)]; const auto slot = m_set->m_data[cid][id_set::offset(m_value)];
if (slot == 0) { if (slot == 0) {
m_value += 8; m_value += 8;
m_value &= ~0x7ull; m_value &= ~0x7ull;
...@@ -136,14 +150,14 @@ namespace osmium { ...@@ -136,14 +150,14 @@ namespace osmium {
using pointer = value_type*; using pointer = value_type*;
using reference = value_type&; using reference = value_type&;
IdSetDenseIterator(const IdSetDense<T>* set, T value, T last) noexcept : IdSetDenseIterator(const id_set* set, T value, T last) noexcept :
m_set(set), m_set(set),
m_value(value), m_value(value),
m_last(last) { m_last(last) {
next(); next();
} }
IdSetDenseIterator<T>& operator++() noexcept { IdSetDenseIterator& operator++() noexcept {
if (m_value != m_last) { if (m_value != m_last) {
++m_value; ++m_value;
next(); next();
...@@ -151,17 +165,17 @@ namespace osmium { ...@@ -151,17 +165,17 @@ namespace osmium {
return *this; return *this;
} }
IdSetDenseIterator<T> operator++(int) noexcept { IdSetDenseIterator operator++(int) noexcept {
IdSetDenseIterator<T> tmp{*this}; IdSetDenseIterator tmp{*this};
operator++(); operator++();
return tmp; return tmp;
} }
bool operator==(const IdSetDenseIterator<T>& rhs) const noexcept { bool operator==(const IdSetDenseIterator& rhs) const noexcept {
return m_set == rhs.m_set && m_value == rhs.m_value; return m_set == rhs.m_set && m_value == rhs.m_value;
} }
bool operator!=(const IdSetDenseIterator<T>& rhs) const noexcept { bool operator!=(const IdSetDenseIterator& rhs) const noexcept {
return !(*this == rhs); return !(*this == rhs);
} }
...@@ -179,20 +193,17 @@ namespace osmium { ...@@ -179,20 +193,17 @@ namespace osmium {
* and larger Id sets. If it is not used, no memory is allocated at * and larger Id sets. If it is not used, no memory is allocated at
* all. * all.
*/ */
template <typename T> template <typename T, std::size_t chunk_bits>
class IdSetDense : public IdSet<T> { class IdSetDense : public IdSet<T> {
static_assert(std::is_unsigned<T>::value, "Needs unsigned type"); static_assert(std::is_unsigned<T>::value, "Needs unsigned type");
static_assert(sizeof(T) >= 4, "Needs at least 32bit type"); static_assert(sizeof(T) >= 4, "Needs at least 32bit type");
friend class IdSetDenseIterator<T>; friend class IdSetDenseIterator<T, chunk_bits>;
// This value is a compromise. For node Ids it could be bigger enum : std::size_t {
// which would mean less (but larger) memory allocations. For chunk_size = 1u << chunk_bits
// relations Ids it could be smaller, because they would all fit };
// into a smaller allocation.
constexpr static const std::size_t chunk_bits = 22u;
constexpr static const std::size_t chunk_size = 1u << chunk_bits;
std::vector<std::unique_ptr<unsigned char[]>> m_data; std::vector<std::unique_ptr<unsigned char[]>> m_data;
T m_size = 0; T m_size = 0;
...@@ -230,7 +241,7 @@ namespace osmium { ...@@ -230,7 +241,7 @@ namespace osmium {
public: public:
using const_iterator = IdSetDenseIterator<T>; using const_iterator = IdSetDenseIterator<T, chunk_bits>;
IdSetDense() = default; IdSetDense() = default;
...@@ -284,7 +295,7 @@ namespace osmium { ...@@ -284,7 +295,7 @@ namespace osmium {
if (chunk_id(id) >= m_data.size()) { if (chunk_id(id) >= m_data.size()) {
return false; return false;
} }
auto* r = m_data[chunk_id(id)].get(); const auto* r = m_data[chunk_id(id)].get();
if (!r) { if (!r) {
return false; return false;
} }
...@@ -317,11 +328,11 @@ namespace osmium { ...@@ -317,11 +328,11 @@ namespace osmium {
return m_data.size() * chunk_size; return m_data.size() * chunk_size;
} }
IdSetDenseIterator<T> begin() const { const_iterator begin() const {
return {this, 0, last()}; return {this, 0, last()};
} }
IdSetDenseIterator<T> end() const { const_iterator end() const {
return {this, last(), last()}; return {this, last(), last()};
} }
......
...@@ -118,7 +118,7 @@ namespace osmium { ...@@ -118,7 +118,7 @@ namespace osmium {
virtual ~Map() noexcept = default; virtual ~Map() noexcept = default;
virtual void reserve(const size_t /*size*/) { virtual void reserve(const std::size_t /*size*/) {
// default implementation is empty // default implementation is empty
} }
...@@ -151,7 +151,7 @@ namespace osmium { ...@@ -151,7 +151,7 @@ namespace osmium {
* accurate. You can not use this to find out how much memory the * accurate. You can not use this to find out how much memory the
* storage uses. Use used_memory() for that. * storage uses. Use used_memory() for that.
*/ */
virtual size_t size() const = 0; virtual std::size_t size() const = 0;
/** /**
* Get the memory used for this storage in bytes. Note that this * Get the memory used for this storage in bytes. Note that this
...@@ -160,7 +160,7 @@ namespace osmium { ...@@ -160,7 +160,7 @@ namespace osmium {
* the main memory used, for storage classes storing data on disk * the main memory used, for storage classes storing data on disk
* this is the memory used on disk. * this is the memory used on disk.
*/ */
virtual size_t used_memory() const = 0; virtual std::size_t used_memory() const = 0;
/** /**
* Clear memory used for this storage. After this you can not * Clear memory used for this storage. After this you can not
...@@ -210,8 +210,6 @@ namespace osmium { ...@@ -210,8 +210,6 @@ namespace osmium {
MapFactory() = default; MapFactory() = default;
~MapFactory() = default;
public: public:
MapFactory(const MapFactory&) = delete; MapFactory(const MapFactory&) = delete;
...@@ -220,6 +218,8 @@ namespace osmium { ...@@ -220,6 +218,8 @@ namespace osmium {
MapFactory(MapFactory&&) = delete; MapFactory(MapFactory&&) = delete;
MapFactory& operator=(MapFactory&&) = delete; MapFactory& operator=(MapFactory&&) = delete;
~MapFactory() = default;
static MapFactory<id_type, value_type>& instance() { static MapFactory<id_type, value_type>& instance() {
static MapFactory<id_type, value_type> factory; static MapFactory<id_type, value_type> factory;
return factory; return factory;
......
...@@ -62,17 +62,17 @@ namespace osmium { ...@@ -62,17 +62,17 @@ namespace osmium {
// This value is based on benchmarks with a planet file and // This value is based on benchmarks with a planet file and
// some smaller files. // some smaller files.
enum constant_bits { enum {
bits = 16 bits = 16
}; };
enum constant_block_size : uint64_t { enum : uint64_t {
block_size = 1ull << bits block_size = 1ull << bits
}; };
// Minimum number of entries in the sparse index before we // Minimum number of entries in the sparse index before we
// are considering switching to a dense index. // are considering switching to a dense index.
enum constant_min_dense_entries : int64_t { enum : int64_t {
min_dense_entries = 0xffffff min_dense_entries = 0xffffff
}; };
...@@ -81,7 +81,7 @@ namespace osmium { ...@@ -81,7 +81,7 @@ namespace osmium {
// the best memory efficiency (which we would get at a factor // the best memory efficiency (which we would get at a factor
// of 2) and the performance (dense index is much faster then // of 2) and the performance (dense index is much faster then
// the sparse index). // the sparse index).
enum constant_density_factor { enum {
density_factor = 3 density_factor = 3
}; };
......
...@@ -62,7 +62,9 @@ namespace osmium { ...@@ -62,7 +62,9 @@ namespace osmium {
// element in the map (id + value + pointers to left, right, // element in the map (id + value + pointers to left, right,
// and parent plus some overhead for color of red-black-tree // and parent plus some overhead for color of red-black-tree
// or similar). // or similar).
static constexpr size_t element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4; enum {
element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4u
};
std::map<TId, TValue> m_elements; std::map<TId, TValue> m_elements;
......
...@@ -87,7 +87,7 @@ namespace osmium { ...@@ -87,7 +87,7 @@ namespace osmium {
} }
HybridIterator<TId, TValue> operator++(int) { HybridIterator<TId, TValue> operator++(int) {
auto tmp(*this); const auto tmp{*this};
operator++(); operator++();
return tmp; return tmp;
} }
...@@ -159,10 +159,10 @@ namespace osmium { ...@@ -159,10 +159,10 @@ namespace osmium {
} }
std::pair<iterator, iterator> get_all(const TId id) { std::pair<iterator, iterator> get_all(const TId id) {
auto result_main = m_main.get_all(id); const auto result_main = m_main.get_all(id);
auto result_extra = m_extra.get_all(id); const auto result_extra = m_extra.get_all(id);
return std::make_pair(iterator(result_main.first, result_main.second, result_extra.first, result_extra.second), return std::make_pair(iterator{result_main.first, result_main.second, result_extra.first, result_extra.second},
iterator(result_main.second, result_main.second, result_extra.second, result_extra.second)); iterator{result_main.second, result_main.second, result_extra.second, result_extra.second});
} }
void remove(const TId id, const TValue value) { void remove(const TId id, const TValue value) {
......
...@@ -59,7 +59,9 @@ namespace osmium { ...@@ -59,7 +59,9 @@ namespace osmium {
// element in the map (id + value + pointers to left, right, // element in the map (id + value + pointers to left, right,
// and parent plus some overhead for color of red-black-tree // and parent plus some overhead for color of red-black-tree
// or similar). // or similar).
static constexpr size_t element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4; enum {
element_size = sizeof(TId) + sizeof(TValue) + sizeof(void*) * 4u
};
public: public:
......
...@@ -44,11 +44,11 @@ namespace osmium { ...@@ -44,11 +44,11 @@ namespace osmium {
public: public:
T& operator()(osmium::item_type type) noexcept { T& operator()(const osmium::item_type type) noexcept {
return m_sets[osmium::item_type_to_nwr_index(type)]; return m_sets[osmium::item_type_to_nwr_index(type)];
} }
const T& operator()(osmium::item_type type) const noexcept { const T& operator()(const osmium::item_type type) const noexcept {
return m_sets[osmium::item_type_to_nwr_index(type)]; return m_sets[osmium::item_type_to_nwr_index(type)];
} }
......
...@@ -66,12 +66,12 @@ namespace osmium { ...@@ -66,12 +66,12 @@ namespace osmium {
TKeyInternal key; TKeyInternal key;
TValueInternal value; TValueInternal value;
explicit kv_pair(key_type key_id) : explicit kv_pair(const key_type key_id) :
key(static_cast<TKeyInternal>(key_id)), key(static_cast<TKeyInternal>(key_id)),
value() { value() {
} }
kv_pair(key_type key_id, value_type value_id) : kv_pair(const key_type key_id, const value_type value_id) :
key(static_cast<TKeyInternal>(key_id)), key(static_cast<TKeyInternal>(key_id)),
value(static_cast<TValueInternal>(value_id)) { value(static_cast<TValueInternal>(value_id)) {
} }
...@@ -91,7 +91,7 @@ namespace osmium { ...@@ -91,7 +91,7 @@ namespace osmium {
using const_iterator = typename std::vector<kv_pair>::const_iterator; using const_iterator = typename std::vector<kv_pair>::const_iterator;
void set(key_type key, value_type value) { void set(const key_type key, const value_type value) {
m_map.emplace_back(key, value); m_map.emplace_back(key, value);
} }
...@@ -119,7 +119,7 @@ namespace osmium { ...@@ -119,7 +119,7 @@ namespace osmium {
m_map.erase(last, m_map.end()); m_map.erase(last, m_map.end());
} }
std::pair<const_iterator, const_iterator> get(key_type key) const noexcept { std::pair<const_iterator, const_iterator> get(const key_type key) const noexcept {
return std::equal_range(m_map.begin(), m_map.end(), kv_pair{key}, [](const kv_pair& lhs, const kv_pair& rhs) { return std::equal_range(m_map.begin(), m_map.end(), kv_pair{key}, [](const kv_pair& lhs, const kv_pair& rhs) {
return lhs.key < rhs.key; return lhs.key < rhs.key;
}); });
...@@ -133,7 +133,7 @@ namespace osmium { ...@@ -133,7 +133,7 @@ namespace osmium {
return m_map.size(); return m_map.size();
} }
void reserve(std::size_t size) { void reserve(const std::size_t size) {
m_map.reserve(size); m_map.reserve(size);
} }
...@@ -209,7 +209,7 @@ namespace osmium { ...@@ -209,7 +209,7 @@ namespace osmium {
* (Lookup uses binary search.) * (Lookup uses binary search.)
*/ */
template <typename TFunc> template <typename TFunc>
void for_each_parent(osmium::unsigned_object_id_type member_id, TFunc&& func) const { void for_each_parent(const osmium::unsigned_object_id_type member_id, TFunc&& func) const {
const auto parents = m_map.get(member_id); const auto parents = m_map.get(member_id);
for (auto it = parents.first; it != parents.second; ++it) { for (auto it = parents.first; it != parents.second; ++it) {
std::forward<TFunc>(func)(it->value); std::forward<TFunc>(func)(it->value);
...@@ -231,7 +231,7 @@ namespace osmium {