X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdata%2Fdecode%2Fdecoder.cpp;h=e6fe82d22a092d7e663a06e813ab52a4aac908da;hb=761f8302350c52f2cf357f49e1084e7101c70497;hp=99118d1707e5361e9f9449fbb6b24e18b1cd61f1;hpb=41293691c797b8f5e3133c072aa869fc9cf91253;p=pulseview.git diff --git a/pv/data/decode/decoder.cpp b/pv/data/decode/decoder.cpp index 99118d17..e6fe82d2 100644 --- a/pv/data/decode/decoder.cpp +++ b/pv/data/decode/decoder.cpp @@ -38,7 +38,7 @@ namespace decode { Decoder::Decoder(const srd_decoder *const dec) : srd_decoder_(dec), - shown_(true), + visible_(true), decoder_inst_(nullptr) { // Query the annotation output classes @@ -69,7 +69,7 @@ Decoder::Decoder(const srd_decoder *const dec) : for (const GSList *rl = srd_decoder_->annotation_rows; rl; rl = rl->next) { const srd_decoder_annotation_row *const srd_row = (srd_decoder_annotation_row *)rl->data; assert(srd_row); - rows_.push_back({i++, this, srd_row}); + rows_.emplace_back(i++, this, srd_row); // FIXME PV can crash from .at() if a PD's ann classes are defined incorrectly for (const GSList *cl = srd_row->ann_classes; cl; cl = cl->next) @@ -78,7 +78,7 @@ Decoder::Decoder(const srd_decoder *const dec) : if (rows_.empty()) { // Make sure there is a row for PDs without row declarations - rows_.push_back({0, this}); + rows_.emplace_back(0, this); for (AnnotationClass& c : ann_classes_) c.row = &(rows_.back()); @@ -101,14 +101,14 @@ const char* Decoder::name() const return srd_decoder_->name; } -bool Decoder::shown() const +bool Decoder::visible() const { - return shown_; + return visible_; } -void Decoder::show(bool show) +void Decoder::set_visible(bool visible) { - shown_ = show; + visible_ = visible; } const vector& Decoder::channels() const @@ -264,6 +264,14 @@ AnnotationClass* Decoder::get_ann_class_by_id(size_t id) return &(ann_classes_[id]); } +const AnnotationClass* Decoder::get_ann_class_by_id(size_t id) const +{ + if (id >= ann_classes_.size()) + return nullptr; + + return &(ann_classes_[id]); +} + uint32_t Decoder::get_binary_class_count() const { return bin_classes_.size();