TraceView: Don't use unordered sets and maps

This commit is contained in:
Soeren Apel 2020-03-08 10:39:06 +01:00
parent 720f476238
commit 9cee9c1b89
2 changed files with 8 additions and 17 deletions

View File

@ -29,7 +29,6 @@
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
#include <unordered_set>
#include <QApplication> #include <QApplication>
#include <QDebug> #include <QDebug>
@ -82,8 +81,6 @@ using std::pair;
using std::set; using std::set;
using std::set_difference; using std::set_difference;
using std::shared_ptr; using std::shared_ptr;
using std::unordered_map;
using std::unordered_set;
using std::vector; using std::vector;
namespace pv { namespace pv {
@ -1375,12 +1372,11 @@ void View::update_layout()
TraceTreeItemOwner* View::find_prevalent_trace_group( TraceTreeItemOwner* View::find_prevalent_trace_group(
const shared_ptr<sigrok::ChannelGroup> &group, const shared_ptr<sigrok::ChannelGroup> &group,
const unordered_map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > const map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > &signal_map)
&signal_map)
{ {
assert(group); assert(group);
unordered_set<TraceTreeItemOwner*> owners; set<TraceTreeItemOwner*> owners;
vector<TraceTreeItemOwner*> owner_list; vector<TraceTreeItemOwner*> owner_list;
// Make a set and a list of all the owners // Make a set and a list of all the owners
@ -1412,8 +1408,7 @@ TraceTreeItemOwner* View::find_prevalent_trace_group(
vector< shared_ptr<Trace> > View::extract_new_traces_for_channels( vector< shared_ptr<Trace> > View::extract_new_traces_for_channels(
const vector< shared_ptr<sigrok::Channel> > &channels, const vector< shared_ptr<sigrok::Channel> > &channels,
const unordered_map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > const map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > &signal_map,
&signal_map,
set< shared_ptr<Trace> > &add_list) set< shared_ptr<Trace> > &add_list)
{ {
vector< shared_ptr<Trace> > filtered_traces; vector< shared_ptr<Trace> > filtered_traces;
@ -1754,8 +1749,7 @@ void View::signals_changed()
inserter(remove_traces, remove_traces.begin())); inserter(remove_traces, remove_traces.begin()));
// Make a look-up table of sigrok Channels to pulseview Signals // Make a look-up table of sigrok Channels to pulseview Signals
unordered_map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > signal_map;
signal_map;
for (const shared_ptr<Signal>& sig : signals_) for (const shared_ptr<Signal>& sig : signals_)
signal_map[sig->base()] = sig; signal_map[sig->base()] = sig;
@ -1856,7 +1850,7 @@ void View::signals_changed()
// Add and position the pending top levels items // Add and position the pending top levels items
int offset = v_extents().second; int offset = v_extents().second;
for (auto item : new_top_level_items) { for (shared_ptr<TraceTreeItem> item : new_top_level_items) {
add_child_item(item); add_child_item(item);
// Position the item after the last item or at the top if there is none // Position the item after the last item or at the top if there is none

View File

@ -24,7 +24,6 @@
#include <list> #include <list>
#include <memory> #include <memory>
#include <set> #include <set>
#include <unordered_map>
#include <vector> #include <vector>
#include <QAbstractScrollArea> #include <QAbstractScrollArea>
@ -43,7 +42,7 @@
#include "tracetreeitemowner.hpp" #include "tracetreeitemowner.hpp"
using std::list; using std::list;
using std::unordered_map; using std::map;
using std::set; using std::set;
using std::shared_ptr; using std::shared_ptr;
using std::vector; using std::vector;
@ -404,14 +403,12 @@ private:
TraceTreeItemOwner* find_prevalent_trace_group( TraceTreeItemOwner* find_prevalent_trace_group(
const shared_ptr<sigrok::ChannelGroup> &group, const shared_ptr<sigrok::ChannelGroup> &group,
const unordered_map<shared_ptr<data::SignalBase>, const map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > &signal_map);
shared_ptr<Signal> > &signal_map);
static vector< shared_ptr<Trace> > static vector< shared_ptr<Trace> >
extract_new_traces_for_channels( extract_new_traces_for_channels(
const vector< shared_ptr<sigrok::Channel> > &channels, const vector< shared_ptr<sigrok::Channel> > &channels,
const unordered_map<shared_ptr<data::SignalBase>, const map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > &signal_map,
shared_ptr<Signal> > &signal_map,
set< shared_ptr<Trace> > &add_list); set< shared_ptr<Trace> > &add_list);
void determine_time_unit(); void determine_time_unit();