Commit Graph

1677 Commits

Author SHA1 Message Date
Daniel Patterson
6b0fe683c9 Expose the base type. Going via the operator<< leaves us with invalid geojson. 2016-02-15 13:25:55 -08:00
Moritz Kobitzsch
f14352f494 modify turn angles and instructions 2016-02-15 20:13:55 +01:00
Moritz Kobitzsch
ab9426e260 fix routing when requiring loop at a core node 2016-02-15 18:26:39 +01:00
Daniel J. Hofmann
27fe85ac8b Dividable-by-three instead of next-dividable-by-three 2016-02-12 18:10:44 -08:00
Daniel J. Hofmann
a6d406d2c3 Fix headers for JSON abstractions 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
4b8c0ac143 Revert "Folds json_* utilities into json subfolder and adapts includes"
This reverts commit cd039c69c0a92a35889e3c875b8eb53cf07377bb.
2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
c9f0158fdb Ifdef is_trivially_copyable<T> behind gcc >= 5 guard 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
aac21f932b Refactors Base64 encoding and decoding, it's almost beautiful now 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
ec01c2a119 Folds json_* utilities into json subfolder and adapts includes 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
fbef77a942 Documents why not to use boost::irange in favor of our hand-written irange 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
f207d988f4 Removes floating point epsilon comparator 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
60fc486cea Prefix exception header guard with osrm prefix 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
978b70c998 Adds a comment as to why the char to typed enum class transformation is not possible 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
ef171f3acd Properly use typed math constants instead of impl. specific hacks
PI is not in the stdlib, neither is 1/pi, pi*2 and so on. Instead
of relying on implementations providing these, use properly typed
math constants.

Main benefits:
- portable and
- returns constexpr, for compile-time computation

References:
- http://www.boost.org/doc/libs/1_60_0/libs/math/doc/html/math_toolkit/constants_intro.html
- http://www.boost.org/doc/libs/1_60_0/libs/math/doc/html/math_toolkit/constants.html
2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
64b36807d3 Transforms osrm_exception to exception 2016-02-12 15:46:24 -08:00
Daniel J. Hofmann
5de8f1803c Folds mercator projections into coordinate_calculation 2016-02-12 15:46:24 -08:00
karenzshea
7398bed974 Include real coordinates in debug geojson mode 2016-02-11 17:09:20 -05:00
Daniel J. Hofmann
6cd55e535c Removes potentially dangerous and misleading lat, lon subscript oeprator 2016-02-11 02:37:33 +01:00
Dane Springmeyer
2949a52a11 remove uneeded and deprecated usage of mapbox::util::static_visitor 2016-02-10 12:58:36 -08:00
Daniel J. Hofmann
b8d20dfe99 Prevent undefined behavior from left shifting into sign bit when offset is 31 2016-02-08 11:47:44 -08:00
Daniel J. Hofmann
fa8529949b Make swap noexcept (as it has to be!) and fix swap misuses 2016-02-08 11:47:44 -08:00
Daniel J. Hofmann
7b37c847bd Fixes shared memory wrapper includes 2016-02-08 11:47:02 -08:00
Daniel J. Hofmann
3075f6cea7 No need for deferred, non-blocking or timeout acquisition 2016-02-08 11:26:40 -08:00
Daniel J. Hofmann
ff966490bb Fixes datafacade includes 2016-02-08 11:26:40 -08:00
Kerrick Staley
8804330d83 Add operator<< to OSRM_STRONG_TYPEDEF
Useful for debugging.
2016-02-01 12:32:30 -08:00
karenzshea
f5c12ec433 comments 2016-01-29 23:49:09 +01:00
karenzshea
262cdd7bc0 move tribool obj into request_parser 2016-01-29 23:49:09 +01:00
Patrick Niklaus
efee07e20b Move arrays don't copy 2016-01-29 15:58:48 +01:00
Moritz Kobitzsch
603b83e1c3 Fixes Alternative Routing when including loops 2016-01-28 16:33:07 +01:00
Daniel J. Hofmann
a48f02e0da Takes care of proper special member generation globally, fixes #1689
Phew, a lot of classes were affected by this. The rationale for the
changes are as follows:

- When a type X declares any constructor, the default constructor is
  not declared, so there is no need for X() = delete there. In fact,
  there is brutal difference between those two: deleted members
  participate in overload resolution, but not-declared members do not!

