]> sigrok.org Git - pulseview.git/blobdiff - pv/data/analog.hpp
Session: Fix issue #67 by improving error handling
[pulseview.git] / pv / data / analog.hpp
index 9551afff68efe1d060f07c13fdb0d30a33181d19..560732f8bef8bebf238e948b37249ccd8d4f5141 100644 (file)
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef PULSEVIEW_PV_DATA_ANALOG_H
-#define PULSEVIEW_PV_DATA_ANALOG_H
+#ifndef PULSEVIEW_PV_DATA_ANALOG_HPP
+#define PULSEVIEW_PV_DATA_ANALOG_HPP
 
 #include "signaldata.hpp"
 
 #include <deque>
 #include <memory>
 
+#include <QObject>
+#include "pv/data/segment.hpp"
+
+using std::deque;
+using std::shared_ptr;
+using std::vector;
+
 namespace pv {
 namespace data {
 
-class AnalogSnapshot;
+class AnalogSegment;
 
 class Analog : public SignalData
 {
+       Q_OBJECT
+
 public:
        Analog();
 
-       void push_snapshot(
-               std::shared_ptr<AnalogSnapshot> &snapshot);
+       void push_segment(shared_ptr<AnalogSegment> &segment);
 
-       const std::deque< std::shared_ptr<AnalogSnapshot> >&
-               analog_snapshots() const;
+       const deque< shared_ptr<AnalogSegment> >& analog_segments() const;
 
-       std::vector< std::shared_ptr<Snapshot> > snapshots() const;
+       vector< shared_ptr<Segment> > segments() const;
+
+       uint32_t get_segment_count() const;
 
        void clear();
 
-       uint64_t get_max_sample_count() const;
+       void set_samplerate(double value);
+
+       double get_samplerate() const;
+
+       uint64_t max_sample_count() const;
+
+       void notify_samples_added(shared_ptr<Segment> segment, uint64_t start_sample,
+               uint64_t end_sample);
+
+       void notify_min_max_changed(float min, float max);
+
+Q_SIGNALS:
+       void samples_cleared();
+
+       void samples_added(SharedPtrToSegment segment, uint64_t start_sample,
+               uint64_t end_sample);
+
+       void min_max_changed(float min, float max);
+
+private Q_SLOTS:
+       void on_segment_completed();
 
 private:
-       std::deque< std::shared_ptr<AnalogSnapshot> > snapshots_;
+       double samplerate_;
+       deque< shared_ptr<AnalogSegment> > segments_;
 };
 
 } // namespace data
 } // namespace pv
 
-#endif // PULSEVIEW_PV_DATA_ANALOG_H
+#endif // PULSEVIEW_PV_DATA_ANALOG_HPP