From: Soeren Apel Date: Tue, 16 Aug 2016 19:14:55 +0000 (+0200) Subject: Remove data_ also for LogicSignal and use SignalBase data instead X-Git-Tag: pulseview-0.4.0~273 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0aa57689a8abc7eb313de50774b8d0cf271bc61f;p=pulseview.git Remove data_ also for LogicSignal and use SignalBase data instead --- diff --git a/pv/session.cpp b/pv/session.cpp index 9d00a510..a6122404 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -417,11 +417,6 @@ void Session::update_signals() if (iter != prev_sigs.end()) { // Copy the signal from the old set to the new signal = *iter; - auto logic_signal = dynamic_pointer_cast< - view::LogicSignal>(signal); - if (logic_signal) - logic_signal->set_logic_data( - logic_data_); } else { // Create a new signal signalbase = shared_ptr( @@ -429,9 +424,10 @@ void Session::update_signals() switch(channel->type()->id()) { case SR_CHANNEL_LOGIC: + signalbase->set_data(logic_data_); signal = shared_ptr( new view::LogicSignal(*this, - device_, signalbase, logic_data_)); + device_, signalbase)); all_signal_data_.insert(logic_data_); signalbases_.insert(signalbase); break; diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index 52a2d22d..b8be8bba 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -99,12 +99,10 @@ QCache LogicSignal::pixmap_cache_; LogicSignal::LogicSignal( pv::Session &session, shared_ptr device, - shared_ptr base, - shared_ptr data) : + shared_ptr base) : Signal(session, base), signal_height_(QFontMetrics(QApplication::font()).height() * 2), device_(device), - data_(data), trigger_none_(nullptr), trigger_rising_(nullptr), trigger_high_(nullptr), @@ -128,17 +126,12 @@ LogicSignal::LogicSignal( shared_ptr LogicSignal::data() const { - return data_; + return base_->logic_data(); } shared_ptr LogicSignal::logic_data() const { - return data_; -} - -void LogicSignal::set_logic_data(std::shared_ptr data) -{ - data_ = data; + return base_->logic_data(); } std::pair LogicSignal::v_extents() const @@ -167,7 +160,6 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp) vector< pair > edges; assert(base_); - assert(data_); assert(owner_); const int y = get_visual_y(); @@ -179,7 +171,7 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp) const float low_offset = y + 0.5f; const deque< shared_ptr > &segments = - data_->logic_segments(); + base_->logic_data()->logic_segments(); if (segments.empty()) return; diff --git a/pv/view/logicsignal.hpp b/pv/view/logicsignal.hpp index 14eeed4b..8274b618 100644 --- a/pv/view/logicsignal.hpp +++ b/pv/view/logicsignal.hpp @@ -66,8 +66,7 @@ private: public: LogicSignal(pv::Session &session, std::shared_ptr device, - std::shared_ptr base, - std::shared_ptr data); + std::shared_ptr base); virtual ~LogicSignal() = default; @@ -75,8 +74,6 @@ public: std::shared_ptr logic_data() const; - void set_logic_data(std::shared_ptr data); - /** * Computes the vertical extents of the contents of this row item. * @return A pair containing the minimum and maximum y-values. @@ -134,7 +131,6 @@ private: int signal_height_; std::shared_ptr device_; - std::shared_ptr data_; const sigrok::TriggerMatchType *trigger_match_; QToolBar *trigger_bar_;