X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fdecoder.h;h=72ccd2ec58622a9119f6e3f15ddbd2d1fa45e831;hp=4cae427ea95813e842be6aaa25fb93641ee0de1d;hb=4e5a4405482a296ebb6014e627298ad156c78d55;hpb=e0fc58100fbcd6c3bfd5aecb213d7541a3436622 diff --git a/pv/data/decoder.h b/pv/data/decoder.h index 4cae427e..72ccd2ec 100644 --- a/pv/data/decoder.h +++ b/pv/data/decoder.h @@ -29,15 +29,22 @@ #include #include +#include + +#include struct srd_decoder; -struct srd_decoder_inst; struct srd_probe; +struct srd_proto_data; + +namespace DecoderTest { +class TwoDecoder; +} namespace pv { namespace view { -class Signal; +class LogicSignal; namespace decode { class Annotation; @@ -59,41 +66,62 @@ private: static const int64_t DecodeChunkLength; public: - Decoder(const srd_decoder *const decoder, - std::map > probes); + Decoder(const srd_decoder *const decoder); virtual ~Decoder(); - const srd_decoder* get_decoder() const; + const srd_decoder* decoder() const; + + const std::map >& + probes() const; + void set_probes(std::map > probes); + + const GHashTable* options() const; + + void set_option(const char *id, GVariant *value); const std::vector< boost::shared_ptr > annotations() const; + QString error_message(); + void clear_snapshots(); private: void begin_decode(); - void init_decoder(); - void decode_proc(boost::shared_ptr data); static void annotation_callback(srd_proto_data *pdata, void *decoder); +signals: + void new_decode_data(); + private: + + /** + * This mutex prevents more than one decode operation occuring + * concurrently. + * @todo A proper solution should be implemented to allow multiple + * decode operations. + */ + static boost::mutex _global_decode_mutex; + const srd_decoder *const _decoder; - std::map > + std::map > _probes; + GHashTable *_options; - srd_decoder_inst *_decoder_inst; - - mutable boost::mutex _annotations_mutex; + mutable boost::mutex _mutex; std::vector< boost::shared_ptr > _annotations; + QString _error_message; boost::thread _decode_thread; + + friend class DecoderTest::TwoDecoder; }; } // namespace data