Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion to C++ #187

Closed
wants to merge 234 commits into from
Closed
Show file tree
Hide file tree
Changes from 227 commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
078574f
Started adding unit tests.
zerebubuth May 8, 2014
8f6a507
Added first simple tests for middle.
zerebubuth May 8, 2014
32b1b84
Added dependency on Boost C++ utility libraries.
zerebubuth May 9, 2014
9b61fae
Added test for postgres middle.
zerebubuth May 9, 2014
d1d21d0
Updated README for new Boost dependency and tests.
zerebubuth May 9, 2014
df03ca0
Fix typo in temporary path.
zerebubuth May 9, 2014
dee8d77
D'oh, need to be superuser before creating tablespaces.
zerebubuth May 9, 2014
3966274
Renamed C files to C++ in preparation for destaticification.
zerebubuth May 12, 2014
eb95391
Made `middle` structure use virtual functions. Have not yet touched t…
zerebubuth May 12, 2014
a2ac1df
update regression test to search for contrib sql files (postgis, hsto…
kevinkreiser May 12, 2014
74f4650
fix merge conflict
kevinkreiser May 12, 2014
0d28634
Fix bug in use of `strncpy()`.
zerebubuth May 13, 2014
5a3e921
Propagate exit status information from the tests out to the test harn…
zerebubuth May 13, 2014
84ed64f
Changed `output_t` instances to be of class type with vtables.
zerebubuth May 13, 2014
df7678b
remove a bit of c syntax for initializing the output_t pgsql structs …
kevinkreiser May 13, 2014
54a1912
merge unstructification from mla
kevinkreiser May 13, 2014
d2001ec
Removed some static variables from output-pgsql.
zerebubuth May 13, 2014
cebccd0
Made `enable_way_area` not static.
zerebubuth May 13, 2014
75d9f19
Make `s_table` not static.
zerebubuth May 13, 2014
5baf333
Made a note that `flagsname` and `tagflags` are OK as statics, and ma…
zerebubuth May 13, 2014
521c7bd
Wildcard matching should operate on const char arrays.
zerebubuth May 13, 2014
4ec174a
turn osmdata_t into a proper object. make parsers call member functio…
kevinkreiser May 13, 2014
0eadfd0
add comments to main for input file usage. add comments for style fil…
kevinkreiser May 13, 2014
97d48cf
Removed a lot of static, global state variables from `output_pgsql_t`.
zerebubuth May 14, 2014
c2341d3
Merge remote-tracking branch 'MapQuest/kk_multiback' into mla_multi_b…
zerebubuth May 14, 2014
310a475
start constifying and destaticifying middle-pgsql
kevinkreiser May 14, 2014
44a8e7e
Removed static allocations from methods in `output_pgsql_t`.
zerebubuth May 14, 2014
9405ba4
Don't need extern any more.
zerebubuth May 14, 2014
1b9d83e
Add very simple escaping test.
zerebubuth May 14, 2014
09d39bb
Reserve correct amount of space for pgsql escaping.
zerebubuth May 14, 2014
95207c3
Merge remote-tracking branch 'MapQuest/kk_multiback' into mla_multi_b…
zerebubuth May 14, 2014
883d09f
Don't use `const osmid_t &`.
zerebubuth May 14, 2014
fa2ae5c
Removed statics from `output_gazetteer_t`.
zerebubuth May 14, 2014
91e2401
Fix middle test to find the right postgis extension files.
zerebubuth May 15, 2014
40e4a7f
Remove statics from `middle_pgsql_t`.
zerebubuth May 15, 2014
8b61e4f
Removed statics from `middle_ram_t`.
zerebubuth May 15, 2014
f18b46a
Removed statics from node cache objects.
zerebubuth May 15, 2014
cba5777
Removed an overlooked static from `middle_pgsql_t`.
zerebubuth May 15, 2014
48bb987
turn tagtransfrom into a proper object for use within output-pgsql as…
kevinkreiser May 15, 2014
8bb8453
missed a const on the layers used in tagtransform
kevinkreiser May 15, 2014
067084c
Merge remote-tracking branch 'MapQuest/kk_multiback' into mla_multi_b…
zerebubuth May 15, 2014
cceeb7d
Removed statics from `build_geometry`.
zerebubuth May 15, 2014
e2093a1
Destaticked `expire_tiles` and the projection code.
zerebubuth May 15, 2014
7b12bce
pull out global scale and keep it inside output_options. also pull ou…
kevinkreiser May 15, 2014
31d2cb7
Merge remote-tracking branch 'origin/mla_multi_backend' into kk_multi…
kevinkreiser May 15, 2014
0102425
remove main object globals and instantiant them where they are actual…
kevinkreiser May 16, 2014
f40202e
simplify main by moving options defaults into the options object. sta…
kevinkreiser May 16, 2014
87ee79a
construct osmdata as a proper object, no more javaesque init stuff
kevinkreiser May 16, 2014
3b2d4f4
move all of the parsing statitics out of osmdata_t and into a parsing…
kevinkreiser May 19, 2014
c6f0458
oops wanted to keep the references of tags from parse delegate to ind…
kevinkreiser May 19, 2014
3425b34
fix regression where action_t was not being updated on subsequent passes
kevinkreiser May 19, 2014
edcca90
make use of proper projection object everywhere instead of storying s…
kevinkreiser May 19, 2014
b4d85d6
tried to move out mid and out from options. move options into out. th…
kevinkreiser May 19, 2014
c97b056
finish removing output_t and middle_t from output_options. now all ac…
kevinkreiser May 19, 2014
aeb1676
Added first pass of moving 'done' logic to output.
zerebubuth May 20, 2014
c47b375
Actually, the gazetteer output doesn't need this.
zerebubuth May 20, 2014
714aa0e
Implemented pgsql ID tracker.
zerebubuth May 20, 2014
aa4d3ed
Moved more logic for done/pending status into output.
zerebubuth May 20, 2014
9edce0b
Deallocate ways and relations in `stop()`.
zerebubuth May 21, 2014
b6ca0af
Simulate deleting ways after iteration for compatibilty.
zerebubuth May 22, 2014
5c5fcb3
Add index on id for lookup speed. Still not as fast as before, sadly.
zerebubuth May 22, 2014
86252f7
move options out into its own file. next step make it parse itself an…
kevinkreiser May 22, 2014
b20ee9b
Made parsers call methods on `osmdata_t`.
zerebubuth May 22, 2014
5073463
Add, modify and delete nodes from mid directly rather than via out.
zerebubuth May 22, 2014
2e35014
merge from mla branch
kevinkreiser May 22, 2014
8800c5e
Almost removed all mid interactions from out way functions.
zerebubuth May 22, 2014
d351d09
Removed calls into mid from out for relations.
zerebubuth May 22, 2014
b3b8da4
let options pass back the input middle and output that will be used. …
kevinkreiser May 22, 2014
fe931da
make testing options easier by not letting it terminate the program b…
kevinkreiser May 22, 2014
dd98455
add test for parsing options
kevinkreiser May 22, 2014
6f3cf09
add first test case for options parsing. now more to follow
kevinkreiser May 22, 2014
26dc6cf
Change pgsql output to get information from middle about pending rela…
zerebubuth May 23, 2014
03490c8
Moved `start`, `stop` and `commit` to `osmdata_t`.
zerebubuth May 23, 2014
49d1901
not yet done with random options permutations but lots of other tests…
kevinkreiser May 23, 2014
3d74e68
Starting to split out `iterate_*` functionality.
zerebubuth May 23, 2014
692f575
Added subdir-objects automake option to keep it happy with newer auto…
zerebubuth May 27, 2014
4bc4f2b
Moved call to mid in interations out to `osmdata_t`.
zerebubuth May 27, 2014
c1daf7a
finish up random permutation test for options
kevinkreiser May 27, 2014
6fe6cd9
Iterate in `osmdata_t`, so that multiple can be handled.
zerebubuth May 27, 2014
4354781
Removed references to `output_t` from middles. Note this also removes…
zerebubuth May 28, 2014
035892a
move some fundamental table operations into the table class. change o…
kevinkreiser May 28, 2014
5c2a308
Use a (base) query interface so that outputs cannot perform modifying…
zerebubuth May 28, 2014
8e9ffe1
move table functions out into their own file. move back tag exporting…
kevinkreiser May 28, 2014
75148ec
forgot to add table sources
kevinkreiser May 28, 2014
91cd8ae
Merge remote-tracking branch 'MapQuest/kk_multiback' into mla_multi_b…
zerebubuth May 28, 2014
c5637be
Merge remote-tracking branch 'MapQuest/kk_multiback' into mla_multi_b…
zerebubuth May 28, 2014
827080d
Merge remote-tracking branch 'MapQuest/kk_multiback' into mla_multi_b…
zerebubuth May 28, 2014
b2101dd
remove superfluous methods in output close and connect when these ope…
kevinkreiser May 28, 2014
2583f5b
reorganize output_pgsql_t::start so that we might be able to stop it …
kevinkreiser May 28, 2014
1aa2800
Use `const middle_query_t *` everywhere in the output classes.
zerebubuth May 29, 2014
b383646
Move `shared_ptr` header to parse, as it is not needed in osmtypes.
zerebubuth May 29, 2014
3433ce3
Added first pass attempt at `output_multi_t`.
zerebubuth May 29, 2014
4d48300
Use C++ `std::string`s in `options_t`.
zerebubuth May 30, 2014
1c4a5af
Made `output_t` own a copy of the `options_t` object.
zerebubuth May 30, 2014
3b17ba6
Hook up `output_multi_t` to the `output_t` factory.
zerebubuth May 30, 2014
0285fca
move as much as possible into table_t all of the sql interactions. ex…
kevinkreiser May 30, 2014
370451b
merge mla branch and kk branch
kevinkreiser May 30, 2014
144ff9a
s/srs/srid/
zerebubuth May 30, 2014
d4bff7b
Finished hooking up output multi.
zerebubuth May 30, 2014
bbb7883
Use the same `write_wkt` function for writing nodes.
zerebubuth May 30, 2014
b7bdc3f
move all psql interaction to table_t object. next step is to remove p…
kevinkreiser Jun 2, 2014
3abeece
Merge remote-tracking branch 'MapQuest/kk_multiback' into mla_multi_b…
zerebubuth Jun 3, 2014
eea4be9
Throw explanatory message rather than abort.
zerebubuth Jun 3, 2014
f25ab0d
remove passing around of copy values sql string buffer and use only l…
kevinkreiser Jun 3, 2014
ae2e0e3
Added point processor for multi-table output.
zerebubuth Jun 3, 2014
4fad703
Merge remote-tracking branch 'MapQuest/kk_multiback' into mla_multi_b…
zerebubuth Jun 3, 2014
ec8e5ef
Store and use multiple outputs.
zerebubuth Jun 3, 2014
feb7d28
Add (really unimaginative) test for multi-table output.
zerebubuth Jun 3, 2014
0ef18c5
fix a bunch of warnings. reinstate a controllable buffer
kevinkreiser Jun 4, 2014
2bb801a
Merge remote-tracking branch 'origin/mla_multi_backend' into kk_multi…
kevinkreiser Jun 4, 2014
28aeaa3
remove cleanup methods as they do nothing. restructure table_t to mak…
kevinkreiser Jun 4, 2014
c30cc52
change the interface in build_geometry so that it can be better used …
kevinkreiser Jun 9, 2014
17136d4
add tests for multi output lines. next up polygons
kevinkreiser Jun 10, 2014
768a0b5
add setup for processor-polygon
kevinkreiser Jun 10, 2014
865b296
add an in memory id tracker for pending ways and rels brings performa…
kevinkreiser Jun 11, 2014
a3f4a8c
forgot to add the actual source for the id tracker
kevinkreiser Jun 11, 2014
e3eef60
Pass `export_list` by reference, not pointer.
zerebubuth Jun 11, 2014
8da781c
Add options to control Lua function names.
zerebubuth Jun 11, 2014
aa1ff6e
Experimental ID tracker implementation.
zerebubuth Jun 11, 2014
e29f1a5
turn text tree into a proper object so as to associate its life to wi…
kevinkreiser Jun 11, 2014
6e7101e
Merge remote-tracking branch 'origin/mla_multi_backend' into kk_multi…
kevinkreiser Jun 11, 2014
1b01790
Add comments about the three major phases of osm2pgsql
pnorman Jun 11, 2014
6a8e13c
Merge remote-tracking branch 'mapquest/kk_multiback' into pn_multiback
pnorman Jun 12, 2014
7d9d839
get polygons into the multi output
kevinkreiser Jun 12, 2014
ddeaaae
Add basic comments to run_internal_until
pnorman Jun 12, 2014
b4a3128
Merge remote-tracking branch 'mapquest/kk_multiback' into pn_multiback
pnorman Jun 12, 2014
cdf2277
protect against out of bounds read
kevinkreiser Jun 13, 2014
1540ecf
Merge remote-tracking branch 'origin/pn_multiback' into kk_multiback
kevinkreiser Jun 13, 2014
868b21a
let the caller of geometry builder specify if they want just polygons…
kevinkreiser Jun 13, 2014
9c019f3
got pending tracking into output_multi_t. polygons also seem to be wo…
kevinkreiser Jun 13, 2014
5f790f4
oops polygon processor wasnt looking for polygons..
kevinkreiser Jun 16, 2014
fddcc3c
add strict mode to tag transform basic filtering so as to remove any …
kevinkreiser Jun 16, 2014
925b59e
add expiry/dirty to output-multi. move geometry helpers into geometry…
kevinkreiser Jun 16, 2014
2565bf7
since middle is not seprate from out we are now keeping all way tags …
kevinkreiser Jun 17, 2014
7cad372
keep track (in mem) of pending ways and rels due to node changes
kevinkreiser Sep 4, 2014
7787a2b
hook up a bunch of the other scenarios in which ways or rels get mark…
kevinkreiser Sep 4, 2014
ffcfa1c
hook up in memory tracker for actually sending pending items to the o…
kevinkreiser Sep 4, 2014
251ae9b
clean out in db pending ways and rels for middle. still one more roun…
kevinkreiser Sep 4, 2014
894236a
Merge remote-tracking branch 'origin/kk_multiback' into kk_multiback
kevinkreiser Sep 4, 2014
eaedf6d
add some small bookkeeping to id tracker to know how many marks it is…
kevinkreiser Sep 5, 2014
a44f99e
use a hashmap for matching queried nodes to the in memory list via id
kevinkreiser Sep 5, 2014
9f4b5ee
more copy elision
kevinkreiser Sep 5, 2014
bf0fda3
add some threading deps
kevinkreiser Sep 5, 2014
940db8f
need the threading deps linked as well
kevinkreiser Sep 10, 2014
95ab5d3
a performance step back but simplify the hand off between middle pend…
kevinkreiser Sep 10, 2014
b2903de
start implementing threadsafe reading from middle
kevinkreiser Sep 10, 2014
43a7cfe
add middle interface for per thread use
kevinkreiser Sep 11, 2014
777cd0b
simplify the middle instance per thread stuff
kevinkreiser Sep 11, 2014
0958b29
need newer version of boost for lockfree queue
kevinkreiser Sep 12, 2014
75f3a75
make MOAR copy constructors although because we are using pointer to …
kevinkreiser Sep 12, 2014
b628728
Test should use local files.
zerebubuth Sep 15, 2014
e47a48a
Abstract `expire_tiles` output.
zerebubuth Sep 15, 2014
8b28b81
Check that we have lua and protobuf before relying on types from them
pnorman Sep 15, 2014
fcc3240
Merge pull request #5 from pnorman/threadpend_luapbf
pnorman Sep 15, 2014
c0a1be8
Fixed use-after-free bug.
zerebubuth Sep 15, 2014
a2207bf
Started adding basic expiry tests.
zerebubuth Sep 15, 2014
fbefcc4
More test infrastructure.
zerebubuth Sep 15, 2014
41fcdd4
Added expiry tree merging.
zerebubuth Sep 15, 2014
6f45ad1
Added tests covering more code paths.
zerebubuth Sep 15, 2014
aa7fc5f
Added comments.
zerebubuth Sep 15, 2014
92a5aba
Merge commit 'b59765e3ac591ff84f21f4a1153e7c18a2d2b855' into cpp_merge
pnorman Sep 15, 2014
fca5f04
Add clone methods to output classes, which create clones using the co…
hollinger Sep 15, 2014
3e54811
Merge branch 'master' into cpp_merge
pnorman Sep 15, 2014
79680bd
Merge pull request #7 from MapQuest/cpp_merge
pnorman Sep 16, 2014
f3bf8bf
Add test for pgsql output.
zerebubuth Sep 16, 2014
2292e51
Merge remote-tracking branch 'origin/kk_threadpend' into jh_threadpend
hollinger Sep 16, 2014
68a5fcc
Merge remote-tracking branch 'zerebubuth/landuse_test_fix' into jh_th…
hollinger Sep 16, 2014
830458e
Merge pull request #8 from MapQuest/mla_threadpend_tests
hollinger Sep 16, 2014
548ccb8
Merge remote-tracking branch 'origin/jh_threadpend' into jh_threadpend
hollinger Sep 16, 2014
dec9b54
Merge remote-tracking branch 'origin/mla_threadpend' into jh_threadpend
hollinger Sep 16, 2014
73e98aa
Merge pull request #6 from MapQuest/mla_threadpend
hollinger Sep 16, 2014
bc88c1b
Merge remote-tracking branch 'origin/kk_threadpend' into jh_threadpend
hollinger Sep 16, 2014
c63b1a1
Update readme, fix markdown
pnorman Sep 16, 2014
3b56428
Combine base classes way_cb_func and rel_cb_func into single base cla…
hollinger Sep 17, 2014
b3f0693
Threaded pending process work in progress.
hollinger Sep 17, 2014
c0e4c99
Merge expires on stop in multi and pgsql outputs.
hollinger Sep 19, 2014
28cfac3
Use cloned middle in cloned outputs.
hollinger Sep 22, 2014
bae7808
Need to include std set in test-expire-tiles.
hollinger Sep 22, 2014
fe7ce22
Populate pending job queue prior to cloning out the middles and outputs.
hollinger Sep 23, 2014
68ff8a8
change around output map to be a vector with the index in the vector …
kevinkreiser Sep 23, 2014
a8c5b9f
remove some of the native pointers and finish up moving pending rels …
kevinkreiser Sep 23, 2014
659b9bb
refactored a bunch of native pointers to smart ones. tests still fail…
kevinkreiser Sep 23, 2014
c50bf83
remove pending tracking from the ram middle processing as now the mid…
kevinkreiser Sep 23, 2014
3f06a42
make clone test pass
kevinkreiser Sep 24, 2014
801a51a
text tree is manditory but we need to stop it from being a global
kevinkreiser Sep 24, 2014
5c86f4f
Remove way callbacks which are no longer needed.
hollinger Sep 24, 2014
0aa391a
all tests passing with non global text_tree. but performance shouldnt…
kevinkreiser Sep 24, 2014
8c36d95
use threading from the options object not hardcoded
kevinkreiser Sep 24, 2014
3f248b4
Remove relation callbacks and replace with threaded relation processing.
hollinger Sep 24, 2014
fa05c07
Merge remote-tracking branch 'origin/jh_threadpend' into jh_threadpend
hollinger Sep 24, 2014
49a7ef2
fix up pending way processing screen output
kevinkreiser Sep 25, 2014
bb04da7
Merge remote-tracking branch 'origin/jh_threadpend' into jh_threadpend
kevinkreiser Sep 25, 2014
6bbc617
make the rel pending screen output proper
kevinkreiser Sep 25, 2014
48c0fe1
clean up pending rel printouts
kevinkreiser Sep 25, 2014
756a774
dont add bogus ids to the pending threads' work queue
kevinkreiser Sep 25, 2014
3cb5132
add a test for way area missing
kevinkreiser Sep 25, 2014
d7d473a
fix up ram cache misses in pending for middle_pgsql_t
kevinkreiser Sep 26, 2014
1dfce32
fix a bug where threaded pending would not have access to the informa…
kevinkreiser Sep 26, 2014
6debabc
dont set way done tracker when reprocessing relations as no one cares…
kevinkreiser Sep 26, 2014
de5f2af
add failing test for route relations duplication in lines table
kevinkreiser Sep 26, 2014
0502eb2
get osm2pgsql working again with threaded pending. more perf stuff to do
kevinkreiser Sep 26, 2014
4b6489a
parallelize the indexing between middles and outs at the end of pendi…
kevinkreiser Sep 29, 2014
cd1a5b8
attempt to remove the atomic and lockfree requirements which allows u…
kevinkreiser Sep 29, 2014
6d86e60
forgot to ifdef around the atomic headers
kevinkreiser Sep 29, 2014
eb63841
Merge pull request #12 from MapQuest/kk_reduceboostversion
kevinkreiser Sep 29, 2014
697a956
remove boost asio dependency as it was never used
kevinkreiser Sep 30, 2014
74788d9
Merge branch 'cpp_conversion' of https://github.com/MapQuest/osm2pgsq…
kevinkreiser Sep 30, 2014
d5788e5
Add a check for null buildings in the foobar_building test
pnorman Jun 17, 2014
396f7b8
Add a travis file for CI
pnorman Oct 1, 2014
b81e9e5
remove unused parameter names and GCC __attribute__
Oct 2, 2014
9f0388b
fix some warinigs by removing unused variables
Oct 2, 2014
d5279f3
Merge pull request #14 from MapQuest/cpp_readme
pnorman Oct 2, 2014
2331c93
Merge pull request #13 from pnorman/pn_tests_updates
pnorman Oct 2, 2014
defae78
Merge pull request #17 from alex85k/attribute-removed
pnorman Oct 2, 2014
a45343d
Merge pull request #18 from pnorman/travis
pnorman Oct 2, 2014
5d0a86b
fix c++11 compiler confusion
Sep 30, 2014
ea9e577
Merge pull request #21 from alex85k/pair-fix
zerebubuth Oct 2, 2014
432ccfb
fix headers and missing functions for MSVC/MinGW
Oct 2, 2014
541a55e
Merge pull request #19 from alex85k/windows-includes
zerebubuth Oct 2, 2014
5304e67
fix tests compilation on MSVC
Oct 1, 2014
5055242
Merge pull request #22 from alex85k/tests-msvc-fix
zerebubuth Oct 2, 2014
18b5cc2
remove unneded module, fixes errors on default Python installation
Oct 3, 2014
d2d77a1
Merge pull request #23 from alex85k/py-nopwd
zerebubuth Oct 3, 2014
aeff786
replace variable length arrays with std::vector
Oct 3, 2014
6b1a6cb
Merge pull request #24 from alex85k/array-to-vector
zerebubuth Oct 3, 2014
69bbb51
Update parse-pbf.c for protobuf 1.0.X
rachekalmir Aug 29, 2014
6814348
Merge pull request #25 from alex85k/from-master
zerebubuth Oct 6, 2014
e98e404
dont use a freed pointer in a log line
kevinkreiser Oct 15, 2014
edae78b
Merge remote-tracking branch 'origin/cpp_conversion' into cpp_conversion
kevinkreiser Oct 15, 2014
9128e8a
and dont use tabs where you should use space
kevinkreiser Oct 15, 2014
ce4c860
Prefix isnan with std
pnorman Oct 17, 2014
d291f74
Check multiple boost versions with travis, drop boost requirement to …
pnorman Oct 17, 2014
5c19247
Merge pull request #28 from pnorman/travis_boost
pnorman Oct 20, 2014
64e0572
Merge pull request #27 from pnorman/std_isnan
pnorman Oct 20, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions .gitignore
@@ -1,4 +1,5 @@
*.o
*~
Makefile.in
aclocal.m4
autom4te.cache/
Expand Down Expand Up @@ -36,3 +37,26 @@ libtool
.deps/
stamp-h1
INSTALL

log
test-driver
test-suite.log
tests/.dirstamp
tests/test-parse-xml2
tests/test-middle-ram
tests/test-middle-pgsql
tests/test-pgsql-escape
tests/test-parse-options
tests/test-output-multi-line
tests/test-output-multi-point
tests/test-output-multi-point-multi-table
tests/test-output-multi-polygon
tests/test-output-pgsql
tests/test-expire-tiles
tests/*.log
tests/*.trs
tests/test_output_pgsql_area_way.flat.nodes.bin

.libs/
*.lo
libosm2pgsql.la
31 changes: 31 additions & 0 deletions .travis.yml
@@ -0,0 +1,31 @@
language: cpp
compiler:
- gcc
- clang
env:
- USE_LUA=true
- USE_LUA=false
before_install:
- sudo add-apt-repository -y ppa:boost-latest/ppa
- sudo apt-get update -qq
install:
- sudo apt-get install -y -qq autoconf automake libtool make g++ libpq-dev libxml2-dev libbz2-dev libproj0 proj-bin libproj-dev # core deps
- sudo apt-get install -y -qq boost1.55
- sudo apt-get install -y -qq protobuf-c-compiler libprotobuf-c0-dev
- sudo apt-get install -y -qq libgeos-3.3.3 libgeos-dev libgeos++-dev
- |-
if [ "${USE_LUA}" = "true" ]; then
sudo apt-get install -y -qq lua5.2 liblua5.2-dev
fi
before_script:
- xml2-config --version
- geos-config --version
- proj | head -n1
- |-
if [ "${USE_LUA}" = "true" ]; then
lua -v
fi
script:
./autogen.sh && ./configure && make -j2
after_failure:
- cat config.log
152 changes: 140 additions & 12 deletions Makefile.am
@@ -1,14 +1,131 @@
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = subdir-objects

bin_PROGRAMS = osm2pgsql nodecachefilereader

osm2pgsql_SOURCES = build_geometry.cpp input.c middle.h middle-ram.h output-gazetteer.h output-pgsql.c rb.c sanitizer.h text-tree.h build_geometry.h input.h middle-pgsql.c osm2pgsql.c output.h output-pgsql.h rb.h sprompt.c UTF8sanitizer.c expire-tiles.c keyvals.c middle-pgsql.h osmtypes.h output-null.c parse-o5m.c parse-o5m.h parse-primitive.c parse-primitive.h parse-xml2.c parse-xml2.h pgsql.c reprojection.c sprompt.h expire-tiles.h keyvals.h middle-ram.c output-gazetteer.c output-null.h pgsql.h reprojection.h text-tree.c node-ram-cache.c wildcmp.c node-ram-cache.h node-persistent-cache.c node-persistent-cache.h binarysearcharray.c binarysearcharray.h tagtransform.c

nodecachefilereader_SOURCES = node-persistent-cache-reader.c node-persistent-cache.c node-ram-cache.c binarysearcharray.c

noinst_LTLIBRARIES = libosm2pgsql.la

osm2pgsql_SOURCES = osm2pgsql.cpp \
binarysearcharray.hpp \
geometry-builder.hpp \
expire-tiles.hpp \
input.hpp \
keyvals.hpp \
middle-pgsql.hpp \
middle-ram.hpp \
middle.hpp \
node-persistent-cache.hpp \
node-ram-cache.hpp \
options.hpp \
osmdata.hpp \
osmtypes.hpp \
output-gazetteer.hpp \
output-null.hpp \
output-pgsql.hpp \
output.hpp \
parse.hpp \
parse-o5m.hpp \
parse-pbf.hpp \
parse-primitive.hpp \
parse-xml2.hpp \
pgsql.hpp \
rb.hpp \
reprojection.hpp \
sanitizer.hpp \
sprompt.hpp \
table.hpp \
text-tree.hpp \
util.hpp

osm2pgsql_LDADD = libosm2pgsql.la

libosm2pgsql_la_SOURCES = \
UTF8sanitizer.cpp \
binarysearcharray.cpp \
buffer.cpp \
expire-tiles.cpp \
geometry-builder.cpp \
geometry-processor.cpp \
id-tracker.cpp \
input.cpp \
keyvals.cpp \
middle.cpp \
middle-pgsql.cpp \
middle-ram.cpp \
node-persistent-cache.cpp \
node-ram-cache.cpp \
options.cpp \
osmdata.cpp \
output.cpp \
output-gazetteer.cpp \
output-multi.cpp \
output-null.cpp \
output-pgsql.cpp \
parse.cpp \
parse-o5m.cpp \
parse-pbf.cpp \
parse-primitive.cpp \
parse-xml2.cpp \
pgsql.cpp \
pgsql-id-tracker.cpp \
processor-line.cpp \
processor-point.cpp \
processor-polygon.cpp \
rb.cpp \
reprojection.cpp \
sprompt.cpp \
table.cpp \
taginfo.cpp \
tagtransform.cpp \
text-tree.cpp \
util.cpp \
wildcmp.cpp

nodecachefilereader_SOURCES = node-persistent-cache-reader.cpp
nodecachefilereader_LDADD = libosm2pgsql.la

check_PROGRAMS = \
tests/test-parse-xml2 \
tests/test-middle-ram \
tests/test-middle-pgsql \
tests/test-output-multi-line \
tests/test-output-multi-point \
tests/test-output-multi-point-multi-table \
tests/test-output-multi-polygon \
tests/test-output-pgsql \
tests/test-pgsql-escape \
tests/test-parse-options \
tests/test-expire-tiles

tests_test_parse_xml2_SOURCES = tests/test-parse-xml2.cpp
tests_test_parse_xml2_LDADD = libosm2pgsql.la
tests_test_middle_ram_SOURCES = tests/test-middle-ram.cpp tests/middle-tests.cpp
tests_test_middle_ram_LDADD = libosm2pgsql.la
tests_test_middle_pgsql_SOURCES = tests/test-middle-pgsql.cpp tests/middle-tests.cpp tests/common-pg.cpp
tests_test_middle_pgsql_LDADD = libosm2pgsql.la
tests_test_output_multi_line_SOURCES = tests/test-output-multi-line.cpp tests/common-pg.cpp
tests_test_output_multi_line_LDADD = libosm2pgsql.la
tests_test_output_multi_point_SOURCES = tests/test-output-multi-point.cpp tests/common-pg.cpp
tests_test_output_multi_point_LDADD = libosm2pgsql.la
tests_test_output_multi_point_multi_table_SOURCES = tests/test-output-multi-point-multi-table.cpp tests/common-pg.cpp
tests_test_output_multi_point_multi_table_LDADD = libosm2pgsql.la
tests_test_output_multi_polygon_SOURCES = tests/test-output-multi-polygon.cpp tests/common-pg.cpp
tests_test_output_multi_polygon_LDADD = libosm2pgsql.la
tests_test_output_pgsql_SOURCES = tests/test-output-pgsql.cpp tests/common-pg.cpp
tests_test_output_pgsql_LDADD = libosm2pgsql.la
tests_test_pgsql_escape_SOURCES = tests/test-pgsql-escape.cpp
tests_test_pgsql_escape_LDADD = libosm2pgsql.la
tests_test_parse_options_SOURCES = tests/test-parse-options.cpp
tests_test_parse_options_LDADD = libosm2pgsql.la
tests_test_expire_tiles_SOURCES = tests/test-expire-tiles.cpp
tests_test_expire_tiles_LDADD = libosm2pgsql.la

TESTS = $(check_PROGRAMS) tests/regression-test.sh
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = sh

if READER_PBF
osm2pgsql_SOURCES += parse-pbf.c parse-pbf.h fileformat.pb-c.c fileformat.pb-c.h osmformat.pb-c.c osmformat.pb-c.h
osm2pgsql_SOURCES += parse-pbf.hpp fileformat.pb-c.h osmformat.pb-c.h
libosm2pgsql_la_SOURCES += parse-pbf.cpp fileformat.pb-c.c osmformat.pb-c.c

fileformat.pb-c.c: protobuf/fileformat.proto
$(AM_V_GEN) $(PROTOC_C) --proto_path=protobuf --c_out=. $<
Expand Down Expand Up @@ -41,9 +158,22 @@ endif
osm2pgsqldir = $(datadir)/osm2pgsql

AM_CFLAGS = @PTHREAD_CFLAGS@ @LFS_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML2_CFLAGS@ @BZIP2_CFLAGS@ @GEOS_CFLAGS@ @PROJ_CFLAGS@ @PROTOBUF_C_CFLAGS@ @ZLIB_CFLAGS@ -DOSM2PGSQL_DATADIR='"$(osm2pgsqldir)"' -DVERSION='"@PACKAGE_VERSION@"' @LUA_INCLUDE@
AM_CPPFLAGS = @PTHREAD_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML2_CFLAGS@ @BZIP2_CFLAGS@ @GEOS_CFLAGS@ @PROJ_CFLAGS@ -DOSM2PGSQL_DATADIR='"$(osm2pgsqldir)"' -Igeos-fallback @LUA_INCLUDE@

AM_LDFLAGS = @PTHREAD_CFLAGS@ @ZLIB_LDFLAGS@ @ZLIB_LIBS@ @POSTGRESQL_LDFLAGS@ @POSTGRESQL_LIBS@ @XML2_LDFLAGS@ @BZIP2_LDFLAGS@ @BZIP2_LIBS@ @GEOS_LDFLAGS@ @GEOS_LIBS@ @PROJ_LDFLAGS@ @PROJ_LIBS@ @PROTOBUF_C_LDFLAGS@ @PROTOBUF_C_LIBS@ -L/usr/lib/x86_64-linux-gnu @LUA_LIB@
AM_CPPFLAGS = @PTHREAD_CFLAGS@ @POSTGRESQL_CFLAGS@ @XML2_CFLAGS@ @BZIP2_CFLAGS@ @GEOS_CFLAGS@ @PROJ_CFLAGS@ -DOSM2PGSQL_DATADIR='"$(osm2pgsqldir)"' -Igeos-fallback @LUA_INCLUDE@ @BOOST_CPPFLAGS@

GLOBAL_LDFLAGS = @PTHREAD_CFLAGS@ @ZLIB_LDFLAGS@ @ZLIB_LIBS@ @POSTGRESQL_LDFLAGS@ @POSTGRESQL_LIBS@ @XML2_LDFLAGS@ @BZIP2_LDFLAGS@ @BZIP2_LIBS@ @GEOS_LDFLAGS@ @GEOS_LIBS@ @PROJ_LDFLAGS@ @PROJ_LIBS@ @PROTOBUF_C_LDFLAGS@ @PROTOBUF_C_LIBS@ -L/usr/lib/x86_64-linux-gnu @LUA_LIB@ @BOOST_LDFLAGS@ @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@ @BOOST_THREAD_LIB@ -lstdc++
osm2pgsql_LDADD += $(GLOBAL_LDFLAGS)
tests_test_parse_xml2_LDADD += $(GLOBAL_LDFLAGS)
tests_test_middle_ram_LDADD += $(GLOBAL_LDFLAGS)
tests_test_middle_pgsql_LDADD += $(GLOBAL_LDFLAGS)
tests_test_output_multi_line_LDADD += $(GLOBAL_LDFLAGS)
tests_test_output_multi_point_LDADD += $(GLOBAL_LDFLAGS)
tests_test_output_multi_point_multi_table_LDADD += $(GLOBAL_LDFLAGS)
tests_test_output_multi_polygon_LDADD += $(GLOBAL_LDFLAGS)
tests_test_output_pgsql_LDADD += $(GLOBAL_LDFLAGS)
tests_test_pgsql_escape_LDADD += $(GLOBAL_LDFLAGS)
tests_test_parse_options_LDADD += $(GLOBAL_LDFLAGS)
tests_test_expire_tiles_LDADD += $(GLOBAL_LDFLAGS)
nodecachefilereader_LDADD += $(GLOBAL_LDFLAGS)

osm2pgsql_DATA = default.style 900913.sql

Expand All @@ -66,6 +196,4 @@ distclean-local:
@rm -f $(PACKAGE).spec
@rm -f config.nice

test:
tests/regression-test.py -f tests/liechtenstein-2013-08-03.osm.pbf
tests/regression-test.py -f tests/liechtenstein-2013-08-03.osm.bz2
test: check
38 changes: 31 additions & 7 deletions README.md
Expand Up @@ -49,16 +49,17 @@ compiler.
To install on a Debian or Ubuntu system, first install the prerequisites:

```sh
sudo apt-get install autoconf automake libtool make g++ libxml2-dev libgeos-dev
libgeos++-dev libpq-dev libbz2-dev libproj-dev protobuf-c-compiler
libprotobuf-c0-dev libbz2-dev lua5.2 liblua5.2-dev
sudo apt-get install autoconf automake libtool make g++ libboost-dev \
libboost-system-dev libboost-filesystem-dev libboost-thread-dev libxml2-dev \
libgeos-dev libgeos++-dev libpq-dev libbz2-dev libproj-dev
protobuf-c-compiler libprotobuf-c0-dev libbz2-dev lua5.2 liblua5.2-dev
```

To install on a Fedora system, use

```sh
sudo yum install gcc-c++ libxml2-devel geos-develpostgresql-devel bzip2-devel
proj-devel protobuf-compiler
sudo yum install gcc-c++ boost-devel libxml2-devel geos-devel \
postgresql-devel bzip2-devel proj-devel protobuf-compiler
```

Then you should be able to bootstrap the build system:
Expand Down Expand Up @@ -100,8 +101,8 @@ When importing a large amount of data such as the complete planet, a typical
command line would be

```sh
osm2pgsql -c -d gis --slim -C <cache size> \
--flat-nodes <flat nodes> planet-latest.osm.pbf
osm2pgsql -c -d gis --slim -C <cache size> \
--flat-nodes <flat nodes> planet-latest.osm.pbf
```
where
* ``<cache size>`` is 24000 on machines with 32GiB or more RAM
Expand All @@ -127,6 +128,29 @@ null backend for testing.
Any questions should be directed at the osm dev list
http://wiki.openstreetmap.org/index.php/Mailing_lists

## Testing ##

The code also comes with a suite of tests which can be run by
executing ``make check``.

Some of these tests depend on being able to set up a database and run
osm2pgsql against it. You need to ensure that PostgreSQL is running
and that your user is a superuser of that system. To do that, run:

```sh
sudo -u postgres createuser -s $USER
sudo mkdir -p /tmp/psql-tablespace
sudo chown postgres.postgres /tmp/psql-tablespace
psql -c "CREATE TABLESPACE tablespacetest LOCATION '/tmp/psql-tablespace'" postgres
```

Once this is all set up, all the tests should run (no SKIPs), and pass
(no FAILs). If you encounter a failure, you can find more information
by looking in the `test-suite.log`. If you find something which seems
to be a bug, please check to see if it is a known issue at
https://github.com/openstreetmap/osm2pgsql/issues and, if it's not
already known, report it there.

## Contributing ##

We welcome contributions to osm2pgsql. If you would like to report an issue,
Expand Down
12 changes: 6 additions & 6 deletions UTF8sanitizer.c → UTF8sanitizer.cpp
Expand Up @@ -6,8 +6,8 @@
#include <zlib.h>
#include <bzlib.h>

#include "sanitizer.h"
#include "input.h"
#include "sanitizer.hpp"
#include "input.hpp"

int sanitizerClose(void *context);
int sanitizerProcess(void *context, char *buffer, int len);
Expand Down Expand Up @@ -38,13 +38,13 @@ struct Context {
int out_char[10];
int pend;
int verbose;
void *file;
Input *file;
};


int sanitizerClose(void *context)
{
struct Context *ctx = context;
struct Context *ctx = (struct Context *)context;
int r = inputClose(ctx->file);

if (ctx->verbose) {
Expand All @@ -64,7 +64,7 @@ int sanitizerClose(void *context)

xmlTextReaderPtr sanitizerOpen(const char *name)
{
struct Context *ctx = malloc (sizeof(*ctx));
struct Context *ctx = (struct Context *)malloc(sizeof(*ctx));

if (!ctx)
return NULL;
Expand All @@ -87,7 +87,7 @@ xmlTextReaderPtr sanitizerOpen(const char *name)

int sanitizerProcess(void *context, char *buffer, int len)
{
struct Context *ctx = context;
struct Context *ctx = (struct Context *)context;
int current_char, i, out = 0;

while (out < len) {
Expand Down
13 changes: 7 additions & 6 deletions binarysearcharray.c → binarysearcharray.cpp
Expand Up @@ -3,8 +3,8 @@
#include <unistd.h>
#include <string.h>

#include "osmtypes.h"
#include "binarysearcharray.h"
#include "osmtypes.hpp"
#include "binarysearcharray.hpp"

static int binary_search_lookup(struct binary_search_array * array, int key)
{
Expand Down Expand Up @@ -95,12 +95,13 @@ void binary_search_add(struct binary_search_array * array, int key,

struct binary_search_array * init_search_array(int capacity)
{
struct binary_search_array * array = calloc(1,
sizeof(struct binary_search_array));
array->array = calloc(capacity + 1, sizeof(struct key_val_tuple));
struct binary_search_array * array =
(struct binary_search_array *)
calloc(1, sizeof(struct binary_search_array));
array->array = (struct key_val_tuple *)calloc(capacity + 1, sizeof(struct key_val_tuple));
if (!array->array) {
fprintf(stderr, "Out of memory trying to allocate %li bytes for binary search array\n", ((capacity + 1) * sizeof(struct key_val_tuple)));
exit_nicely();
return NULL;
}
array->capacity = capacity;
array->size = 0;
Expand Down
File renamed without changes.