Open Source Routing Machine - C++ backend
Go to file
Daniel J. Hofmann f9f0ffb64d Remove hand written conversion code and replace with stdlib features.
With C++11 the stdlib gains:

- `std::stoi` function family to convert from `std::string` to integral type

- `std::to_string` to convert from number types to `std::string`

The only reason for hand-writing the conversion code therefore is
performance. I benchmarked an `osrm-extract` with the hand-written code
against one with the stdlib conversion features and could not find any
significant difference (we switch back and forth between C++ and Lua,
shaving off a few us in conversion doesn't gain us much).

Formatting arithmetic types in the default format with given precision
requires streams, but is doable in a few lines of idiomatic stdlib code.

For this, there is now the following function template available:

    template <Arithmetic T, int Precision = 6>
    inline std::string to_string_with_precision(const T);

that requires integral or floating point types and returns a formatted
string in the defaukt format with the given precision applied.

In addition this completely rips out Boost.Spirit from the `casts.hpp`
header, resulting in faster compile times.

Boom!

References:

- http://en.cppreference.com/w/cpp/string/basic_string/stol
- http://en.cppreference.com/w/cpp/string/basic_string/to_string
- http://www.kumobius.com/2013/08/c-string-to-int/
2015-09-29 16:15:54 +02:00
algorithms Revert parallelization on server part. Let node do this. 2015-09-28 20:26:03 +02:00
benchmarks Remove Boost.Filesystem v3 fix for Boost < 1.48, refactor call sites. 2015-09-29 16:15:54 +02:00
cmake Only replace fingerprint file when MD5 changes. Avoids rebuilding several things if nothing has actually changes, as cmake is only looking at timestamps. 2015-09-04 14:07:40 +02:00
config new cucumber profile for Jenkins that doesn't fail because of an old Gherkin bug 2014-03-24 14:29:19 +01:00
contractor Remove TBB usage from hot code paths 2015-09-28 20:37:09 +02:00
data_structures Revert the usage of TBB's iterator pair taking overloads. 2015-09-28 20:37:09 +02:00
descriptors Remove hand written conversion code and replace with stdlib features. 2015-09-29 16:15:54 +02:00
docker Remove protobuf dependencies from docker setup 2015-08-31 16:48:27 +02:00
extractor Remove hand written conversion code and replace with stdlib features. 2015-09-29 16:15:54 +02:00
features Refactor alternative route test 2015-09-23 15:54:23 +02:00
include/osrm Don't pass by const-value for a read-only view. 2015-09-08 23:34:20 +02:00
library fix some small issues: 2015-09-01 15:20:35 +02:00
plugins Remove hand written conversion code and replace with stdlib features. 2015-09-29 16:15:54 +02:00
profiles Add switch for handling fallback name 2015-09-10 14:11:18 +02:00
routing_algorithms Revert parallelization on algorithms that are used in the server. Let node do this. 2015-09-28 20:26:29 +02:00
scripts Static analysis: integration with the Static Analyzer. 2015-09-22 17:32:32 +02:00
server Remove hand written conversion code and replace with stdlib features. 2015-09-29 16:15:54 +02:00
test Implement raster source feature to read data from third-party sources, to be used in lua profiles. 2015-09-03 22:28:18 -07:00
third_party Merge commit '788bc67faa7738cf7c6b2a192ecf3e3567d1c20e' into develop 2015-08-28 12:42:03 +02:00
tools Revert the usage of TBB's iterator pair taking overloads. 2015-09-28 20:37:09 +02:00
unit_tests Remove template-heavy Boost.MPL headers where not needed. 2015-09-28 15:00:20 +02:00
util Remove hand written conversion code and replace with stdlib features. 2015-09-29 16:15:54 +02:00
.clang-format don't binpack parameters on 100 column width 2014-04-21 17:40:05 +02:00
.clang-tidy Integration scripts for Clang's Modernize and Tidy tool. 2015-09-22 17:32:32 +02:00
.gitignore make AppVeyor green again 2015-06-18 18:16:51 +02:00
.gitmodules Removing Docs submodule 2012-12-26 18:29:16 +01:00
.travis.yml Remove protobuf dependencies from travis config 2015-08-31 16:57:42 +02:00
appveyor-build.bat AppVeyor: make tests pass again 2015-09-07 19:45:54 +02:00
appveyor.yml AppVeyor: include osrm.lib in artifact. don't stick to AppVeyor directory structure in build scripts. 2015-09-07 14:26:47 +00:00
build-local.bat AppVeyor: make tests pass again 2015-09-07 19:45:54 +02:00
CMakeLists.txt Exclude unit tests and benchmarks from doxygen and make it more robust. 2015-09-22 16:26:21 +02:00
datastore.cpp Remove Boost.Filesystem v3 fix for Boost < 1.48, refactor call sites. 2015-09-29 16:15:54 +02:00
Doxyfile.in Use Readme.md as mainpage untill we have something better. 2015-09-22 16:26:21 +02:00
extract.cpp Move option parsing to own class 2015-05-28 15:18:48 +02:00
Gemfile change copyright line from personal names to project 2015-02-19 09:19:51 +01:00
Gemfile.lock upgrade to cucumber 2.0 2015-04-30 18:15:46 +02:00
LICENCE.TXT change copyright line from personal names to project 2015-02-19 09:19:51 +01:00
prepare.cpp Move option parsing to own class 2015-05-28 15:18:48 +02:00
profile.lua readding profile.lua 2013-07-02 22:51:21 +02:00
Rakefile add raketask for clearing test cache files 2014-10-17 15:13:06 +02:00
README.md Squashed 'third_party/libosmium/' changes from 8bcd4ea..c43f8db 2015-08-28 12:42:03 +02:00
routed.cpp Modernize the code base to C++11 standards and beyond. 2015-08-18 12:56:34 +02:00
taginfo.json Add object_types to some tags. 2014-09-07 20:39:56 +02:00
typedefs.h Find components on edge-expanded graph 2015-08-06 11:13:25 +02:00

About

The Open Source Routing Machine is a high performance routing engine written in C++11 designed to run on OpenStreetMap data.

Current build status

build config branch status
Linux  master Build Status
Linux  develop Build Status
Windows master/develop Build status
LUAbind fork  master Build Status

Building

For instructions on how to build and run OSRM, please consult the Wiki.

To quickly try OSRM use our free and daily updated online service

Documentation

See the Wiki's server API documentation as well as the library API documentation

References in publications

When using the code in a (scientific) publication, please cite

@inproceedings{luxen-vetter-2011,
 author = {Luxen, Dennis and Vetter, Christian},
 title = {Real-time routing with OpenStreetMap data},
 booktitle = {Proceedings of the 19th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems},
 series = {GIS '11},
 year = {2011},
 isbn = {978-1-4503-1031-4},
 location = {Chicago, Illinois},
 pages = {513--516},
 numpages = {4},
 url = {http://doi.acm.org/10.1145/2093973.2094062},
 doi = {10.1145/2093973.2094062},
 acmid = {2094062},
 publisher = {ACM},
 address = {New York, NY, USA},
}