using std::mutex;
using std::set;
using std::shared_ptr;
+using std::unordered_set;
using std::vector;
using sigrok::Channel;
map<shared_ptr<Channel>, shared_ptr<Signal> > signal_map;
shared_lock<shared_mutex> lock(session_.signals_mutex());
- const vector< shared_ptr<Signal> > &sigs(session_.signals());
+ const unordered_set< shared_ptr<Signal> > &sigs(session_.signals());
for (const shared_ptr<Signal> &sig : sigs)
signal_map[sig->channel()] = sig;
using std::set;
using std::shared_ptr;
using std::string;
+using std::unordered_set;
using std::vector;
using sigrok::Analog;
return signals_mutex_;
}
-const vector< shared_ptr<view::Signal> >& Session::signals() const
+const unordered_set< shared_ptr<view::Signal> >& Session::signals() const
{
return signals_;
}
}
assert(signal);
- signals_.push_back(signal);
+ signals_.insert(signal);
}
}
#include <set>
#include <string>
#include <thread>
+#include <unordered_set>
#include <vector>
#ifdef _WIN32
boost::shared_mutex& signals_mutex() const;
- const std::vector< std::shared_ptr<view::Signal> >& signals() const;
+ const std::unordered_set< std::shared_ptr<view::Signal> >&
+ signals() const;
#ifdef ENABLE_DECODE
bool add_decoder(srd_decoder *const dec);
capture_state capture_state_;
mutable boost::shared_mutex signals_mutex_;
- std::vector< std::shared_ptr<view::Signal> > signals_;
+ std::unordered_set< std::shared_ptr<view::Signal> > signals_;
mutable std::mutex data_mutex_;
std::shared_ptr<data::Logic> logic_data_;
using std::shared_ptr;
using std::string;
using std::thread;
+using std::unordered_set;
using std::vector;
using Glib::VariantBase;
session_.get_data();
shared_lock<shared_mutex> lock(session_.signals_mutex());
- const vector< shared_ptr<view::Signal> > &sigs(session_.signals());
+ const unordered_set< shared_ptr<view::Signal> > &sigs(
+ session_.signals());
// Check we have logic data
if (data_set.empty() || sigs.empty()) {
using std::pair;
using std::shared_ptr;
using std::tie;
+using std::unordered_set;
using std::vector;
namespace pv {
assert(dec);
shared_lock<shared_mutex> lock(session_.signals_mutex());
- const vector< shared_ptr<Signal> > &sigs(session_.signals());
+ const auto &sigs(session_.signals());
+
+ vector< shared_ptr<Signal> > sig_list(sigs.begin(), sigs.end());
+ std::sort(sig_list.begin(), sig_list.end(),
+ [](const shared_ptr<Signal> &a, const shared_ptr<Signal> b) {
+ return a->name().compare(b->name()) < 0; });
assert(decoder_stack_);
const auto channel_iter = dec->channels().find(pdch);
if (channel_iter == dec->channels().end())
selector->setCurrentIndex(0);
- for(size_t i = 0; i < sigs.size(); i++) {
- const shared_ptr<view::Signal> s(sigs[i]);
+ for (const shared_ptr<view::Signal> &s : sig_list) {
assert(s);
-
if (dynamic_pointer_cast<LogicSignal>(s) && s->enabled())
{
selector->addItem(s->name(),
qVariantFromValue((void*)s.get()));
if ((*channel_iter).second == s)
- selector->setCurrentIndex(i + 1);
+ selector->setCurrentIndex(
+ selector->count() - 1);
}
}
map<const srd_channel*, shared_ptr<LogicSignal> > channel_map;
shared_lock<shared_mutex> lock(session_.signals_mutex());
- const vector< shared_ptr<Signal> > &sigs(session_.signals());
+ const unordered_set< shared_ptr<Signal> > &sigs(session_.signals());
for (const ChannelSelector &s : channel_selectors_)
{
set< shared_ptr<SignalData> > View::get_visible_data() const
{
shared_lock<shared_mutex> lock(session().signals_mutex());
- const vector< shared_ptr<Signal> > &sigs(session().signals());
+ const unordered_set< shared_ptr<Signal> > &sigs(session().signals());
// Make a set of all the visible data objects
set< shared_ptr<SignalData> > visible_data;
signal_map;
shared_lock<shared_mutex> lock(session_.signals_mutex());
- const vector< shared_ptr<Signal> > &sigs(session_.signals());
+ const unordered_set< shared_ptr<Signal> > &sigs(session_.signals());
for (const shared_ptr<Signal> &sig : sigs)
signal_map[sig->channel()] = sig;