]> sigrok.org Git - pulseview.git/blobdiff - pv/session.cpp
Introduce DecodeSignal class
[pulseview.git] / pv / session.cpp
index 516e1acd5ad6ff1e6b52a277f97c042e28e37872..fa5f95bb2ca7832cb6ba478524a70a564ba06ed3 100644 (file)
@@ -53,6 +53,7 @@
 
 #ifdef ENABLE_DECODE
 #include <libsigrokdecode/libsigrokdecode.h>
+#include "data/decodesignal.hpp"
 #endif
 
 using std::bad_alloc;
@@ -437,10 +438,10 @@ void Session::set_default_device()
 /**
  * Convert generic options to data types that are specific to InputFormat.
  *
- * @param[in] user_spec vector of tokenized words, string format
- * @param[in] fmt_opts input format's options, result of InputFormat::options()
+ * @param[in] user_spec Vector of tokenized words, string format.
+ * @param[in] fmt_opts Input format's options, result of InputFormat::options().
  *
- * @return map of options suitable for InputFormat::create_input()
+ * @return Map of options suitable for InputFormat::create_input().
  */
 map<string, Glib::VariantBase>
 Session::input_format_options(vector<string> user_spec,
@@ -687,14 +688,13 @@ bool Session::add_decoder(srd_decoder *const dec)
                decoder_stack->stack().front()->set_channels(channels);
 
                // Create the decode signal
-               shared_ptr<data::SignalBase> signalbase =
-                       make_shared<data::SignalBase>(nullptr, data::SignalBase::DecodeChannel);
+               shared_ptr<data::DecodeSignal> signal =
+                       make_shared<data::DecodeSignal>(decoder_stack);
 
-               signalbase->set_decoder_stack(decoder_stack);
-               signalbases_.insert(signalbase);
+               signalbases_.insert(signal);
 
                for (shared_ptr<views::ViewBase> view : views_)
-                       view->add_decode_signal(signalbase);
+                       view->add_decode_signal(signal);
        } catch (runtime_error e) {
                return false;
        }
@@ -707,12 +707,12 @@ bool Session::add_decoder(srd_decoder *const dec)
        return true;
 }
 
-void Session::remove_decode_signal(shared_ptr<data::SignalBase> signalbase)
+void Session::remove_decode_signal(shared_ptr<data::DecodeSignal> signal)
 {
-       signalbases_.erase(signalbase);
+       signalbases_.erase(signal);
 
        for (shared_ptr<views::ViewBase> view : views_)
-               view->remove_decode_signal(signalbase);
+               view->remove_decode_signal(signal);
 
        signals_changed();
 }