using std::out_of_range;
using std::shared_ptr;
using std::unique_lock;
-using pv::data::decode::Annotation;
using pv::data::decode::AnnotationClass;
using pv::data::decode::DecodeChannel;
-using pv::data::decode::Decoder;
-using pv::data::decode::Row;
namespace pv {
namespace data {
// Toggle decoder visibility
bool state = false;
if (dec) {
- state = !dec->shown();
- dec->show(state);
+ state = !dec->visible();
+ dec->set_visible(state);
}
return state;
for (const shared_ptr<Decoder>& dec : stack_) {
assert(dec);
- if (visible_only && !dec->shown())
+ if (visible_only && !dec->visible())
continue;
for (Row* row : dec->get_rows())
for (const shared_ptr<Decoder>& dec : stack_) {
assert(dec);
- if (visible_only && !dec->shown())
+ if (visible_only && !dec->visible())
continue;
for (const Row* row : dec->get_rows())
auto row_it = segment->annotation_rows.find(row);
const RowData* rd;
- if (row_it == segment->annotation_rows.end()) {
- // FIXME Use the fallback row, but how?
- assert(false);
+ if (row_it == segment->annotation_rows.end())
return 0;
- } else
+ else
rd = &(row_it->second);
return rd->get_annotation_count();
}
-void DecodeSignal::get_annotation_subset(vector<Annotation> &dest,
+void DecodeSignal::get_annotation_subset(vector<const Annotation*> &dest,
const Row* row, uint32_t segment_id, uint64_t start_sample,
uint64_t end_sample) const
{
auto row_it = segment->annotation_rows.find(row);
const RowData* rd;
- if (row_it == segment->annotation_rows.end()) {
- // FIXME Use the fallback row, but how?
- assert(false);
+ if (row_it == segment->annotation_rows.end())
return;
- } else
+ else
rd = &(row_it->second);
rd->get_annotation_subset(dest, start_sample, end_sample);
}
-void DecodeSignal::get_annotation_subset(vector<Annotation> &dest,
+void DecodeSignal::get_annotation_subset(vector<const Annotation*> &dest,
uint32_t segment_id, uint64_t start_sample, uint64_t end_sample) const
{
// Use forward_lists for faster merging
- forward_list<Annotation> *all_ann_list = new forward_list<Annotation>();
+ forward_list<const Annotation*> *all_ann_list = new forward_list<const Annotation*>();
vector<const Row*> rows = get_rows();
for (const Row* row : rows) {
- vector<Annotation> *ann_vector = new vector<Annotation>();
+ vector<const Annotation*> *ann_vector = new vector<const Annotation*>();
get_annotation_subset(*ann_vector, row, segment_id, start_sample, end_sample);
- forward_list<Annotation> *ann_list =
- new forward_list<Annotation>(ann_vector->begin(), ann_vector->end());
+ forward_list<const Annotation*> *ann_list =
+ new forward_list<const Annotation*>(ann_vector->begin(), ann_vector->end());
delete ann_vector;
all_ann_list->merge(*ann_list);
settings.beginGroup("decoder" + QString::number(decoder_idx++));
settings.setValue("id", decoder->get_srd_decoder()->id);
- settings.setValue("shown", decoder->shown());
+ settings.setValue("visible", decoder->visible());
// Save decoder options
const map<string, GVariant*>& options = decoder->options();
shared_ptr<Decoder> decoder = make_shared<Decoder>(dec);
stack_.push_back(decoder);
- decoder->show(settings.value("shown", true).toBool());
+ decoder->set_visible(settings.value("visible", true).toBool());
// Restore decoder options that differ from their default
int options = settings.value("options").toInt();
assert(dec);
AnnotationClass* ann_class = dec->get_ann_class_by_id(pda->ann_class);
- assert(ann_class);
+ if (!ann_class) {
+ qWarning() << "Decoder" << ds->display_name() << "wanted to add annotation" <<
+ "with class ID" << pda->ann_class << "but there are only" <<
+ dec->ann_classes().size() << "known classes";
+ return;
+ }
const Row* row = ann_class->row;