- When a type X wants to be non-copyable (e.g. to be only movable, like
  threads, unique_ptrs, and so on), you can either do it by inheriting
  from boost::noncopyable (the old way), or better declare both (!) the
  copy constructor _and_ the copy assignment operator as deleted:

      X(X const&) = delete;
      X& operator=(X const&) = delete;

  We had tons of types with deleted copy constructors that were lacking
  a corresponding deleted copy assignment operator, making them still
  copyable and you wouldn't even notice (read: scary)!

References:

- http://accu.org/content/conf2014/Howard_Hinnant_Accu_2014.pdf
- http://www.boost.org/doc/libs/master/libs/core/doc/html/core/noncopyable.html

Note: I know, I'm quoting Hinnant's extraordinary slides a lot, but
getting the sematic right here is so incredibly important.
2016-01-27 17:25:30 +01:00
Patrick Niklaus
0802804677 Fix PR comments 2016-01-26 22:57:02 +01:00
Patrick Niklaus
d9c281cd7c Remove boost fusion dependency in RouteParameters 2016-01-26 22:57:02 +01:00
Patrick Niklaus
46185fe9e8 Ptr -> auto 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann
38e8a90f4e Make HilbertCode a free standing function 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann
d391df52ba Be kind to the optimizer, pass coordinates by value (just two ints) 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann
46fc6f8da4 Collapse computeAngle into coordinate calculation 2016-01-26 22:57:02 +01:00
Daniel J. Hofmann
0fcca04150 TU-local STXXL comparator for OSMNodeIDs, needs {min,max}_value
Can not use std::less<>{} because of this.
2016-01-26 22:57:02 +01:00
Daniel J. Hofmann
54a9173107 Make public RouteParameters header no longer depend on Spirit
And includes the optional header that was transitively included by the
spirit header before. Hopefully this will speed up compile times, as the
RouteParameters header is used in a lot of translation units.
2016-01-26 22:57:02 +01:00
Daniel J. Hofmann
312b414d8f Adapts XORFastHashStorage to XORFastHash compile time limits 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann
a6e7954128 Make XORFastHash's number of hashable elements compile time constant
Still constraint by the usage of uint32_t and subsequent splitting into
two uint16_t we use for indexing into the tables.
2016-01-26 17:54:08 +01:00
Daniel J. Hofmann
1417d43430 Cut down memory usage for tables in XORFastHash by factor of four
`pow(2, 16)` is not `2 << 16` but rather `1 << 16`.

With this change we cut memory usage in half for the XORFastHash's two
tables. Adapts XORFastHashStorage, memory usage reduction by factor two.
2016-01-26 17:54:08 +01:00
Daniel J. Hofmann
60ef6070b0 Simplify uint32_t splitting in XORFastHash 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann
2f42196fca Explicitely type XORFastHash 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann
f8b5e7e2c9 Removes XORMiniHash, unused 2016-01-26 17:54:08 +01:00
Daniel J. Hofmann
2c0547bb0e Make XORFastHash great again 2016-01-26 17:54:08 +01:00
Patrick Niklaus
4f792c40b7 Merge pull request #1928 from mortada/max_locations_map_matching
make it possible to disable max_locations in map_matching
2016-01-25 22:31:55 -05:00
Mortada Mehyar
17c3c1d66a improve comments for gps_precision 2016-01-25 15:17:44 -08:00
Mortada Mehyar
b48022be22 make it possible to disable max_locations in map_matching 2016-01-25 14:53:44 -08:00
Daniel J. Hofmann
502aedb33e Provide a way to selectively enable assertions in release mode
- Throwing an assertion exception for proper stack unwinding, making
  sure destructors are called

- On in Debug mode, in Release, enable via:

      cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_ASSERTIONS=ON

Current problem that I'm seeing is that some code is not catching
exceptions or worse silently swallowing them. Would like to check the
whole pipeline before merging this in.
2016-01-21 15:37:25 +01:00
Patrick Niklaus
439eb9da3d Create public facing libraries for extractor, contractor and datastore
New libraries libosrm_extract, libosrm_contract, libosrm_store
2016-01-21 06:47:34 +01:00
Moritz Kobitzsch
1c1bfd7541 Fix routing when start and target are on the same segment
Fixes issue #1864. Given the simple set-up:

a --> b --> c
^-----------|

This would translate into an edge based graph (ab) -> (bc),
(bc) -> (ca), (ca) -> (ab).

