Decoder::Decoder(const srd_decoder *const dec,
std::map<const srd_probe*,
- boost::shared_ptr<pv::view::Signal> > probes,
+ boost::shared_ptr<pv::view::LogicSignal> > probes,
GHashTable *options) :
_decoder(dec),
_probes(probes),
// We get the logic data of the first probe in the list.
// This works because we are currently assuming all
// LogicSignals have the same data/snapshot
- shared_ptr<pv::view::Signal> sig = (*_probes.begin()).second;
+ shared_ptr<pv::view::LogicSignal> sig = (*_probes.begin()).second;
assert(sig);
- const pv::view::LogicSignal *const l =
- dynamic_cast<pv::view::LogicSignal*>(sig.get());
- assert(l);
- shared_ptr<data::Logic> data = l->data();
+ shared_ptr<data::Logic> data = sig->data();
_decode_thread = boost::thread(&Decoder::decode_proc, this,
data);
GHashTable *probes = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
- for(map<const srd_probe*, shared_ptr<view::Signal> >::
+ for(map<const srd_probe*, shared_ptr<view::LogicSignal> >::
const_iterator i = _probes.begin();
i != _probes.end(); i++)
{
namespace pv {
namespace view {
-class Signal;
+class LogicSignal;
namespace decode {
class Annotation;
public:
Decoder(const srd_decoder *const decoder,
std::map<const srd_probe*,
- boost::shared_ptr<pv::view::Signal> > probes,
+ boost::shared_ptr<pv::view::LogicSignal> > probes,
GHashTable *options);
virtual ~Decoder();
private:
const srd_decoder *const _decoder;
- std::map<const srd_probe*, boost::shared_ptr<view::Signal> >
+ std::map<const srd_probe*, boost::shared_ptr<view::LogicSignal> >
_probes;
GHashTable *_options;
namespace dialogs {
Decoder::Decoder(QWidget *parent, const srd_decoder *decoder,
- const vector< shared_ptr<view::Signal> > &sigs, GHashTable *options) :
+ const vector< shared_ptr<view::LogicSignal> > &sigs,
+ GHashTable *options) :
QDialog(parent),
_sigs(sigs),
_binding(decoder, options),
selector->setCurrentIndex(0);
for(size_t i = 0; i < _sigs.size(); i++) {
- const shared_ptr<view::Signal> s(_sigs[i]);
+ const shared_ptr<view::LogicSignal> s(_sigs[i]);
assert(s);
- if (s->enabled()) {
+ if (s->enabled())
+ {
selector->addItem(s->get_name(), qVariantFromValue(i));
if(s->get_name().toLower().contains(
QString(name).toLower()))
return selector;
}
-map<const srd_probe*, shared_ptr<view::Signal> > Decoder::get_probes()
+map<const srd_probe*, shared_ptr<view::LogicSignal> > Decoder::get_probes()
{
- map<const srd_probe*, shared_ptr<view::Signal> > probe_map;
+ map<const srd_probe*, shared_ptr<view::LogicSignal> > probe_map;
for(map<const srd_probe*, QComboBox*>::const_iterator i =
_probe_selector_map.begin();
i != _probe_selector_map.end(); i++)
const int probe_index =
combo->itemData(combo->currentIndex()).value<int>();
if(probe_index >= 0) {
- shared_ptr<view::Signal> sig = _sigs[probe_index];
- if(dynamic_cast<pv::view::LogicSignal*>(sig.get()))
- probe_map[(*i).first] = sig;
- else
- qDebug() << "Currently only logic signals "
- "are supported for decoding";
+ shared_ptr<view::LogicSignal> sig = _sigs[probe_index];
+ probe_map[(*i).first] = sig;
}
}
namespace pv {
namespace view {
-class Signal;
+class LogicSignal;
}
namespace dialogs {
{
public:
Decoder(QWidget *parent, const srd_decoder *decoder,
- const std::vector< boost::shared_ptr<view::Signal> > &sigs,
+ const std::vector< boost::shared_ptr<view::LogicSignal> > &sigs,
GHashTable *options);
void accept();
- std::map<const srd_probe*, boost::shared_ptr<view::Signal> >
+ std::map<const srd_probe*, boost::shared_ptr<view::LogicSignal> >
get_probes();
private:
QWidget *parent, const char *name);
private:
- const std::vector< boost::shared_ptr<view::Signal> > &_sigs;
+ const std::vector< boost::shared_ptr<view::LogicSignal> > &_sigs;
std::map<const srd_probe*, QComboBox*> _probe_selector_map;
#include "dialogs/connect.h"
#include "dialogs/decoder.h"
#include "toolbars/samplingbar.h"
+#include "view/logicsignal.h"
#include "view/view.h"
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
(srd_decoder*)((QAction*)action)->data().value<void*>();
assert(dec);
- const std::vector< boost::shared_ptr<view::Signal> > &sigs =
+ vector< shared_ptr<view::LogicSignal> > logic_sigs;
+ const vector< shared_ptr<view::Signal> > &sigs =
_session.get_signals();
+ BOOST_FOREACH(shared_ptr<view::Signal> s, sigs) {
+ assert(s);
+ shared_ptr<view::LogicSignal> l =
+ dynamic_pointer_cast<view::LogicSignal>(s);
+ if (l)
+ logic_sigs.push_back(l);
+ }
GHashTable *const options = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
- dialogs::Decoder dlg(this, dec, sigs, options);
+ dialogs::Decoder dlg(this, dec, logic_sigs, options);
if(dlg.exec() != QDialog::Accepted) {
g_hash_table_destroy(options);
return;
bool SigSession::add_decoder(srd_decoder *const dec,
std::map<const srd_probe*,
- boost::shared_ptr<view::Signal> > probes,
+ boost::shared_ptr<view::LogicSignal> > probes,
GHashTable *options)
{
try
namespace view {
class DecodeSignal;
+class LogicSignal;
class Signal;
}
bool add_decoder(srd_decoder *const dec,
std::map<const srd_probe*,
- boost::shared_ptr<view::Signal> > probes,
+ boost::shared_ptr<view::LogicSignal> > probes,
GHashTable *options);
std::vector< boost::shared_ptr<view::DecodeSignal> >
srd_decoder *const dec = (struct srd_decoder*)l->data;
BOOST_REQUIRE(dec);
- map<const srd_probe*, shared_ptr<pv::view::Signal> > probes;
+ map<const srd_probe*, shared_ptr<pv::view::LogicSignal> > probes;
BOOST_CHECK (ss.add_decoder(dec, probes,
g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
(GDestroyNotify)g_variant_unref)));