Don't use std:: in the code directly (where possible).
[pulseview.git] / pv / data / analogsegment.hpp
index 52d37a76c3e67fdfba671ae46030e390940e1355..8dd6f5f189746ec903157c7563892ad2073f1170 100644 (file)
 #include <utility>
 #include <vector>
 
+#include <QObject>
+
+using std::pair;
+
 namespace AnalogSegmentTest {
 struct Basic;
 }
@@ -32,14 +36,18 @@ struct Basic;
 namespace pv {
 namespace data {
 
+class Analog;
+
 typedef struct {
        uint64_t sample_index, chunk_num, chunk_offs;
        uint8_t* chunk;
        float* value;
 } SegmentAnalogDataIterator;
 
-class AnalogSegment : public Segment
+class AnalogSegment : public QObject, public Segment
 {
+       Q_OBJECT
+
 public:
        struct EnvelopeSample
        {
@@ -71,7 +79,7 @@ private:
        static const uint64_t EnvelopeDataUnit;
 
 public:
-       AnalogSegment(uint64_t samplerate);
+       AnalogSegment(Analog& owner, uint64_t samplerate);
 
        virtual ~AnalogSegment();
 
@@ -81,9 +89,11 @@ public:
        const float* get_samples(int64_t start_sample,
                int64_t end_sample) const;
 
-       SegmentAnalogDataIterator* begin_sample_iteration(uint64_t start) const;
-       void continue_sample_iteration(SegmentAnalogDataIterator* it, uint64_t increase) const;
-       void end_sample_iteration(SegmentAnalogDataIterator* it) const;
+       const pair<float, float> get_min_max() const;
+
+       SegmentAnalogDataIterator* begin_sample_iteration(uint64_t start);
+       void continue_sample_iteration(SegmentAnalogDataIterator* it, uint64_t increase);
+       void end_sample_iteration(SegmentAnalogDataIterator* it);
 
        void get_envelope_section(EnvelopeSection &s,
                uint64_t start, uint64_t end, float min_length) const;
@@ -94,8 +104,12 @@ private:
        void append_payload_to_envelope_levels();
 
 private:
+       Analog& owner_;
+
        struct Envelope envelope_levels_[ScaleStepCount];
 
+       float min_value_, max_value_;
+
        friend struct AnalogSegmentTest::Basic;
 };