Commit Graph

765 Commits

Author SHA1 Message Date
Michael Bell
7f014bd616 Clarify identifier types used in data facade
The data facade interface contains numerous methods for looking up
datapoints by identifiers.
Many of the parameters use the NodeID or EdgeID types. However, these two
identifier types are used for representing three different contexts:

1. Node-based graph edges and nodes
2. Edge-based graph edges and nodes
3. Packed geometries

Consider the use of identifier parameters in these examples:

---

GetWeightPenaltyForEdgeID(const EdgeID id)  <- edge-based edge

GetUncompressedForwardWeights(const EdgeID id) <- packed geometry

IsLeftHandDriving(const NodeID id) <- edge-based node

GetBearingClass(const NodeID node) <- node-based node

---

This mixing of contexts within the same interface makes it
difficult to understand the relationships and dependencies between
the OSRM datasets.

For 1. and 2. we continue to use the NodeID and EdgeID types, but
change the interface parameter names to identify them as
edge-based or node-based graph properties.

For 3. we define a new type definition, PackedGeometryID.

These changes are to aid with readability. A next step would be
to strongly type these definitions, leveraging the Alias template
already used for OSM identifiers.
2022-08-21 21:37:39 +02:00
Siarhei Fedartsou
aadc088084
Fix distance calculation consistency. (#6315)
Consolidate great circle distance calculations to use cheap ruler library.
2022-08-19 22:31:40 +01:00
Siarhei Fedartsou
00816722dd
Configure Undefined Behaviour Sanitizer (#6290) 2022-08-01 22:40:26 +01:00
Siarhei Fedartsou
06b1b980bb
Enable even more clang-tidy checks (#6273) 2022-07-04 21:46:59 +01:00
Siarhei Fedartsou
3d2db20777
Enable more clang-tidy checks. (#6270)
* Enable more clang-tidy checks
2022-06-30 14:32:12 +01:00
Siarhei Fedartsou
59953172e8
Configure clang-tidy job on CI (#6261) 2022-06-28 00:14:28 +01:00
Michael Bell
e554624438 Reduce copying in API parameter constructors
When using non-default constructors for the API parameter classes,
vector arguments like coordinates and hints are copied at least once
(twice when passed as lvalue arguments).

Enable perfect forwarding of BaseParameter arguments and
pass-by-value in the constructor that uses the argument. This
ensures we copy at most once (zero for rvalue arguments).
2021-01-06 23:15:35 +00:00
Denis Chapligin
eb1d399f3b
Merge pull request #5894 from xlaussel/avoid_samelookup_in_heap_map
Avoid samelookup in heap map
2020-12-20 22:17:49 +02:00
Desone Burns II
0e10b94d38 Merge branch 'master' of github.com:Project-OSRM/osrm-backend into HEAD 2020-12-01 19:24:11 -07:00
xlaussel
687a3cdfbe Merge branch 'master' into avoid_samelookup_in_heap_map 2020-11-26 21:29:27 +01:00
Daniel Patterson
50d9632ed7
Upgrade formatting to clang-format 10 (#5895)
* Update formatting tools to clang-format-10

* Reformat using clang-format-10.0.09
2020-11-26 07:21:39 -08:00
xlaussel
fcb7dd2a21 format code 2020-11-25 12:42:01 +01:00
xlaussel
aa06029801 References removed for extracted heapNode: could lead to bugs because the same was sometimes modified after when relaxing outgoing edges 2020-11-25 11:22:30 +01:00
Desone Burns II
cf13a9714d clang-format-3.8 changed files 2020-11-24 08:06:26 -07:00
xlaussel
8697a6b14a Changes and corrections before change request
Cucumber successfull
2020-11-24 12:43:08 +01:00
xlaussel
697c2ff88d other improvements.
Variable renaming with better names
2020-11-23 23:11:41 +01:00
xlaussel
e181cb325c other improvements.
Variable renaming with better names
2020-11-23 23:10:22 +01:00
xlaussel
41af9615cd Improvements 2020-11-23 23:00:27 +01:00
xlaussel
13067844ee Changes made 2020-11-23 22:33:08 +01:00
Desone Burns II
e693b8963a Remove unsigned 0 comparison 2020-11-19 17:15:17 -07:00
Daniel Patterson
3451d1ec82
Lock access to facade_factory in data_watchdog to avoid accessing destructed object (#5844)
* Wrap access to facade_factory in a shared lock so it doesn't get changed partway through access which leads to a crash.
2020-09-30 18:45:44 -07:00
Michael Bell
4799b46eeb
Incorrect error message when unable to snap all input coordinates (#5846)
In cases where we are unable to find a phantom node for an input
coordinate, we return an error indicating which coordinate failed.

This would always refer to the coordinate with index equal to the
number of valid phantom nodes found.

We fix this by instead returning the first index for which a
phantom node could not be found.
2020-09-30 18:44:22 -07:00
Vyacheslav Napadovsky
f545f2293e Make MMapMemoryAllocator map files in read-only (O_RDONLY) mode. Mapping with O_RDWR will cause copy_up across Docker layers. 2020-09-09 00:51:42 +03:00
Denis Chaplygin
919fe74c40
Fixes signed/unsigned comparision spotted by gcc10.
Fixed by moving assertion to the actual point where signed values are used.
2020-06-17 13:18:21 +03:00
Denis Chaplygin
016c77a4de Flatbuffers is not a boost::optional friendly 2019-10-01 17:26:10 +03:00
Tom Peoples
28895373fb Fixed flatbufferbuiler copy issues.
Compiling under gcc9.1 we get copy issues.
It appears we shouldn't pass builder classes by value, only ref.
2019-10-01 21:54:00 +10:00
Denis Chaplygin
e97ec13064 Formatted the sources 2019-09-17 17:42:52 +03:00
Denis Chaplygin
660c0cc602 Implemented 'skip_waypoints' for the 'Table' service. 2019-09-17 17:42:52 +03:00
Denis Chaplygin
600f48e15a Implemented 'skip_waypoints' support in 'Route', 'Trip', 'Match' services. 2019-09-17 17:42:52 +03:00
Denis Chaplygin
1b47242a58 Implemented 'skip_waypoints' for the 'Nearest' service.
It actually makes no sence, as the only output on the 'Nearest' service
is a list of wypoints. On the other hand it can be used now as a simple
health check.
2019-09-17 17:42:52 +03:00
Denis Chaplygin
10c1b38139 Added new base parameter 'skip_waypoints' 2019-09-17 17:42:52 +03:00
Denis Chaplygin
0be87c73cf Fixed typo in flatbuffers: longitute -> longitude. 2019-08-26 14:31:51 +03:00
Denis Chaplygin
b8182dd7ff Replaced 'in' and 'out' at the flatbuffers 'instersection' object
with 'in_bearing' and 'out_bearing' to get flatbuffers schema javascript friendly.

Added a cucumber test for flatbuffers support.
2019-08-26 14:03:29 +03:00
Denis Chaplygin
80e1abba0c Added setting 'data_version' to all flatbuffers response functions. 2019-08-26 11:09:38 +03:00
Denis Chaplygin
97270ae473 Fixed nested offsets inside of the flatbuffers structure 2019-08-26 11:09:38 +03:00
Denis Chaplygin
a9c187c99b Updated changelog entry 2019-08-26 11:09:38 +03:00
Denis Chaplygin
2a1593fe05 Flatbuffers now uses floats instead of double. We do not use that precision anyway and it make output much smaller. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
73f544d4da Slightly changed the serialization order. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
889c82516f Set flatbuffers root type and removed unneded array for rows/cols 2019-08-26 11:08:56 +03:00
Denis Chaplygin
306c047c14 Generalized flatbuffers response generation in 'Route','Trip','Match' services. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
533f1ffc6b Inlined routes and waypoints, as all services are using at least one of those object, so there is no need for another one level of indirection. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
90191c9f34 Added flatbuffers output support to the 'Match' service 2019-08-26 11:08:56 +03:00
Denis Chaplygin
b7e9e5f2c0 Added flatbuffers output support to the 'Trip' service. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
13287d9970 Optimizing FB schema:
* Replaced Response union with nullable fields
* "Ok" code replaced with a boolean and a separate structure for a error code and message.
* Inlined geometry, thus removing one layer of indirection.
2019-08-26 11:08:56 +03:00
Denis Chaplygin
affa8a4653 Added flatbuffers output support to the 'Route' service. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
9d7a74445d Added flatbuffers output support to the 'Nearest' service. 2019-08-26 11:08:56 +03:00
Denis Chaplygin
acd3e81ab4 Removed ineffectivness in the serialization schema. Positions are
structs now and distance/duration matrices are just arrays.
2019-08-26 11:08:56 +03:00
Denis Chaplygin
ea111129dd Added full flatbuffers support to the Table service 2019-08-26 11:08:56 +03:00
Denis Chaplygin
7ddda105a3 Added flatbuffers support to the PluginBase::Error
This changes BREAKS osrm.
2019-08-26 11:08:56 +03:00
Denis Chaplygin
75aadb0f3f Passed ResultT down to engine plugins, so now they can form replies in different formats. 2019-08-26 11:08:56 +03:00