Starting at the end of the one-way street (ab) and going to
the beginning, the query has to find a self-loop within the
graph (ab) -> (bc) -> (ca) -> (ab), as both nodes map to the
same segment (ab).
2016-01-19 23:26:19 +01:00
Daniel Patterson
238e77d959 Include the travel mode in the last instruction by copying it from the previous instruction. 2016-01-19 21:28:56 +01:00
Daniel Patterson
e21eaa4b9e Adds a shared/exclusive lock around queries and CheckAndReloadFacade.
Without this, it's possible for CheckAndReloadFacade to start working
while a query is still in progress, leading to undefined behaviour.
2016-01-19 17:44:29 +01:00
Daniel J. Hofmann
80b897d8cf Fix shared memory non-copyable properties 2016-01-19 17:44:07 +01:00
Daniel Patterson
1ed7bcfb2c DataFacade should only remove shared segments if they're actually different from the last time they were checked. 2016-01-19 17:44:07 +01:00
Daniel J. Hofmann
e20f92bbbb Anonymous namespaces in header files are bad
They duplicate the code across translation units.
2016-01-19 17:42:49 +01:00
Daniel J. Hofmann
6e717bfd30 Switch to const constexpr for header constants (3.5/3 internal linkage) 2016-01-19 17:42:49 +01:00
Patrick Niklaus
9d12de9bce Fix wrong assertion and emplace_back bug in trip plugin 2016-01-19 17:36:29 +01:00
Daniel J. Hofmann
4b0e1a4b19 Run modernizer 2016-01-18 16:54:30 +01:00
Daniel J. Hofmann
491b1d9c96 Remove headers with no reverse dependencies
Found with

```
daniel@x1c /t/o/i/util> for header in *.hpp
                            echo -n $header:
                            ag -iQ $header ../../ --noheading | wc -l
                        end
...
fixed_point_number.hpp:0
range_algorithms.hpp:0
...
```

Only two. Surprises me to be honest.
But we're cleaning up for quite a bit now.
2016-01-18 16:05:39 +01:00
Moritz Kobitzsch
b8e29f5ae3 Add a u-turn instruciton when performing a u-turn at a via-node 2016-01-15 19:56:39 +01:00
Patrick Niklaus
6b15f29d7c Fix handling unexpected errors. 2016-01-14 18:27:36 +01:00
Daniel J. Hofmann
e7d9e42a16 Fix race condition in osrm-routed HTTP server
We had a similar issue a few month ago. Stumbled upon this by accident.

It goes like this:

- `output_buffer` is function-local
- we pass it to async_write and leave the scope
- `output_buffers` goes out of scope
- bad things happen, sometimes

The fix is to, again, put it inside the connection that handles itself
via the enable_shared_from_this idiom.

References:

- http://www.boost.org/doc/libs/1_59_0/doc/html/boost_asio/reference/async_write/overload1.html
- https://github.com/Project-OSRM/osrm-backend/pull/1690
2016-01-13 23:21:45 +01:00
Daniel J. Hofmann
466251287f Define compile-time constants for coordinate calculation only once
Closes #1327.
2016-01-12 19:59:02 +01:00
Daniel J. Hofmann
c93ca02fb8 Rips out dead code from the container.hpp and creates for_each_pai.hpp
I added two TODOs that I would like to address in the future.
2016-01-11 20:14:35 +01:00
Daniel J. Hofmann
4813488f84 Split import_edge.hpp: node_based_edge.hpp, edge_based_edge.hpp closes #1604 2016-01-11 20:11:44 +01:00
Daniel J. Hofmann
fc292cc2d8 No need for extra translation units (for edge data structures) 2016-01-11 20:11:44 +01:00
Daniel J. Hofmann
f875e26fbf Inline mercator transformations; no need for separate translation unit 2016-01-11 20:10:45 +01:00
Daniel J. Hofmann
f68247673a Make ComputeAngle a free standing function 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann
f65dd63210 Make TurnInstructionsClass functions free standing functions 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann
03f64a6c20 Make RouteNameExtraction a free standing function 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann
0627c3443d Make PolylineFormatter's encodedAsJSON and unencodedAsJSON free standing functions 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann
c65dd16460 Make PolylineCompresser's encode and decode free standing functions 2016-01-09 19:55:22 +01:00
Daniel J. Hofmann
c590596dbe Make DouglasPeucker a free standing function 2016-01-09 19:55:21 +01:00
Patrick Niklaus
23cd4d5ed2 not -> ! 2016-01-09 19:42:31 +01:00
Moritz Kobitzsch
4dc6ff9fb8 and another missed not 2016-01-09 19:42:31 +01:00
Moritz Kobitzsch
8638cbf8b2 missed a not 2016-01-09 19:42:31 +01:00
Moritz Kobitzsch
a2555983e6 replaces and/not with &&/! for windows 2016-01-09 19:42:31 +01:00
Daniel J. Hofmann
21804aecdb Prefer inline over static inline for free standing functions
When you mark free standing functions as `static inline` instead
of just `inline` they can not get merged across TUs and therefore
produce code bloat which is bad for the binaries size, the CPUs
instruction cache, and so on.

