1313#include " db-copy.hpp"
1414#include " format.hpp"
1515#include " middle.hpp"
16+ #include " options.hpp"
1617#include " osmdata.hpp"
1718#include " output.hpp"
1819#include " util.hpp"
1920
2021osmdata_t ::osmdata_t (std::unique_ptr<dependency_manager_t > dependency_manager,
2122 std::shared_ptr<middle_t > mid,
22- std::vector<std::shared_ptr<output_t >> outs)
23+ std::vector<std::shared_ptr<output_t >> outs,
24+ options_t const &options)
2325: m_dependency_manager(std::move(dependency_manager)), m_mid(std::move(mid)),
24- m_outs (std::move(outs))
26+ m_outs (std::move(outs)), m_conninfo(options.database_options.conninfo()),
27+ m_num_procs(options.num_procs), m_append(options.append),
28+ m_droptemp(options.droptemp), m_parallel_indexing(options.parallel_indexing),
29+ m_with_extra_attrs(options.extra_attributes)
2530{
2631 assert (m_dependency_manager);
2732 assert (m_mid);
2833 assert (!m_outs.empty ());
29-
30- // Get the "extra_attributes" option from the first output. We expect
31- // all others to be the same.
32- m_with_extra_attrs = m_outs[0 ]->get_options ()->extra_attributes ;
3334}
3435
3536/* *
@@ -377,14 +378,11 @@ void osmdata_t::stop() const
377378 out->sync ();
378379 }
379380
380- // should be the same for all outputs
381- auto const *opts = m_outs[0 ]->get_options ();
382-
383381 // In append mode there might be dependent objects pending that we
384382 // need to process.
385- if (opts-> append && m_dependency_manager->has_pending ()) {
386- multithreaded_processor proc{opts-> database_options . conninfo () , m_mid,
387- m_outs, (std::size_t )opts-> num_procs };
383+ if (m_append && m_dependency_manager->has_pending ()) {
384+ multithreaded_processor proc{m_conninfo , m_mid, m_outs ,
385+ (std::size_t )m_num_procs };
388386
389387 proc.process_ways (m_dependency_manager->get_pending_way_ids ());
390388 proc.process_relations (
@@ -399,10 +397,9 @@ void osmdata_t::stop() const
399397 // Clustering, index creation, and cleanup.
400398 // All the intensive parts of this are long-running PostgreSQL commands
401399 {
402- osmium::thread::Pool pool{opts->parallel_indexing ? opts->num_procs : 1 ,
403- 512 };
400+ osmium::thread::Pool pool{m_parallel_indexing ? m_num_procs : 1 , 512 };
404401
405- if (opts-> droptemp ) {
402+ if (m_droptemp ) {
406403 // When dropping middle tables, make sure they are gone before
407404 // indexing starts.
408405 m_mid->stop (pool);
@@ -412,7 +409,7 @@ void osmdata_t::stop() const
412409 out->stop (&pool);
413410 }
414411
415- if (!opts-> droptemp ) {
412+ if (!m_droptemp ) {
416413 // When keeping middle tables, there is quite a large index created
417414 // which is better done after the output tables have been copied.
418415 // Note that --disable-parallel-indexing needs to be used to really
0 commit comments