Commit Graph

67 Commits

Author SHA1 Message Date
Lauren Budorick
8d435638e1 Delete accidental/extraneous files 2015-09-23 10:33:27 -04:00
Daniel J. Hofmann
94af9b7f13 Caches iterators instead of invoking function calls on every iteration.
This caches iterators, i.e. especially the end iterator when possible.

The problem:

    for (auto it = begin(seq); it != end(seq); ++it)

this has to call `end(seq)` on every iteration, since the compiler is
not able to reason about the call's site effects (to bad, huh).

Instead do it like this:

    for (auto it = begin(seq), end = end(seq); it != end; ++it)

caching the end iterator.

Of course, still better would be:

    for (auto&& each : seq)

if all you want is value semantics.

Why `auto&&` you may ask? Because it binds to everything and never copies!

Skim the referenced proposal (that was rejected, but nevertheless) for a
detailed explanation on range-based for loops and why `auto&&` is great.

Reference:

- http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3853.htm
2015-09-15 12:09:39 +02:00
Lauren Budorick
5ac024788e Parse specific restriction:* tags based on profile exceptions 2015-09-10 15:52:26 -07:00
Patrick Niklaus
a95bf64ccf Fix processing for data files with incorrect node references 2015-09-10 12:22:03 +02:00
Lauren Budorick
bac6703f8e Implement raster source feature to read data from third-party sources, to be used in lua profiles.
* Adds a data structure, RasterSource, to store parsed + queryable data
* Adds bindings for that and relevant data structures as well as source_function and segment_function
* Adds relevant unit tests and cucumber tests
* Bring-your-own-data feature
2015-09-03 22:28:18 -07: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
Patrick Niklaus
84e72ede72 Warn if an edge references a missing node 2015-08-14 23:57:01 +02:00
Patrick Niklaus
49adf2192a Move calculate_coordinate to algorithms/
Fixes #1367
2015-08-12 13:02:18 +02:00
Patrick Niklaus
faa880d60a Remove unused memebers and rename to currrent style convention 2015-07-01 18:07:29 +02:00
Patrick Niklaus
f19c57200d Fix endless loop 2015-06-30 00:22:40 +02:00
Patrick Niklaus
dddde4ddab Fix backwards speed on oneway=-1 streets 2015-06-27 16:26:18 +02:00
Patrick Niklaus
94b749ab00 Fix magic number check for fingerprint 2015-06-19 17:51:35 +02:00
Patrick Niklaus
f12f6a56ba Fix debug message 2015-06-01 17:22:12 +02:00
Patrick Niklaus
2777d53a12 Direct edges in contractor correctly and add better graph validation. 2015-06-01 17:22:12 +02:00
Patrick Niklaus
3065de63dd Move renumbering and edge deduplication in extractor 2015-06-01 17:22:12 +02:00
Patrick Niklaus
a57fb4f1ab First step into overhauling the edge storage 2015-06-01 17:22:12 +02:00
Patrick Niklaus
a46bcf45d5 Move option parsing to own class 2015-05-28 15:18:48 +02:00
Daniel Patterson
eab87c0827 Return error message when lua error occurs.
The error may not be the first item in the stack while we're inside the error handler.  ::from_stack() works OK outside the error callback, but not inside.
2015-05-21 15:39:23 -07:00
Patrick Niklaus
fbb4e9078a Updated restriction parser doc 2015-04-21 20:00:58 +02:00
Patrick Niklaus
d96e90c6f4 Add documentation to ExtractionContainer 2015-04-21 20:00:58 +02:00
Patrick Niklaus
3b435d8956 Add documentation to ScriptingEnvironment 2015-04-21 20:00:58 +02:00
Patrick Niklaus
006bcc0fc8 Add some documentation to the restriction parser 2015-04-21 20:00:58 +02:00
Patrick Niklaus
c25d14e454 Remove unnecessary header include 2015-04-21 20:00:58 +02:00
Patrick Niklaus
5ff95dc32d Move string_map inside external_callbacks
It is not referenced outside this calls, thus the lifetime
can be safely handled by it.
2015-04-21 20:00:58 +02:00
Patrick Niklaus
34031aab1b Add further documentation to ExtractorCallbacks 2015-04-21 20:00:57 +02:00
Patrick Niklaus
3035219212 Add further documentation 2015-04-21 20:00:57 +02:00
Patrick Niklaus
8a608eb930 Add some doc to the extractor 2015-04-21 20:00:57 +02:00
Dennis Luxen
b76fc724fd make node id available thru Lua bindings 2015-04-13 09:58:59 +02:00
Patrick Niklaus
405f08b807 Make node location accessible 2015-04-10 11:45:24 +02:00
Dennis Luxen
7e00a86bb4 implement ISO 8601 durations parsing, cf. #1399 2015-03-02 17:18:52 +01:00
Dennis Luxen
3bd27ae8c5 change copyright line from personal names to project 2015-02-19 09:19:51 +01:00
Dennis Luxen
f67eeb66aa untangle includes using iwyu 2015-02-09 17:38:40 +01:00
Dennis Luxen
f35fa0049c reformat cherry-picked commit 2015-02-05 11:54:30 +01:00
Ben
d77a88c21e added lua binding for osmium::Way::id()
Conflicts:
	extractor/scripting_environment.cpp
2015-02-05 11:54:07 +01:00
Dennis Luxen
9f5fc4ab0c reorder includes 2015-01-31 21:17:16 +01:00
Dennis Luxen
b20b7e65bf renamed: Util/* -> util/* 2015-01-27 17:47:23 +01:00
Dennis Luxen
c8041bacd6 renamed: Util/IniFileUtil.h -> Util/ini_file.hpp 2015-01-27 16:57:50 +01:00
Dennis Luxen
cf21074f10 use enum as return code instead of boolean logic in extractor 2015-01-23 16:59:13 +01:00
Dennis Luxen
dc7f21513a move initialization of extractor config into main method and out out extraction logic 2015-01-23 16:30:14 +01:00
Dennis Luxen
8e105af232 remove redundant code from switch statement in restriction parser 2015-01-23 09:25:05 +01:00
Dennis Luxen
3fa12445a5 rename coordinate calculation functions, remove code clutter 2015-01-22 16:28:40 +01:00
Dennis Luxen
9175fb7da8 remove unused debug code 2015-01-22 15:19:43 +01:00
Dennis Luxen
887032881a use std::any_of() algorithm instead of hand-rolled logic 2015-01-22 15:09:24 +01:00
Dennis Luxen
e67f82283f replace temporary variable with short name by atomic<>.load call 2015-01-22 13:47:31 +01:00
Dennis Luxen
baacd0e50c reformat source files 2015-01-22 12:24:54 +01:00
Dennis Luxen
01f3237416 speed up nearest neighbor query by pruning, move coordinate calculations away from library interface 2015-01-20 16:24:49 +01:00
Dennis Luxen
8f813fbc67 clear result nodes/way in parser for each parsed element 2015-01-20 11:25:21 +01:00
Dennis Luxen
f4ff695080 replace conditional operator by explicit serialization 2015-01-20 10:50:33 +01:00
Dennis Luxen
08cc2bbd70 move thread local variables out of parsing scope 2015-01-16 18:22:37 +01:00
Dennis Luxen
46a7e46068 serialize lvalues as MSVC barfs out on serializing the return value of the conditional operator 2015-01-16 18:12:21 +01:00