]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decoderstack.cpp
Replaced lengthy iterator types with the auto keyword
[pulseview.git] / pv / data / decoderstack.cpp
index 9a13769ccf2a32ffbec850b88cf1225b5718a7bc..f82d3ecc1ef82f32dbfbee4f460d5af588a2fd1c 100644 (file)
@@ -106,7 +106,7 @@ void DecoderStack::remove(int index)
        assert(index < (int)_stack.size());
 
        // Find the decoder in the stack
-       list< shared_ptr<Decoder> >::iterator iter = _stack.begin();
+       auto iter = _stack.begin();
        for(int i = 0; i < index; i++, iter++)
                assert(iter != _stack.end());
 
@@ -159,8 +159,7 @@ void DecoderStack::get_annotation_subset(
 {
        lock_guard<mutex> lock(_output_mutex);
 
-       std::map<const Row, decode::RowData>::const_iterator iter =
-               _rows.find(row);
+       const auto iter = _rows.find(row);
        if (iter != _rows.end())
                (*iter).second.get_annotation_subset(dest,
                        start_sample, end_sample);
@@ -194,10 +193,10 @@ void DecoderStack::begin_decode()
 
        clear();
 
-       // Check that all decoders have the required probes
+       // Check that all decoders have the required channels
        BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec, _stack)
                if (!dec->have_required_probes()) {
-                       _error_message = tr("One or more required probes "
+                       _error_message = tr("One or more required channels "
                                "have not been specified");
                        return;
                }
@@ -233,12 +232,12 @@ void DecoderStack::begin_decode()
                }
        }
 
-       // We get the logic data of the first probe in the list.
+       // We get the logic data of the first channel in the list.
        // This works because we are currently assuming all
        // LogicSignals have the same data/snapshot
        BOOST_FOREACH (const shared_ptr<decode::Decoder> &dec, _stack)
-               if (dec && !dec->probes().empty() &&
-                       ((logic_signal = (*dec->probes().begin()).second)) &&
+               if (dec && !dec->channels().empty() &&
+                       ((logic_signal = (*dec->channels().begin()).second)) &&
                        ((data = logic_signal->logic_data())))
                        break;
 
@@ -265,8 +264,7 @@ uint64_t DecoderStack::get_max_sample_count() const
 {
        uint64_t max_sample_count = 0;
 
-       for (map<const Row, RowData>::const_iterator i = _rows.begin();
-               i != _rows.end(); i++)
+       for (auto i = _rows.cbegin(); i != _rows.end(); i++)
                max_sample_count = max(max_sample_count,
                        (*i).second.get_max_sample());
 
@@ -396,11 +394,10 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
        const srd_decoder *const decc = pdata->pdo->di->decoder;
        assert(decc);
 
-       map<const Row, decode::RowData>::iterator row_iter = d->_rows.end();
+       auto row_iter = d->_rows.end();
        
        // Try looking up the sub-row of this class
-       const map<pair<const srd_decoder*, int>, Row>::const_iterator r =
-               d->_class_rows.find(make_pair(decc, a.format()));
+       const auto r = d->_class_rows.find(make_pair(decc, a.format()));
        if (r != d->_class_rows.end())
                row_iter = d->_rows.find((*r).second);
        else