Moved inner decode loop into DecoderStack::decode_data
[pulseview.git] / pv / data / decoderstack.h
index 029ca25c21c91350c7709074aacd6c7a758ff88d..43996184500abef02bb276186d56978afe79c07e 100644 (file)
 #include <QObject>
 #include <QString>
 
+#include <pv/data/decode/row.h>
+#include <pv/data/decode/rowdata.h>
+
 struct srd_decoder;
+struct srd_decoder_annotation_row;
 struct srd_probe;
 struct srd_proto_data;
+struct srd_session;
 
 namespace DecoderStackTest {
 class TwoDecoderStack;
@@ -41,18 +46,18 @@ class TwoDecoderStack;
 
 namespace pv {
 
+class SigSession;
+
 namespace view {
 class LogicSignal;
-
-namespace decode {
-class Annotation;
-}
-
 }
 
 namespace data {
 
+class LogicSnapshot;
+
 namespace decode {
+class Annotation;
 class Decoder;
 }
 
@@ -68,7 +73,8 @@ private:
        static const int64_t DecodeChunkLength;
 
 public:
-       DecoderStack(const srd_decoder *const decoder);
+       DecoderStack(pv::SigSession &_session,
+               const srd_decoder *const decoder);
 
        virtual ~DecoderStack();
 
@@ -78,25 +84,42 @@ public:
 
        int64_t samples_decoded() const;
 
-       const std::vector< boost::shared_ptr<pv::view::decode::Annotation> >
-               annotations() const;
+       std::vector<decode::Row> get_visible_rows() const;
+
+       /**
+        * Extracts sorted annotations between two period into a vector.
+        */
+       void get_annotation_subset(
+               std::vector<pv::data::decode::Annotation> &dest,
+               const decode::Row &row, uint64_t start_sample,
+               uint64_t end_sample) const;
 
        QString error_message();
 
        void clear();
 
+       uint64_t get_max_sample_count() const;
+
        void begin_decode();
 
 private:
+       void decode_data(
+               const boost::shared_ptr<pv::data::LogicSnapshot> &snapshot,
+               srd_session *const session);
+
        void decode_proc(boost::shared_ptr<data::Logic> data);
 
        static void annotation_callback(srd_proto_data *pdata,
                void *decoder);
 
+private slots:
+       void on_new_frame();
+
 signals:
        void new_decode_data();
 
 private:
+       pv::SigSession &_session;
 
        /**
         * This mutex prevents more than one decode operation occuring
@@ -110,8 +133,11 @@ private:
 
        mutable boost::mutex _mutex;
        int64_t _samples_decoded;
-       std::vector< boost::shared_ptr<pv::view::decode::Annotation> >
-               _annotations;
+
+       std::map<const decode::Row, decode::RowData> _rows;
+
+       std::map<std::pair<const srd_decoder*, int>, decode::Row> _class_rows;
+
        QString _error_message;
 
        boost::thread _decode_thread;