]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decode/decoder.cpp
Use SignalBase instead of LogicSignal for decoders
[pulseview.git] / pv / data / decode / decoder.cpp
index 374dd4d360c9bf8bca84f544eaf04892395c9888..3b75f88482e6ec3bc5613471f3dfde9d40a826e1 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "decoder.hpp"
 
-#include <pv/view/logicsignal.hpp>
+#include <pv/data/signalbase.hpp>
 
 using std::set;
 using std::map;
@@ -44,7 +44,7 @@ Decoder::Decoder(const srd_decoder *const dec) :
 
 Decoder::~Decoder()
 {
-       for (auto & option : options_)
+       for (auto& option : options_)
                g_variant_unref(option.second);
 }
 
@@ -63,14 +63,14 @@ void Decoder::show(bool show)
        shown_ = show;
 }
 
-const map<const srd_channel*, shared_ptr<view::LogicSignal> >&
+const map<const srd_channel*, shared_ptr<data::SignalBase> >&
 Decoder::channels() const
 {
        return channels_;
 }
 
 void Decoder::set_channels(std::map<const srd_channel*,
-       std::shared_ptr<view::LogicSignal> > channels)
+       std::shared_ptr<data::SignalBase> > channels)
 {
        channels_ = channels;
 }
@@ -102,10 +102,10 @@ bool Decoder::have_required_channels() const
 set< shared_ptr<pv::data::Logic> > Decoder::get_data()
 {
        set< shared_ptr<pv::data::Logic> > data;
-       for (const auto & channel : channels_) {
-               shared_ptr<view::LogicSignal> signal(channel.second);
-               assert(signal);
-               data.insert(signal->logic_data());
+       for (const auto& channel : channels_) {
+               shared_ptr<data::SignalBase> b(channel.second);
+               assert(b);
+               data.insert(b->logic_data());
        }
 
        return data;
@@ -116,7 +116,7 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const
        GHashTable *const opt_hash = g_hash_table_new_full(g_str_hash,
                g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
 
-       for (const auto & option : options_) {
+       for (const auto& option : options_) {
                GVariant *const value = option.second;
                g_variant_ref(value);
                g_hash_table_replace(opt_hash, (void*)g_strdup(
@@ -134,10 +134,9 @@ srd_decoder_inst* Decoder::create_decoder_inst(srd_session *session) const
        GHashTable *const channels = g_hash_table_new_full(g_str_hash,
                g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
 
-       for (const auto & channel : channels_) {
-               shared_ptr<view::LogicSignal> signal(channel.second);
-               GVariant *const gvar = g_variant_new_int32(
-                       signal->channel()->index());
+       for (const auto& channel : channels_) {
+               shared_ptr<data::SignalBase> b(channel.second);
+               GVariant *const gvar = g_variant_new_int32(b->index());
                g_variant_ref_sink(gvar);
                g_hash_table_insert(channels, channel.first->id, gvar);
        }