diff options
-rw-r--r-- | gr-blocks/lib/annotator_1to1_impl.cc | 6 | ||||
-rw-r--r-- | gr-blocks/lib/annotator_alltoall_impl.cc | 6 | ||||
-rw-r--r-- | gr-blocks/lib/file_meta_sink_impl.cc | 9 | ||||
-rw-r--r-- | gr-blocks/lib/keep_one_in_n_impl.cc | 5 | ||||
-rw-r--r-- | gr-blocks/lib/multiply_by_tag_value_cc_impl.cc | 10 | ||||
-rw-r--r-- | gr-blocks/lib/skiphead_impl.cc | 7 | ||||
-rw-r--r-- | gr-blocks/lib/tag_debug_impl.cc | 12 | ||||
-rw-r--r-- | gr-blocks/lib/tag_debug_impl.h | 1 | ||||
-rw-r--r-- | gr-blocks/lib/tagged_stream_to_pdu_impl.cc | 4 | ||||
-rw-r--r-- | gr-blocks/lib/tagged_stream_to_pdu_impl.h | 1 | ||||
-rw-r--r-- | gr-blocks/lib/test_tag_variable_rate_ff_impl.cc | 5 | ||||
-rw-r--r-- | gr-blocks/lib/throttle_impl.cc | 7 | ||||
-rw-r--r-- | gr-digital/lib/burst_shaper_impl.cc | 11 | ||||
-rw-r--r-- | gr-digital/lib/pfb_clock_sync_ccf_impl.cc | 5 | ||||
-rw-r--r-- | gr-fec/lib/fec_mtrx_impl.cc | 9 |
15 files changed, 38 insertions, 60 deletions
diff --git a/gr-blocks/lib/annotator_1to1_impl.cc b/gr-blocks/lib/annotator_1to1_impl.cc index 7b8693f45d..6975f4f30b 100644 --- a/gr-blocks/lib/annotator_1to1_impl.cc +++ b/gr-blocks/lib/annotator_1to1_impl.cc @@ -69,11 +69,7 @@ int annotator_1to1_impl::work(int noutput_items, std::vector<tag_t> all_tags; get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items); - - std::vector<tag_t>::iterator itr; - for (itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); - } + d_stored_tags.insert(d_stored_tags.end(), all_tags.begin(), all_tags.end()); } // Storing the current noutput_items as the value to the "noutput_items" key diff --git a/gr-blocks/lib/annotator_alltoall_impl.cc b/gr-blocks/lib/annotator_alltoall_impl.cc index 7bb5723450..c257c0cb9f 100644 --- a/gr-blocks/lib/annotator_alltoall_impl.cc +++ b/gr-blocks/lib/annotator_alltoall_impl.cc @@ -70,11 +70,7 @@ int annotator_alltoall_impl::work(int noutput_items, std::vector<tag_t> all_tags; get_tags_in_range(all_tags, i, abs_N, end_N); - - std::vector<tag_t>::iterator itr; - for (itr = all_tags.begin(); itr != all_tags.end(); itr++) { - d_stored_tags.push_back(*itr); - } + d_stored_tags.insert(d_stored_tags.end(), all_tags.begin(), all_tags.end()); } // Source ID and key for any tag that might get applied from this block diff --git a/gr-blocks/lib/file_meta_sink_impl.cc b/gr-blocks/lib/file_meta_sink_impl.cc index ed75f135c9..e3ce72db97 100644 --- a/gr-blocks/lib/file_meta_sink_impl.cc +++ b/gr-blocks/lib/file_meta_sink_impl.cc @@ -391,9 +391,8 @@ int file_meta_sink_impl::work(int noutput_items, std::vector<tag_t> all_tags; get_tags_in_range(all_tags, 0, abs_N, end_N); - std::vector<tag_t>::iterator itr; - for (itr = all_tags.begin(); itr != all_tags.end(); itr++) { - int item_offset = (int)(itr->offset - abs_N); + for (const auto& tag : all_tags) { + int item_offset = (int)(tag.offset - abs_N); // Write date to file up to the next tag location while (nwritten < item_offset) { @@ -419,11 +418,11 @@ int file_meta_sink_impl::work(int noutput_items, if (d_total_seg_size > 0) { update_last_header(); - update_header(itr->key, itr->value); + update_header(tag.key, tag.value); write_and_update(); d_total_seg_size = 0; } else { - update_header(itr->key, itr->value); + update_header(tag.key, tag.value); update_last_header(); } } diff --git a/gr-blocks/lib/keep_one_in_n_impl.cc b/gr-blocks/lib/keep_one_in_n_impl.cc index 5c7e4b3a12..3dfe3c3ca5 100644 --- a/gr-blocks/lib/keep_one_in_n_impl.cc +++ b/gr-blocks/lib/keep_one_in_n_impl.cc @@ -92,10 +92,9 @@ int keep_one_in_n_impl::general_work(int noutput_items, // Because we have set TPP_DONT, we have to propagate the tags here manually. // Adjustment of the tag sample value is done using the float d_decim_rate. std::vector<tag_t> tags; - std::vector<tag_t>::iterator t; get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + ni); - for (t = tags.begin(); t != tags.end(); t++) { - tag_t new_tag = *t; + for (const auto& tag : tags) { + tag_t new_tag = tag; new_tag.offset *= d_decim_rate; add_item_tag(0, new_tag); } diff --git a/gr-blocks/lib/multiply_by_tag_value_cc_impl.cc b/gr-blocks/lib/multiply_by_tag_value_cc_impl.cc index 9907106bc5..785cb87a59 100644 --- a/gr-blocks/lib/multiply_by_tag_value_cc_impl.cc +++ b/gr-blocks/lib/multiply_by_tag_value_cc_impl.cc @@ -65,11 +65,9 @@ int multiply_by_tag_value_cc_impl::work(int noutput_items, std::vector<tag_t> tags; get_tags_in_window(tags, 0, 0, noutput_items, d_tag_key); - std::vector<tag_t>::iterator itag = tags.begin(); - int start = 0, end; - while (itag != tags.end()) { - end = itag->offset - nitems_read(0); + for (const auto& tag : tags) { + end = tag.offset - nitems_read(0); end *= d_vlen; // Multiply based on the current value of k from 'start' to 'end' @@ -77,7 +75,7 @@ int multiply_by_tag_value_cc_impl::work(int noutput_items, start = end; // Extract new value of k - pmt::pmt_t k = itag->value; + pmt::pmt_t k = tag.value; if (pmt::is_complex(k)) { d_k = pmt::to_complex(k); } else if (pmt::is_number(k)) { @@ -87,8 +85,6 @@ int multiply_by_tag_value_cc_impl::work(int noutput_items, boost::format("Got key '%1%' with incompatible value of '%2%'") % pmt::write_string(d_tag_key) % pmt::write_string(k)); } - - itag++; } volk_32fc_s32fc_multiply_32fc( diff --git a/gr-blocks/lib/skiphead_impl.cc b/gr-blocks/lib/skiphead_impl.cc index ed6082c2d3..6a34b7b5a7 100644 --- a/gr-blocks/lib/skiphead_impl.cc +++ b/gr-blocks/lib/skiphead_impl.cc @@ -76,10 +76,9 @@ int skiphead_impl::general_work(int noutput_items, else { // nothing left to skip. copy away // Grab all tags in the window and shift their offsets appropriately get_tags_in_window(d_tags, 0, ii, ninput_items); - for (std::vector<tag_t>::iterator it = d_tags.begin(); it != d_tags.end(); - it++) { - (*it).offset -= d_nitems_to_skip; - add_item_tag(0, *it); + for (auto& tag : d_tags) { + tag.offset -= d_nitems_to_skip; + add_item_tag(0, tag); } int n_to_copy = ninput_items - ii; if (n_to_copy > 0) { diff --git a/gr-blocks/lib/tag_debug_impl.cc b/gr-blocks/lib/tag_debug_impl.cc index 82a06354e8..f6550e0ba3 100644 --- a/gr-blocks/lib/tag_debug_impl.cc +++ b/gr-blocks/lib/tag_debug_impl.cc @@ -111,15 +111,15 @@ int tag_debug_impl::work(int noutput_items, if (d_display) { sout << "Input Stream: " << std::setw(2) << std::setfill('0') << i << std::setfill(' ') << std::endl; - for (d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++) { - sout << std::setw(10) << "Offset: " << d_tags_itr->offset << std::setw(10) + for (const auto& tag : d_tags) { + sout << std::setw(10) << "Offset: " << tag.offset << std::setw(10) << "Source: " - << (pmt::is_symbol(d_tags_itr->srcid) - ? pmt::symbol_to_string(d_tags_itr->srcid) + << (pmt::is_symbol(tag.srcid) + ? pmt::symbol_to_string(tag.srcid) : "n/a") - << std::setw(10) << "Key: " << pmt::symbol_to_string(d_tags_itr->key) + << std::setw(10) << "Key: " << pmt::symbol_to_string(tag.key) << std::setw(10) << "Value: "; - sout << d_tags_itr->value << std::endl; + sout << tag.value << std::endl; } } } diff --git a/gr-blocks/lib/tag_debug_impl.h b/gr-blocks/lib/tag_debug_impl.h index 6546b4ad4a..dfe9486a7d 100644 --- a/gr-blocks/lib/tag_debug_impl.h +++ b/gr-blocks/lib/tag_debug_impl.h @@ -35,7 +35,6 @@ class tag_debug_impl : public tag_debug private: const std::string d_name; std::vector<tag_t> d_tags; - std::vector<tag_t>::iterator d_tags_itr; bool d_display; pmt::pmt_t d_filter; gr::thread::mutex d_mutex; diff --git a/gr-blocks/lib/tagged_stream_to_pdu_impl.cc b/gr-blocks/lib/tagged_stream_to_pdu_impl.cc index 6411ad0c41..d5050614a4 100644 --- a/gr-blocks/lib/tagged_stream_to_pdu_impl.cc +++ b/gr-blocks/lib/tagged_stream_to_pdu_impl.cc @@ -60,8 +60,8 @@ int tagged_stream_to_pdu_impl::work(int noutput_items, // Grab tags, throw them into dict get_tags_in_range(d_tags, 0, nitems_read(0), nitems_read(0) + ninput_items[0]); d_pdu_meta = pmt::make_dict(); - for (d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++) { - d_pdu_meta = dict_add(d_pdu_meta, (*d_tags_itr).key, (*d_tags_itr).value); + for (const auto& tag : d_tags) { + d_pdu_meta = dict_add(d_pdu_meta, tag.key, tag.value); } // Grab data, throw into vector diff --git a/gr-blocks/lib/tagged_stream_to_pdu_impl.h b/gr-blocks/lib/tagged_stream_to_pdu_impl.h index a6fbdc7fab..26fc36ea0b 100644 --- a/gr-blocks/lib/tagged_stream_to_pdu_impl.h +++ b/gr-blocks/lib/tagged_stream_to_pdu_impl.h @@ -33,7 +33,6 @@ class BLOCKS_API tagged_stream_to_pdu_impl : public tagged_stream_to_pdu const pdu::vector_type d_type; pmt::pmt_t d_pdu_meta; pmt::pmt_t d_pdu_vector; - std::vector<tag_t>::iterator d_tags_itr; std::vector<tag_t> d_tags; public: diff --git a/gr-blocks/lib/test_tag_variable_rate_ff_impl.cc b/gr-blocks/lib/test_tag_variable_rate_ff_impl.cc index 580bf0d19f..7ffaa2e09b 100644 --- a/gr-blocks/lib/test_tag_variable_rate_ff_impl.cc +++ b/gr-blocks/lib/test_tag_variable_rate_ff_impl.cc @@ -89,7 +89,6 @@ int test_tag_variable_rate_ff_impl::general_work(int noutput_items, } std::vector<tag_t> tags; - std::vector<tag_t>::iterator itags; int i = 0, j = 0; while (i < ninput_items[0]) { @@ -111,8 +110,8 @@ int test_tag_variable_rate_ff_impl::general_work(int noutput_items, // Manage Tags d_new_in = nitems_read(0) + i; get_tags_in_range(tags, 0, d_old_in, d_new_in); - for (itags = tags.begin(); itags != tags.end(); itags++) { - tag_t new_tag = *itags; + for (const auto& tag : tags) { + tag_t new_tag = tag; new_tag.offset = d_last_out; add_item_tag(0, new_tag); } diff --git a/gr-blocks/lib/throttle_impl.cc b/gr-blocks/lib/throttle_impl.cc index abc7a512d1..7b2cc7fd67 100644 --- a/gr-blocks/lib/throttle_impl.cc +++ b/gr-blocks/lib/throttle_impl.cc @@ -80,10 +80,9 @@ int throttle_impl::work(int noutput_items, uint64_t abs_N = nitems_read(0); std::vector<tag_t> all_tags; get_tags_in_range(all_tags, 0, abs_N, abs_N + noutput_items); - std::vector<tag_t>::iterator itr; - for (itr = all_tags.begin(); itr != all_tags.end(); itr++) { - if (pmt::eq((*itr).key, throttle_rx_rate_pmt)) { - double new_rate = pmt::to_double((*itr).value); + for (const auto& tag : all_tags) { + if (pmt::eq(tag.key, throttle_rx_rate_pmt)) { + double new_rate = pmt::to_double(tag.value); set_sample_rate(new_rate); } } diff --git a/gr-digital/lib/burst_shaper_impl.cc b/gr-digital/lib/burst_shaper_impl.cc index 98456264a2..d4fb7310dc 100644 --- a/gr-digital/lib/burst_shaper_impl.cc +++ b/gr-digital/lib/burst_shaper_impl.cc @@ -324,16 +324,15 @@ void burst_shaper_impl<T>::propagate_tags(int in_offset, tag_t temp_tag; std::vector<tag_t> tags; - std::vector<tag_t>::iterator it; this->get_tags_in_range(tags, 0, abs_start, abs_end); - for (it = tags.begin(); it != tags.end(); it++) { - if (!pmt::equal(it->key, d_length_tag_key)) { - if (skip && (it->offset == d_length_tag_offset)) + for (const auto& tag : tags) { + if (!pmt::equal(tag.key, d_length_tag_key)) { + if (skip && (tag.offset == d_length_tag_offset)) continue; - temp_tag = *it; - temp_tag.offset = abs_offset + it->offset - abs_start; + temp_tag = tag; + temp_tag.offset = abs_offset + tag.offset - abs_start; this->add_item_tag(0, temp_tag); } } diff --git a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc index 851a593bea..103fac6850 100644 --- a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc +++ b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc @@ -416,11 +416,10 @@ int pfb_clock_sync_ccf_impl::general_work(int noutput_items, // Manage Tags std::vector<tag_t> xtags; - std::vector<tag_t>::iterator itags; d_new_in = nitems_read(0) + count + d_out_idx + d_sps; get_tags_in_range(xtags, 0, d_old_in, d_new_in); - for (itags = xtags.begin(); itags != xtags.end(); itags++) { - tag_t new_tag = *itags; + for (const auto& tag : xtags) { + tag_t new_tag = tag; // new_tag.offset = d_last_out + d_taps_per_filter/(2*d_sps) - 2; new_tag.offset = d_last_out + d_taps_per_filter / 4 - 2; add_item_tag(0, new_tag); diff --git a/gr-fec/lib/fec_mtrx_impl.cc b/gr-fec/lib/fec_mtrx_impl.cc index 10ed5f4f3f..302928665f 100644 --- a/gr-fec/lib/fec_mtrx_impl.cc +++ b/gr-fec/lib/fec_mtrx_impl.cc @@ -141,14 +141,13 @@ void write_matrix_to_file(const std::string filename, matrix_sptr M) outputfile << (*std::max_element(colweights.begin(), colweights.end())) << " " << (*std::max_element(rowweights.begin(), rowweights.end())) << std::endl; - std::vector<unsigned int>::iterator itr; - for (itr = colweights.begin(); itr != colweights.end(); itr++) { - outputfile << (*itr) << " "; + for (const auto& weight : colweights) { + outputfile << weight << " "; } outputfile << std::endl; - for (itr = rowweights.begin(); itr != rowweights.end(); itr++) { - outputfile << (*itr) << " "; + for (const auto& weight : rowweights) { + outputfile << weight << " "; } outputfile << std::endl; |