#include <assert.h>
+#include <stdexcept>
+
#include <sys/stat.h>
#include <QDebug>
return _logic_data;
}
-void SigSession::add_decoder(srd_decoder *const dec,
+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
{
lock_guard<mutex> lock(_signals_mutex);
- if (!_decode_traces.empty()) {
- qDebug("Currently only one decode trace can be added "
- "at once");
- _decode_traces.clear();
- }
-
shared_ptr<data::Decoder> decoder(
new data::Decoder(dec, probes, options));
shared_ptr<view::DecodeSignal> d(
_decode_traces.size()));
_decode_traces.push_back(d);
}
+ catch(std::runtime_error e)
+ {
+ return false;
+ }
+
signals_changed();
+
+ return true;
}
vector< shared_ptr<view::DecodeSignal> > SigSession::get_decode_signals() const
if(sdi) {
for (const GSList *l = sdi->probes; l; l = l->next) {
- const sr_probe *const probe =
- (const sr_probe *)l->data;
+ sr_probe *const probe = (sr_probe *)l->data;
assert(probe);
switch(probe->type) {