]> sigrok.org Git - pulseview.git/commitdiff
TraceView: Don't use unordered sets and maps
authorSoeren Apel <redacted>
Sun, 8 Mar 2020 09:39:06 +0000 (10:39 +0100)
committerSoeren Apel <redacted>
Mon, 11 May 2020 19:24:22 +0000 (21:24 +0200)
pv/views/trace/view.cpp
pv/views/trace/view.hpp

index 69599b1bb1bd28a8ad767e474e56be3b7a9640a6..93bcb52072f01ea2e7fe61b433e5849606013323 100644 (file)
@@ -29,7 +29,6 @@
 #include <cmath>
 #include <iostream>
 #include <iterator>
-#include <unordered_set>
 
 #include <QApplication>
 #include <QDebug>
@@ -82,8 +81,6 @@ using std::pair;
 using std::set;
 using std::set_difference;
 using std::shared_ptr;
-using std::unordered_map;
-using std::unordered_set;
 using std::vector;
 
 namespace pv {
@@ -1375,12 +1372,11 @@ void View::update_layout()
 
 TraceTreeItemOwner* View::find_prevalent_trace_group(
        const shared_ptr<sigrok::ChannelGroup> &group,
-       const unordered_map<shared_ptr<data::SignalBase>, shared_ptr<Signal> >
-               &signal_map)
+       const map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > &signal_map)
 {
        assert(group);
 
-       unordered_set<TraceTreeItemOwner*> owners;
+       set<TraceTreeItemOwner*> owners;
        vector<TraceTreeItemOwner*> owner_list;
 
        // 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(
        const vector< shared_ptr<sigrok::Channel> > &channels,
-       const unordered_map<shared_ptr<data::SignalBase>, shared_ptr<Signal> >
-               &signal_map,
+       const map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > &signal_map,
        set< shared_ptr<Trace> > &add_list)
 {
        vector< shared_ptr<Trace> > filtered_traces;
@@ -1754,8 +1749,7 @@ void View::signals_changed()
                inserter(remove_traces, remove_traces.begin()));
 
        // Make a look-up table of sigrok Channels to pulseview Signals
-       unordered_map<shared_ptr<data::SignalBase>, shared_ptr<Signal> >
-               signal_map;
+       map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > signal_map;
        for (const shared_ptr<Signal>& sig : signals_)
                signal_map[sig->base()] = sig;
 
@@ -1856,7 +1850,7 @@ void View::signals_changed()
 
        // Add and position the pending top levels items
        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);
 
                // Position the item after the last item or at the top if there is none
index 5863bc9d976caf6a2eb43d392879aa26b74a0a2b..8183fefc6c0b814a0cf96351e3a0d047fded990c 100644 (file)
@@ -24,7 +24,6 @@
 #include <list>
 #include <memory>
 #include <set>
-#include <unordered_map>
 #include <vector>
 
 #include <QAbstractScrollArea>
@@ -43,7 +42,7 @@
 #include "tracetreeitemowner.hpp"
 
 using std::list;
-using std::unordered_map;
+using std::map;
 using std::set;
 using std::shared_ptr;
 using std::vector;
@@ -404,14 +403,12 @@ private:
 
        TraceTreeItemOwner* find_prevalent_trace_group(
                const shared_ptr<sigrok::ChannelGroup> &group,
-               const unordered_map<shared_ptr<data::SignalBase>,
-                       shared_ptr<Signal> > &signal_map);
+               const map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > &signal_map);
 
        static vector< shared_ptr<Trace> >
                extract_new_traces_for_channels(
                const vector< shared_ptr<sigrok::Channel> > &channels,
-               const unordered_map<shared_ptr<data::SignalBase>,
-                       shared_ptr<Signal> > &signal_map,
+               const map<shared_ptr<data::SignalBase>, shared_ptr<Signal> > &signal_map,
                set< shared_ptr<Trace> > &add_list);
 
        void determine_time_unit();