#include <pv/binding/decoder.hpp>
#include <pv/data/decode/decoder.hpp>
+#include <pv/data/decode/row.hpp>
#include <pv/data/decoderstack.hpp>
#include <pv/session.hpp>
using std::make_shared;
using std::shared_ptr;
using pv::data::decode::Decoder;
+using pv::data::decode::Row;
namespace pv {
namespace data {
return decoder_stack_;
}
+const list< shared_ptr<Decoder> >& DecodeSignal::decoder_stack_list() const
+{
+ return decoder_stack_->stack();
+}
+
void DecodeSignal::stack_decoder(srd_decoder *decoder)
{
assert(decoder);
return state;
}
+QString DecodeSignal::error_message() const
+{
+ return decoder_stack_->error_message();
+}
+
+vector<Row> DecodeSignal::visible_rows() const
+{
+ return decoder_stack_->get_visible_rows();
+}
+
+void DecodeSignal::get_annotation_subset(
+ vector<pv::data::decode::Annotation> &dest,
+ const decode::Row &row, uint64_t start_sample,
+ uint64_t end_sample) const
+{
+ return decoder_stack_->get_annotation_subset(dest, row,
+ start_sample, end_sample);
+}
+
void DecodeSignal::on_new_annotations()
{
// Forward the signal to the frontend
#ifndef PULSEVIEW_PV_DATA_DECODESIGNAL_HPP
#define PULSEVIEW_PV_DATA_DECODESIGNAL_HPP
+#include <vector>
+
+#include <QString>
+
#include <libsigrokdecode/libsigrokdecode.h>
#include <pv/data/signalbase.hpp>
+using std::list;
+using std::vector;
using std::shared_ptr;
namespace pv {
namespace data {
+namespace decode {
+class Annotation;
+class Decoder;
+class Row;
+}
+
class DecoderStack;
class Logic;
class SignalData;
virtual ~DecodeSignal();
bool is_decode_signal() const;
- shared_ptr<pv::data::DecoderStack> decoder_stack() const;
+ shared_ptr<data::DecoderStack> decoder_stack() const;
+ const list< shared_ptr<data::decode::Decoder> >& decoder_stack_list() const;
void stack_decoder(srd_decoder *decoder);
void remove_decoder(int index);
bool toggle_decoder_visibility(int index);
+ QString error_message() const;
+
+ vector<decode::Row> visible_rows() const;
+
+ /**
+ * Extracts sorted annotations between two period into a vector.
+ */
+ void get_annotation_subset(
+ vector<pv::data::decode::Annotation> &dest,
+ const decode::Row &row, uint64_t start_sample,
+ uint64_t end_sample) const;
+
Q_SIGNALS:
void new_annotations();
using std::unordered_set;
using std::vector;
+using pv::data::decode::Annotation;
+using pv::data::decode::Row;
+
namespace pv {
namespace views {
namespace trace {
void DecodeTrace::paint_mid(QPainter &p, ViewItemPaintParams &pp)
{
- using namespace pv::data::decode;
-
- shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
-
const int text_height = ViewItemPaintParams::text_height();
row_height_ = (text_height * 6) / 4;
const int annotation_height = (text_height * 5) / 4;
- assert(decoder_stack);
- const QString err = decoder_stack->error_message();
+ const QString err = decode_signal_->error_message();
if (!err.isEmpty()) {
draw_unresolved_period(
p, annotation_height, pp.left(), pp.right());
pair<uint64_t, uint64_t> sample_range = get_sample_range(
pp.left(), pp.right());
- const vector<Row> rows(decoder_stack->get_visible_rows());
+ const vector<Row> rows = decode_signal_->visible_rows();
visible_rows_.clear();
for (const Row& row : rows) {
base_colour >>= 16;
vector<Annotation> annotations;
- decoder_stack->get_annotation_subset(annotations, row,
+ decode_signal_->get_annotation_subset(annotations, row,
sample_range.first, sample_range.second);
if (!annotations.empty()) {
draw_annotations(annotations, p, annotation_height, pp, y,
void DecodeTrace::paint_fore(QPainter &p, ViewItemPaintParams &pp)
{
- using namespace pv::data::decode;
-
assert(row_height_);
for (size_t i = 0; i < visible_rows_.size(); i++) {
{
using pv::data::decode::Decoder;
- shared_ptr<pv::data::DecoderStack> decoder_stack = base_->decoder_stack();
-
assert(form);
- assert(parent);
- assert(decoder_stack);
// Add the standard options
Trace::populate_popup_form(parent, form);
channel_selectors_.clear();
decoder_forms_.clear();
- const list< shared_ptr<Decoder> >& stack = decoder_stack->stack();
+ const list< shared_ptr<Decoder> >& stack =
+ decode_signal_->decoder_stack_list();
if (stack.empty()) {
QLabel *const l = new QLabel(