#include "decoder.hpp"
-#include <pv/view/logicsignal.hpp>
+#include <pv/data/signalbase.hpp>
using std::set;
using std::map;
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;
}
{
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());
+ shared_ptr<data::SignalBase> b(channel.second);
+ assert(b);
+ data.insert(b->logic_data());
}
return data;
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->base()->index());
+ 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);
}
namespace pv {
-namespace view {
-class LogicSignal;
-}
-
namespace data {
class Logic;
+class SignalBase;
namespace decode {
void show(bool show = true);
const std::map<const srd_channel*,
- std::shared_ptr<view::LogicSignal> >& channels() const;
+ std::shared_ptr<data::SignalBase> >& channels() const;
void set_channels(std::map<const srd_channel*,
- std::shared_ptr<view::LogicSignal> > channels);
+ std::shared_ptr<data::SignalBase> > channels);
const std::map<std::string, GVariant*>& options() const;
bool shown_;
- std::map<const srd_channel*, std::shared_ptr<pv::view::LogicSignal> >
+ std::map<const srd_channel*, std::shared_ptr<pv::data::SignalBase> >
channels_;
std::map<std::string, GVariant*> options_;
};
void DecoderStack::begin_decode()
{
- shared_ptr<pv::view::LogicSignal> logic_signal;
+ shared_ptr<pv::data::SignalBase> signalbase;
shared_ptr<pv::data::Logic> data;
if (decode_thread_.joinable()) {
// We get the logic data of the first channel in the list.
// This works because we are currently assuming all
- // LogicSignals have the same data/segment
+ // logic signals have the same data/segment
for (const shared_ptr<decode::Decoder> &dec : stack_)
if (dec && !dec->channels().empty() &&
- ((logic_signal = (*dec->channels().begin()).second)) &&
- ((data = logic_signal->logic_data())))
+ ((signalbase = (*dec->channels().begin()).second)) &&
+ ((data = signalbase->logic_data())))
break;
if (!data)
#ifdef ENABLE_DECODE
bool Session::add_decoder(srd_decoder *const dec)
{
- map<const srd_channel*, shared_ptr<view::LogicSignal> > channels;
+ map<const srd_channel*, shared_ptr<data::SignalBase> > channels;
shared_ptr<data::DecoderStack> decoder_stack;
try {
// Auto select the initial channels
for (const srd_channel *pdch : all_channels)
- for (shared_ptr<view::Signal> s : signals_) {
- shared_ptr<view::LogicSignal> l =
- dynamic_pointer_cast<view::LogicSignal>(s);
- if (l && QString::fromUtf8(pdch->name).
- toLower().contains(
- s->base()->name().toLower()))
- channels[pdch] = l;
+ for (shared_ptr<data::SignalBase> b : signalbases_) {
+ if (b->type() == ChannelType::LOGIC) {
+ if (QString::fromUtf8(pdch->name).toLower().
+ contains(b->name().toLower()))
+ channels[pdch] = b;
+ }
}
assert(decoder_stack);
#include <pv/data/logic.hpp>
#include <pv/data/logicsegment.hpp>
#include <pv/data/decode/annotation.hpp>
-#include <pv/view/logicsignal.hpp>
+#include <pv/view/signal.hpp>
#include <pv/view/view.hpp>
#include <pv/view/viewport.hpp>
#include <pv/widgets/decodergroupbox.hpp>
assert(decoder_stack_);
shared_ptr<Logic> data;
- shared_ptr<LogicSignal> logic_signal;
+ shared_ptr<data::SignalBase> signalbase;
const list< shared_ptr<Decoder> > &stack = decoder_stack_->stack();
// LogicSignals have the same data/segment
for (const shared_ptr<Decoder> &dec : stack)
if (dec && !dec->channels().empty() &&
- ((logic_signal = (*dec->channels().begin()).second)) &&
- ((data = logic_signal->logic_data())))
+ ((signalbase = (*dec->channels().begin()).second)) &&
+ ((data = signalbase->logic_data())))
break;
if (!data || data->logic_segments().empty())
for (const shared_ptr<view::Signal> &s : sig_list) {
assert(s);
- if (dynamic_pointer_cast<LogicSignal>(s) && s->enabled()) {
+ if (s->base()->type() == sigrok::ChannelType::LOGIC && s->enabled()) {
selector->addItem(s->base()->name(),
- qVariantFromValue((void*)s.get()));
+ qVariantFromValue((void*)s->base().get()));
if (channel_iter != dec->channels().end() &&
- (*channel_iter).second == s)
+ (*channel_iter).second == s->base())
selector->setCurrentIndex(
selector->count() - 1);
}
{
assert(dec);
- map<const srd_channel*, shared_ptr<LogicSignal> > channel_map;
+ map<const srd_channel*, shared_ptr<data::SignalBase> > channel_map;
const unordered_set< shared_ptr<Signal> > sigs(session_.signals());
if (s.decoder_ != dec)
break;
- const LogicSignal *const selection =
- (LogicSignal*)s.combo_->itemData(
+ const data::SignalBase *const selection =
+ (data::SignalBase*)s.combo_->itemData(
s.combo_->currentIndex()).value<void*>();
for (shared_ptr<Signal> sig : sigs)
- if (sig.get() == selection) {
- channel_map[s.pdch_] =
- dynamic_pointer_cast<LogicSignal>(sig);
+ if (sig->base().get() == selection) {
+ channel_map[s.pdch_] = sig->base();
break;
}
}