3
3
#include " middle.hpp"
4
4
#include " node-ram-cache.hpp"
5
5
6
- #include < boost/foreach.hpp>
7
6
#include < boost/thread/thread.hpp>
8
7
#include < boost/unordered_map.hpp>
9
8
#include < boost/thread.hpp>
@@ -38,7 +37,7 @@ int osmdata_t::node_add(osmid_t id, double lat, double lon, const taglist_t &tag
38
37
ramNode n (lon, lat);
39
38
40
39
int status = 0 ;
41
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
40
+ for ( auto & out: outs) {
42
41
status |= out->node_add (id, n.lat (), n.lon (), tags);
43
42
}
44
43
return status;
@@ -48,7 +47,7 @@ int osmdata_t::way_add(osmid_t id, const idlist_t &nodes, const taglist_t &tags)
48
47
mid->ways_set (id, nodes, tags);
49
48
50
49
int status = 0 ;
51
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
50
+ for ( auto & out: outs) {
52
51
status |= out->way_add (id, nodes, tags);
53
52
}
54
53
return status;
@@ -58,7 +57,7 @@ int osmdata_t::relation_add(osmid_t id, const memberlist_t &members, const tagli
58
57
mid->relations_set (id, members, tags);
59
58
60
59
int status = 0 ;
61
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
60
+ for ( auto & out: outs) {
62
61
status |= out->relation_add (id, members, tags);
63
62
}
64
63
return status;
@@ -74,7 +73,7 @@ int osmdata_t::node_modify(osmid_t id, double lat, double lon, const taglist_t &
74
73
ramNode n (lon, lat);
75
74
76
75
int status = 0 ;
77
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
76
+ for ( auto & out: outs) {
78
77
status |= out->node_modify (id, n.lat (), n.lon (), tags);
79
78
}
80
79
@@ -90,7 +89,7 @@ int osmdata_t::way_modify(osmid_t id, const idlist_t &nodes, const taglist_t &ta
90
89
slim->ways_set (id, nodes, tags);
91
90
92
91
int status = 0 ;
93
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
92
+ for ( auto & out: outs) {
94
93
status |= out->way_modify (id, nodes, tags);
95
94
}
96
95
@@ -106,7 +105,7 @@ int osmdata_t::relation_modify(osmid_t id, const memberlist_t &members, const ta
106
105
slim->relations_set (id, members, tags);
107
106
108
107
int status = 0 ;
109
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
108
+ for ( auto & out: outs) {
110
109
status |= out->relation_modify (id, members, tags);
111
110
}
112
111
@@ -119,7 +118,7 @@ int osmdata_t::node_delete(osmid_t id) {
119
118
slim_middle_t *slim = dynamic_cast <slim_middle_t *>(mid.get ());
120
119
121
120
int status = 0 ;
122
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
121
+ for ( auto & out: outs) {
123
122
status |= out->node_delete (id);
124
123
}
125
124
@@ -132,7 +131,7 @@ int osmdata_t::way_delete(osmid_t id) {
132
131
slim_middle_t *slim = dynamic_cast <slim_middle_t *>(mid.get ());
133
132
134
133
int status = 0 ;
135
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
134
+ for ( auto & out: outs) {
136
135
status |= out->way_delete (id);
137
136
}
138
137
@@ -145,7 +144,7 @@ int osmdata_t::relation_delete(osmid_t id) {
145
144
slim_middle_t *slim = dynamic_cast <slim_middle_t *>(mid.get ());
146
145
147
146
int status = 0 ;
148
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
147
+ for ( auto & out: outs) {
149
148
status |= out->relation_delete (id);
150
149
}
151
150
@@ -155,7 +154,7 @@ int osmdata_t::relation_delete(osmid_t id) {
155
154
}
156
155
157
156
void osmdata_t::start () {
158
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
157
+ for ( auto & out: outs) {
159
158
out->start ();
160
159
}
161
160
mid->start (outs[0 ]->get_options ());
@@ -213,7 +212,7 @@ struct pending_threaded_processor : public middle_t::pending_processor {
213
212
214
213
// clone the outs
215
214
output_vec_t out_clones;
216
- BOOST_FOREACH (const std::shared_ptr< output_t > & out, outs) {
215
+ for (const auto & out: outs) {
217
216
out_clones.push_back (out->clone (mid_clone.get ()));
218
217
}
219
218
@@ -261,7 +260,7 @@ struct pending_threaded_processor : public middle_t::pending_processor {
261
260
262
261
// collect all the new rels that became pending from each
263
262
// output in each thread back to their respective main outputs
264
- BOOST_FOREACH (const clone_t & clone, clones) {
263
+ for (const auto & clone: clones) {
265
264
// for each clone/original output
266
265
for (output_vec_t ::const_iterator original_output = outs.begin (), clone_output = clone.second .begin ();
267
266
original_output != outs.end () && clone_output != clone.second .end (); ++original_output, ++clone_output) {
@@ -307,7 +306,7 @@ struct pending_threaded_processor : public middle_t::pending_processor {
307
306
ids_done = 0 ;
308
307
309
308
// collect all expiry tree informations together into one
310
- BOOST_FOREACH (const clone_t & clone, clones) {
309
+ for (const auto & clone: clones) {
311
310
// for each clone/original output
312
311
for (output_vec_t ::const_iterator original_output = outs.begin (), clone_output = clone.second .begin ();
313
312
original_output != outs.end () && clone_output != clone.second .end (); ++original_output, ++clone_output) {
@@ -347,7 +346,7 @@ void osmdata_t::stop() {
347
346
*/
348
347
size_t pending_count = mid->pending_count ();
349
348
mid->commit ();
350
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
349
+ for ( auto & out: outs) {
351
350
// TODO: each of the outs can be in parallel
352
351
out->commit ();
353
352
pending_count += out->pending_count ();
@@ -374,7 +373,7 @@ void osmdata_t::stop() {
374
373
// Clustering, index creation, and cleanup.
375
374
// All the intensive parts of this are long-running PostgreSQL commands
376
375
boost::thread_group threads;
377
- BOOST_FOREACH (std::shared_ptr< output_t > & out, outs) {
376
+ for ( auto & out: outs) {
378
377
threads.add_thread (new boost::thread (boost::bind ( &output_t ::stop, out.get () )));
379
378
}
380
379
threads.add_thread (new boost::thread (boost::bind ( &middle_t ::stop, mid.get () )));
0 commit comments