Skip to content

Commit 4a8d39e

Browse files
committed
Remove enqueue_ways() function from outputs
The function now does the same in all outputs except that it does nothing in some outputs. The new member function need_forward_dependencies() now just returns true or false and then the code in osmdata.cpp can directly do what was in enqueue_ways() before.
1 parent 50f344c commit 4a8d39e

File tree

10 files changed

+9
-34
lines changed

10 files changed

+9
-34
lines changed

src/osmdata.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ struct pending_threaded_processor : public middle_t::pending_processor
244244
void enqueue_ways(osmid_t id) override
245245
{
246246
for (size_t i = 0; i < outs.size(); ++i) {
247-
outs[i]->enqueue_ways(queue, id, i, ids_queued);
247+
if (outs[i]->need_forward_dependencies()) {
248+
queue.emplace(id, i);
249+
++ids_queued;
250+
}
248251
}
249252
}
250253

src/output-flex.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,13 +1002,6 @@ void output_flex_t::call_process_function(int index,
10021002
}
10031003
}
10041004

1005-
void output_flex_t::enqueue_ways(pending_queue_t &job_queue, osmid_t id,
1006-
std::size_t output_id, std::size_t &added)
1007-
{
1008-
job_queue.emplace(id, output_id);
1009-
++added;
1010-
}
1011-
10121005
void output_flex_t::pending_way(osmid_t id, int exists)
10131006
{
10141007
if (!m_has_process_way) {

src/output-flex.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ class output_flex_t : public output_t
6161

6262
void stage2_proc() override;
6363

64-
void enqueue_ways(pending_queue_t &job_queue, osmid_t id,
65-
std::size_t output_id, std::size_t &added) override;
6664
void pending_way(osmid_t id, int exists) override;
6765

6866
void enqueue_relations(pending_queue_t &job_queue, osmid_t id,

src/output-gazetteer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class output_gazetteer_t : public output_t
4646
void stop(osmium::thread::Pool *) override {}
4747
void commit() override;
4848

49-
void enqueue_ways(pending_queue_t &, osmid_t, size_t, size_t &) override {}
49+
bool need_forward_dependencies() const noexcept override { return false; }
50+
5051
void pending_way(osmid_t, int) override {}
5152

5253
void enqueue_relations(pending_queue_t &, osmid_t, size_t,

src/output-multi.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ bool output_multi_t::has_pending() const
7070
return !rels_pending_tracker.empty();
7171
}
7272

73-
void output_multi_t::enqueue_ways(pending_queue_t &job_queue, osmid_t id,
74-
size_t output_id, size_t &added)
75-
{
76-
job_queue.emplace(id, output_id);
77-
++added;
78-
}
79-
8073
void output_multi_t::pending_way(osmid_t id, int exists)
8174
{
8275
// Try to fetch the way from the DB

src/output-multi.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class output_multi_t : public output_t
4646
void stop(osmium::thread::Pool *pool) override;
4747
void commit() override;
4848

49-
void enqueue_ways(pending_queue_t &job_queue, osmid_t id, size_t output_id,
50-
size_t &added) override;
5149
void pending_way(osmid_t id, int exists) override;
5250

5351
void enqueue_relations(pending_queue_t &job_queue, osmid_t id,

src/output-null.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ class output_null_t : public output_t
2222
void commit() override {}
2323
void cleanup() {}
2424

25-
void enqueue_ways(pending_queue_t & /*job_queue*/, osmid_t /*id*/, size_t /*output_id*/,
26-
size_t & /*added*/) override
27-
{}
25+
bool need_forward_dependencies() const noexcept override { return false; }
2826

2927
void pending_way(osmid_t /*id*/, int /*exists*/) override {}
3028

src/output-pgsql.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ void output_pgsql_t::pgsql_out_way(osmium::Way const &way, taglist_t *tags,
6666
}
6767
}
6868

69-
void output_pgsql_t::enqueue_ways(pending_queue_t &job_queue, osmid_t id,
70-
size_t output_id, size_t &added)
71-
{
72-
job_queue.emplace(id, output_id);
73-
++added;
74-
}
75-
7669
void output_pgsql_t::pending_way(osmid_t id, int exists)
7770
{
7871
// Try to fetch the way from the DB

src/output-pgsql.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class output_pgsql_t : public output_t
4646
void stop(osmium::thread::Pool *pool) override;
4747
void commit() override;
4848

49-
void enqueue_ways(pending_queue_t &job_queue, osmid_t id, size_t output_id,
50-
size_t &added) override;
5149
void pending_way(osmid_t id, int exists) override;
5250

5351
void enqueue_relations(pending_queue_t &job_queue, osmid_t id,

src/output.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class output_t
5353

5454
virtual void stage2_proc() {}
5555

56-
virtual void enqueue_ways(pending_queue_t &job_queue, osmid_t id,
57-
size_t output_id, size_t &added) = 0;
56+
virtual bool need_forward_dependencies() const noexcept { return true; }
57+
5858
virtual void pending_way(osmid_t id, int exists) = 0;
5959

6060
virtual void enqueue_relations(pending_queue_t &job_queue, osmid_t id,

0 commit comments

Comments
 (0)