projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replaced BOOST_FOREACH with C++11 range-based for loops
[pulseview.git]
/
pv
/
data
/
decoderstack.cpp
diff --git
a/pv/data/decoderstack.cpp
b/pv/data/decoderstack.cpp
index c3bf26d25699c12135707b40512414c9ee0ef4f3..1cb7d4ff126f7fda54dfac544a24a599e91dd67d 100644
(file)
--- a/
pv/data/decoderstack.cpp
+++ b/
pv/data/decoderstack.cpp
@@
-20,7
+20,6
@@
#include <libsigrokdecode/libsigrokdecode.h>
#include <libsigrokdecode/libsigrokdecode.h>
-#include <boost/foreach.hpp>
#include <boost/thread/thread.hpp>
#include <stdexcept>
#include <boost/thread/thread.hpp>
#include <stdexcept>
@@
-106,7
+105,7
@@
void DecoderStack::remove(int index)
assert(index < (int)_stack.size());
// Find the decoder in the stack
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());
for(int i = 0; i < index; i++, iter++)
assert(iter != _stack.end());
@@
-126,7
+125,7
@@
std::vector<Row> DecoderStack::get_visible_rows() const
vector<Row> rows;
vector<Row> rows;
-
BOOST_FOREACH (const shared_ptr<decode::Decoder> &dec,
_stack)
+
for (const shared_ptr<decode::Decoder> &dec :
_stack)
{
assert(dec);
if (!dec->shown())
{
assert(dec);
if (!dec->shown())
@@
-159,8
+158,7
@@
void DecoderStack::get_annotation_subset(
{
lock_guard<mutex> lock(_output_mutex);
{
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);
if (iter != _rows.end())
(*iter).second.get_annotation_subset(dest,
start_sample, end_sample);
@@
-195,7
+193,7
@@
void DecoderStack::begin_decode()
clear();
// Check that all decoders have the required channels
clear();
// Check that all decoders have the required channels
-
BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec,
_stack)
+
for (const shared_ptr<decode::Decoder> &dec :
_stack)
if (!dec->have_required_probes()) {
_error_message = tr("One or more required channels "
"have not been specified");
if (!dec->have_required_probes()) {
_error_message = tr("One or more required channels "
"have not been specified");
@@
-203,7
+201,7
@@
void DecoderStack::begin_decode()
}
// Add classes
}
// Add classes
-
BOOST_FOREACH (const shared_ptr<decode::Decoder> &dec,
_stack)
+
for (const shared_ptr<decode::Decoder> &dec :
_stack)
{
assert(dec);
const srd_decoder *const decc = dec->decoder();
{
assert(dec);
const srd_decoder *const decc = dec->decoder();
@@
-236,7
+234,7
@@
void DecoderStack::begin_decode()
// 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
// 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)
+
for (const shared_ptr<decode::Decoder> &dec :
_stack)
if (dec && !dec->channels().empty() &&
((logic_signal = (*dec->channels().begin()).second)) &&
((data = logic_signal->logic_data())))
if (dec && !dec->channels().empty() &&
((logic_signal = (*dec->channels().begin()).second)) &&
((data = logic_signal->logic_data())))
@@
-265,8
+263,7
@@
uint64_t DecoderStack::get_max_sample_count() const
{
uint64_t max_sample_count = 0;
{
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());
max_sample_count = max(max_sample_count,
(*i).second.get_max_sample());
@@
-338,7
+335,7
@@
void DecoderStack::decode_proc()
// Create the decoders
const unsigned int unit_size = _snapshot->unit_size();
// Create the decoders
const unsigned int unit_size = _snapshot->unit_size();
-
BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec,
_stack)
+
for (const shared_ptr<decode::Decoder> &dec :
_stack)
{
srd_decoder_inst *const di = dec->create_decoder_inst(session, unit_size);
{
srd_decoder_inst *const di = dec->create_decoder_inst(session, unit_size);
@@
-396,11
+393,10
@@
void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
const srd_decoder *const decc = pdata->pdo->di->decoder;
assert(decc);
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
// 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
if (r != d->_class_rows.end())
row_iter = d->_rows.find((*r).second);
else