File tree Expand file tree Collapse file tree 8 files changed +24
-14
lines changed
Expand file tree Collapse file tree 8 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -1004,10 +1004,20 @@ void middle_pgsql_t::commit()
10041004 }
10051005}
10061006
1007- void middle_pgsql_t::flush ()
1007+ void middle_pgsql_t::flush (osmium::item_type new_type )
10081008{
1009- for (auto &table : tables) {
1010- table.end_copy ();
1009+ switch (new_type)
1010+ {
1011+ case osmium::item_type::way:
1012+ tables[NODE_TABLE].end_copy ();
1013+ break ;
1014+ case osmium::item_type::relation:
1015+ tables[NODE_TABLE].end_copy ();
1016+ tables[WAY_TABLE].end_copy ();
1017+ break ;
1018+ default :
1019+ // nothing needed
1020+ break ;
10111021 }
10121022}
10131023
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ struct middle_pgsql_t : public slim_middle_t {
4343 void relations_delete (osmid_t id) override ;
4444 void relation_changed (osmid_t id) override ;
4545
46- void flush () override ;
46+ void flush (osmium::item_type new_type ) override ;
4747
4848 void iterate_ways (middle_t ::pending_processor& pf) override ;
4949 void iterate_relations (pending_processor& pf) override ;
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ struct middle_ram_t : public middle_t {
107107 int relations_delete (osmid_t id);
108108 int relation_changed (osmid_t id);
109109
110- void flush () override {}
110+ void flush (osmium::item_type ) override {}
111111
112112 idlist_t relations_using_way (osmid_t way_id) const override ;
113113
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ struct middle_t : public middle_query_t {
9393 virtual void relations_set (osmium::Relation const &rel) = 0;
9494
9595 // / Write all pending data to permanent storage.
96- virtual void flush () = 0;
96+ virtual void flush (osmium::item_type new_type ) = 0;
9797
9898 struct pending_processor {
9999 virtual ~pending_processor () {}
Original file line number Diff line number Diff line change @@ -180,9 +180,9 @@ void osmdata_t::start() {
180180 mid->start (outs[0 ]->get_options ());
181181}
182182
183- void osmdata_t::type_changed ()
183+ void osmdata_t::type_changed (osmium::item_type new_type )
184184{
185- mid->flush ();
185+ mid->flush (new_type );
186186}
187187
188188namespace {
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class osmdata_t
2626 ~osmdata_t ();
2727
2828 void start ();
29- void type_changed ();
29+ void type_changed (osmium::item_type new_type );
3030 void stop ();
3131
3232 int node_add (osmium::Node const &node);
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ void parse_osmium_t::node(osmium::Node const &node)
134134{
135135 if (m_type != osmium::item_type::node) {
136136 m_type = osmium::item_type::node;
137- m_data->type_changed ();
137+ m_data->type_changed (osmium::item_type::node );
138138 }
139139
140140 if (node.deleted ()) {
@@ -167,7 +167,7 @@ void parse_osmium_t::way(osmium::Way& way)
167167{
168168 if (m_type != osmium::item_type::way) {
169169 m_type = osmium::item_type::way;
170- m_data->type_changed ();
170+ m_data->type_changed (osmium::item_type::way );
171171 }
172172
173173 if (way.deleted ()) {
@@ -186,7 +186,7 @@ void parse_osmium_t::relation(osmium::Relation const &rel)
186186{
187187 if (m_type != osmium::item_type::relation) {
188188 m_type = osmium::item_type::relation;
189- m_data->type_changed ();
189+ m_data->type_changed (osmium::item_type::relation );
190190 }
191191
192192 if (rel.deleted ()) {
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ struct dummy_middle_t : public middle_t {
99
1010 void start (const options_t *) override { }
1111 void stop (osmium::thread::Pool &) override {}
12- void flush () override {}
12+ void flush (osmium::item_type ) override {}
1313 void cleanup (void ) { }
1414 void analyze (void ) override { }
1515 void commit (void ) override { }
@@ -47,7 +47,7 @@ struct dummy_slim_middle_t : public slim_middle_t {
4747
4848 void start (const options_t *) override { }
4949 void stop (osmium::thread::Pool &) override {}
50- void flush () override {}
50+ void flush (osmium::item_type ) override {}
5151 void cleanup (void ) { }
5252 void analyze (void ) override { }
5353 void commit (void ) override { }
You can’t perform that action at this time.
0 commit comments