X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Fdecodesignal.hpp;h=2f7c273e978bfa2ec09618d89ddb1d273c1be676;hb=ff83d98059f06ac8f57be080ab53e7095aa4748b;hp=23ab209b73a2faa784806fe5d24b68abd6683e96;hpb=ad908057e13224eee9f983685e0ccc7db1ded0e9;p=pulseview.git diff --git a/pv/data/decodesignal.hpp b/pv/data/decodesignal.hpp index 23ab209..2f7c273 100644 --- a/pv/data/decodesignal.hpp +++ b/pv/data/decodesignal.hpp @@ -20,42 +20,99 @@ #ifndef PULSEVIEW_PV_DATA_DECODESIGNAL_HPP #define PULSEVIEW_PV_DATA_DECODESIGNAL_HPP +#include +#include + +#include + #include #include +using std::list; +using std::unordered_set; +using std::vector; using std::shared_ptr; namespace pv { namespace data { +namespace decode { +class Annotation; +class Decoder; +class Row; +} + class DecoderStack; class Logic; +class SignalBase; class SignalData; +struct DecodeChannel +{ + uint16_t id; // Also tells which bit within a sample represents this channel + const bool is_optional; + const pv::data::SignalBase *assigned_signal; + const QString name, desc; + int initial_pin_state; + const shared_ptr decoder_; + const srd_channel *pdch_; +}; + class DecodeSignal : public SignalBase { Q_OBJECT public: - DecodeSignal(shared_ptr decoder_stack); + DecodeSignal(shared_ptr decoder_stack, + const unordered_set< shared_ptr > &all_signals); virtual ~DecodeSignal(); bool is_decode_signal() const; - shared_ptr decoder_stack() const; + shared_ptr decoder_stack() const; + const list< shared_ptr >& 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; + + const list get_channels() const; + void auto_assign_signals(); + void assign_signal(const uint16_t channel_id, const SignalBase *signal); + + void set_initial_pin_state(const uint16_t channel_id, const int init_state); + + double samplerate() const; + const pv::util::Timestamp& start_time() const; + int64_t sample_count() const; + int64_t samples_decoded() const; + + vector visible_rows() const; + + /** + * Extracts sorted annotations between two period into a vector. + */ + void get_annotation_subset( + vector &dest, + const decode::Row &row, uint64_t start_sample, + uint64_t end_sample) const; + +private: + void update_channel_list(); + Q_SIGNALS: void new_annotations(); + void channels_updated(); private Q_SLOTS: void on_new_annotations(); private: shared_ptr decoder_stack_; + const unordered_set< shared_ptr > &all_signals_; + list channels_; }; } // namespace data