|
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,10 +61,6 @@ 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::release_relations() { m_rels.clear(); } |
68 | | - |
69 | | -void middle_ram_t::release_ways() { m_ways.clear(); } |
70 | | - |
71 | 64 | bool middle_ram_t::way_get(osmid_t id, osmium::memory::Buffer &buffer) const |
72 | 65 | { |
73 | 66 | auto const *ele = m_ways.get(id); |
@@ -117,46 +110,26 @@ bool middle_ram_t::relation_get(osmid_t id, |
117 | 110 | return true; |
118 | 111 | } |
119 | 112 |
|
120 | | -void middle_ram_t::analyze() |
121 | | -{ /* No need */ |
122 | | -} |
123 | | - |
124 | | -void middle_ram_t::start() {} |
125 | | - |
126 | 113 | void middle_ram_t::stop(osmium::thread::Pool &) |
127 | 114 | { |
128 | | - m_cache.reset(nullptr); |
129 | | - |
130 | | - release_ways(); |
131 | | - release_relations(); |
| 115 | + m_cache.reset(); |
| 116 | + m_ways.clear(); |
| 117 | + m_rels.clear(); |
132 | 118 | } |
133 | 119 |
|
134 | | -void middle_ram_t::commit() {} |
135 | | - |
136 | 120 | middle_ram_t::middle_ram_t(options_t const *options) |
137 | 121 | : m_ways(), m_rels(), |
138 | 122 | m_cache(new node_ram_cache{options->alloc_chunkwise, options->cache}), |
139 | 123 | m_extra_attributes(options->extra_attributes) |
140 | 124 | {} |
141 | 125 |
|
142 | | -middle_ram_t::~middle_ram_t() |
143 | | -{ |
144 | | - //instance.reset(); |
145 | | -} |
146 | | - |
147 | 126 | idlist_t middle_ram_t::relations_using_way(osmid_t) const |
148 | 127 | { |
149 | | - // this function shouldn't be called - relations_using_way is only used in |
150 | | - // slim mode, and a middle_ram_t shouldn't be constructed if the slim mode |
151 | | - // option is set. |
152 | | - throw std::runtime_error{ |
153 | | - "middle_ram_t::relations_using_way is unimplemented, and " |
154 | | - "should not have been called. This is probably a bug, please " |
155 | | - "report it at https://github.com/openstreetmap/osm2pgsql/issues"}; |
| 128 | + assert(false && "Should only be called in slim mode"); |
| 129 | + return {}; |
156 | 130 | } |
157 | 131 |
|
158 | | -std::shared_ptr<middle_query_t> |
159 | | -middle_ram_t::get_query_instance() |
| 132 | +std::shared_ptr<middle_query_t> middle_ram_t::get_query_instance() |
160 | 133 | { |
161 | 134 | return shared_from_this(); |
162 | 135 | } |
0 commit comments