Please also see the discussion at:

- https://groups.google.com/forum/#!topic/mozilla.dev.platform/Ulw9HoZbSyQ
- http://stackoverflow.com/a/12836392

Note that non-fully specialized templates (i.e. with a kind of at
least `Template :: * -> *`) are `inline` by default.
2016-01-08 23:33:31 +01:00
Patrick Niklaus
6991a38703 Run clang-format 2016-01-08 01:31:57 +01:00
Patrick Niklaus
6b18e4f7e9 Add namespace around all files 2016-01-08 01:30:52 +01:00
Patrick Niklaus
efc9007cbf Remore start_phantom/target_phantom because they are useless here 2016-01-07 22:51:37 +01:00
Moritz Kobitzsch
efd33b295a Refactor guidance generation 2016-01-07 22:51:24 +01:00
Patrick Niklaus
fa4ba42f15 Use a sane gps_precision multipler 2016-01-07 16:30:54 +01:00
Patrick Niklaus
811e29ff1b Add cmath to geospatial_query 2016-01-07 11:35:35 +01:00
Patrick Niklaus
1da1fa5a31 Fix naming in PhantomNode 2016-01-05 12:41:16 +01:00
Patrick Niklaus
4f7369ed02 Fix naming in FixedPointCoordinate 2016-01-05 12:06:34 +01:00
Patrick Niklaus
4312013552 Fix naming in coordinate_calculation 2016-01-05 12:06:34 +01:00
Patrick Niklaus
ccd3872bf1 Fix naming in ScriptingEnvironment 2016-01-05 12:06:33 +01:00
Patrick Niklaus
b209952ce0 Fix naming of methodes for RouteParameters 2016-01-05 12:06:33 +01:00
Patrick Niklaus
3568de2c6c Fix missing include 2016-01-05 12:06:33 +01:00
Patrick Niklaus
028ca5c9d9 Apply clang-format 2016-01-05 12:04:04 +01:00
Patrick Niklaus
552cdbfe20 Apply clang-tidy 2016-01-05 11:54:31 +01:00
Daniel J. Hofmann
0d971a70cc Prevent comment splicing from backslash at end of line 2016-01-05 11:19:18 +01:00
Daniel J. Hofmann
0dda98384b Bump license year count for headers we install, too 2016-01-05 11:15:30 +01:00
Daniel J. Hofmann
685d330ee2 Remove license headers from project source files; global license 2016-01-04 19:06:32 +01:00
Patrick Niklaus
fce486735b Merge pull request #1841 from mortada/use_double_not_float
use double precision calculations instead of mixing double and float
2016-01-04 11:58:07 +01:00
Mortada Mehyar
a6cb786718 improve comments 2016-01-03 20:50:25 -08:00
Mortada Mehyar
93a2e66704 use double precision calculations instead of mixing double and float 2016-01-03 20:44:38 -08:00
Patrick Niklaus
97585bb26a Fix include paths 2016-01-03 18:47:50 +01:00
Patrick Niklaus
bfc6c9b89d Move files in src/ include/ 2016-01-03 16:37:38 +01:00
Patrick Niklaus
78ac3cffde Add max values for viaroute and trip and reorganize return code handling
"status" is now always:
 - 200 if the request was successful
 - 207 if the result is empty (no path found)
 - 400 if the request is invalid

 viaroute and trip now have a maximum of 500 and 100 locations
 respectively. Override with the --max-viaroute-size and --max-trip-size
 parameters.
