|
7 | 7 | * emit the final geometry-enabled output formats |
8 | 8 | */ |
9 | 9 |
|
10 | | -#include <stdexcept> |
11 | | - |
12 | 10 | #include <cassert> |
13 | | -#include <cstdio> |
| 11 | +#include <memory> |
14 | 12 |
|
15 | 13 | #include <osmium/builder/attr.hpp> |
16 | 14 |
|
17 | | -#include "id-tracker.hpp" |
18 | 15 | #include "middle-ram.hpp" |
19 | 16 | #include "node-ram-cache.hpp" |
20 | 17 | #include "options.hpp" |
@@ -64,38 +61,8 @@ size_t middle_ram_t::nodes_get_list(osmium::WayNodeList *nodes) const |
64 | 61 | return count; |
65 | 62 | } |
66 | 63 |
|
67 | | -void middle_ram_t::iterate_relations(pending_processor &pf) |
68 | | -{ |
69 | | - //TODO: just dont do anything |
70 | | - |
71 | | - //let the outputs enqueue everything they have the non slim middle |
72 | | - //has nothing of its own to enqueue as it doesnt have pending anything |
73 | | - pf.enqueue_relations(id_tracker::max()); |
74 | | - |
75 | | - //let the threads process the relations |
76 | | - pf.process_relations(); |
77 | | -} |
78 | | - |
79 | | -void middle_ram_t::iterate_ways(middle_t::pending_processor &pf) |
80 | | -{ |
81 | | - //let the outputs enqueue everything they have the non slim middle |
82 | | - //has nothing of its own to enqueue as it doesnt have pending anything |
83 | | - pf.enqueue_ways(id_tracker::max()); |
84 | | - |
85 | | - //let the threads process the ways |
86 | | - pf.process_ways(); |
87 | | -} |
88 | | - |
89 | | -void middle_ram_t::release_relations() { m_rels.clear(); } |
90 | | - |
91 | | -void middle_ram_t::release_ways() { m_ways.clear(); } |
92 | | - |
93 | 64 | bool middle_ram_t::way_get(osmid_t id, osmium::memory::Buffer &buffer) const |
94 | 65 | { |
95 | | - if (m_simulate_ways_deleted) { |
96 | | - return false; |
97 | | - } |
98 | | - |
99 | 66 | auto const *ele = m_ways.get(id); |
100 | 67 |
|
101 | 68 | if (!ele) { |
@@ -143,46 +110,26 @@ bool middle_ram_t::relation_get(osmid_t id, |
143 | 110 | return true; |
144 | 111 | } |
145 | 112 |
|
146 | | -void middle_ram_t::analyze() |
147 | | -{ /* No need */ |
148 | | -} |
149 | | - |
150 | | -void middle_ram_t::start() {} |
151 | | - |
152 | 113 | void middle_ram_t::stop(osmium::thread::Pool &) |
153 | 114 | { |
154 | | - m_cache.reset(nullptr); |
155 | | - |
156 | | - release_ways(); |
157 | | - release_relations(); |
| 115 | + m_cache.reset(); |
| 116 | + m_ways.clear(); |
| 117 | + m_rels.clear(); |
158 | 118 | } |
159 | 119 |
|
160 | | -void middle_ram_t::commit() {} |
161 | | - |
162 | 120 | middle_ram_t::middle_ram_t(options_t const *options) |
163 | 121 | : m_ways(), m_rels(), |
164 | 122 | m_cache(new node_ram_cache{options->alloc_chunkwise, options->cache}), |
165 | | - m_extra_attributes(options->extra_attributes), m_simulate_ways_deleted(false) |
| 123 | + m_extra_attributes(options->extra_attributes) |
166 | 124 | {} |
167 | 125 |
|
168 | | -middle_ram_t::~middle_ram_t() |
169 | | -{ |
170 | | - //instance.reset(); |
171 | | -} |
172 | | - |
173 | 126 | idlist_t middle_ram_t::relations_using_way(osmid_t) const |
174 | 127 | { |
175 | | - // this function shouldn't be called - relations_using_way is only used in |
176 | | - // slim mode, and a middle_ram_t shouldn't be constructed if the slim mode |
177 | | - // option is set. |
178 | | - throw std::runtime_error{ |
179 | | - "middle_ram_t::relations_using_way is unimplemented, and " |
180 | | - "should not have been called. This is probably a bug, please " |
181 | | - "report it at https://github.com/openstreetmap/osm2pgsql/issues"}; |
| 128 | + assert(false && "Should only be called in slim mode"); |
| 129 | + return {}; |
182 | 130 | } |
183 | 131 |
|
184 | | -std::shared_ptr<middle_query_t> |
185 | | -middle_ram_t::get_query_instance() |
| 132 | +std::shared_ptr<middle_query_t> middle_ram_t::get_query_instance() |
186 | 133 | { |
187 | 134 | return shared_from_this(); |
188 | 135 | } |
0 commit comments