2015-12-17 04:14:34 +01:00
Patrick Niklaus
63a59325f5 Fix SimpleClient 2015-12-16 00:26:13 +01:00
Patrick Niklaus
9a332d2f86 Fix osrm.hpp placement 2015-12-15 19:25:26 +01:00
Patrick Niklaus
6daa3290d4 Cleanup library setup 2015-12-14 22:00:20 +01:00
Patrick Niklaus
20c45be3b3 Address PR comments 2015-12-09 21:17:18 +01:00
Fabien Girard
f2ee0aad20 Use now 3 parameters for matrix: loc/dst/src 2015-12-09 21:17:18 +01:00
Fabien Girard
478d4a571a Support rectangular matrix with less sources than targets 2015-12-09 21:17:18 +01:00
Daniel Patterson
f87f18a291 Add support for 64bit OSM node id values. 2015-11-30 12:37:58 -08:00
Daniel Patterson
1536d1c044 Add bearing filter support to viaroute, trip, nearest, and distance
table plugins.
Make bearing range configurable by adding a comma-separated second part
to the bearing paramenter, like so:

    b=<bearing:0-359>(,<range:0-180>)

If no range is supplied, it defaults to +/- 10 degrees.
2015-11-17 16:35:20 -05:00
Daniel Patterson
d07c0bde80 Adds support for a new b= parameter on the viaroute and match
plugins, allowing for better nearest neighbor matching when a heading
is known.
2015-10-06 11:15:10 +02:00
Daniel J. Hofmann
db092c828e Don't pass by const-value for a read-only view.
I can't see a reason we pass by const-value here.

Note: changes API because of the `route_parameters` header.
2015-09-08 23:34:20 +02:00
Huyen Chau Nguyen
e773a80b06 remove possibility to choose algorithm but only use brute force and farthest insertion 2015-09-01 15:20:34 +02:00
Huyen Chau Nguyen
e6eea67eeb rename all names with round_trip, trip or tsp to trip to standardize the naming 2015-09-01 15:20:34 +02:00
Chau Nguyen
6191b6bee2 add parameter to choose algorithm for tsp calculation and remove redundant code 2015-09-01 15:20:33 +02:00
Daniel J. Hofmann
62b20769ee Modernize the code base to C++11 standards and beyond.
Apply `clang-modernize` (based on Clang 3.6) transformations to the
codebase while making sure to support Clang>=3.4 and GCC>=4.8.

We apply the transformations in parallel to speed up the quite
time consuming process, and use our `clang-format` style file
to automatically format the code respecting our coding conventions.

We use the following self-explanatory transformations:

* AddOverride
* LoopConvert
* PassByValue
* ReplaceAutoPtr
* UseAuto
* UseNullptr

This required a `compile_commands.json` compilation database, e.g.

    ccmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1

for CMake or check Bear for a Makefile based solution (or even Ninja).

    git ls-files -x '*.cpp|*.h' | \
      xargs -I{} -P $(nproc) clang-modernize -p build -final-syntax-check -format -style=file -summary -for-compilers=clang-3.4,gcc-4.8 -include . -exclude third_party {}

Boom!

References:

* http://clang.llvm.org/extra/clang-modernize.html
* http://clang.llvm.org/extra/ModernizerUsage.html
2015-08-18 12:56:34 +02:00
Andreas Gruß
9b0d3dfaeb polyline string as parameter added 2015-06-02 12:09:46 +02:00
Patrick Niklaus
8f3feac916 Ensure routed is backwards compatible 2015-04-22 09:49:08 +02:00
Patrick Niklaus
c0e066440c Use shared memory if no server paths are provided.
This caused a bug in the node bindings that would invoke the constructor
without parameters.
2015-04-22 09:49:08 +02:00
Dennis Luxen
8ee82d1e03 replace old-style typefs with using 2015-03-23 17:06:10 +01:00
Patrick Niklaus
d8d46e0f3e Add routed parameter to limit matching size 2015-03-03 00:48:57 +01:00
Patrick Niklaus
e5830b0116 Add parameters for map matching 2015-03-03 00:48:57 +01:00
Patrick Niklaus
70703c39f3 Add timestamp parameters and reset to beginning of breakage 2015-03-03 00:48:57 +01:00
Dennis Luxen
b0f9a0feb4 rename variable name to be a little more telling 2015-02-19 10:11:49 +01:00
Dennis Luxen
3bd27ae8c5 change copyright line from personal names to project 2015-02-19 09:19:51 +01:00
Dennis Luxen
79b9bdf7ce rename JSON namespace to osrm::json to avoid namespace clash with V8 2015-02-18 17:27:31 +01:00
Dennis Luxen
dd3b8469dd renamed: Include/* include/* 2015-01-27 13:17:18 +01:00