]> sigrok.org Git - pulseview.git/blame - pv/data/logic.hpp
Rework all subthread-based workers to make notifications more robust
[pulseview.git] / pv / data / logic.hpp
CommitLineData
28a4c9c5 1/*
b3f22de0 2 * This file is part of the PulseView project.
28a4c9c5
JH
3 *
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
efdec55a 17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
28a4c9c5
JH
18 */
19
7a01bd36
JH
20#ifndef PULSEVIEW_PV_DATA_LOGIC_HPP
21#define PULSEVIEW_PV_DATA_LOGIC_HPP
640d091b 22
2acdb232 23#include "signaldata.hpp"
720f4762 24#include "segment.hpp"
28a4c9c5 25
1e669074 26#include <deque>
2858b391 27
7db61e77
SA
28#include <QObject>
29
6f925ba9
UH
30using std::deque;
31using std::shared_ptr;
32using std::vector;
33
51e77110 34namespace pv {
1b1ec774 35namespace data {
51e77110 36
f3d66e52 37class LogicSegment;
28a4c9c5 38
8ce8ebb9 39class Logic : public SignalData
28a4c9c5 40{
7db61e77
SA
41 Q_OBJECT
42
28a4c9c5 43public:
6ac6242b 44 Logic(unsigned int num_channels);
28a4c9c5 45
9aa2602a 46 unsigned int num_channels() const;
f556bc6a 47
6f925ba9 48 void push_segment(shared_ptr<LogicSegment> &segment);
28a4c9c5 49
6f925ba9 50 const deque< shared_ptr<LogicSegment> >& logic_segments() const;
1f3033cb 51 deque< shared_ptr<LogicSegment> >& logic_segments();
2858b391 52
6f925ba9 53 vector< shared_ptr<Segment> > segments() const;
99503171 54
9009d9b5 55 uint32_t get_segment_count() const;
7f965464 56
caabb84c 57 void clear();
b087ba7f 58
464f05d5
SA
59 void set_samplerate(double value);
60
eeceee99
SA
61 double get_samplerate() const;
62
e45b13b5 63 uint64_t max_sample_count() const;
a007f5ad 64
1f3033cb 65 void notify_samples_added(shared_ptr<Segment> segment, uint64_t start_sample,
7db61e77
SA
66 uint64_t end_sample);
67
68Q_SIGNALS:
69 void samples_cleared();
70
720f4762 71 void samples_added(SharedPtrToSegment segment, uint64_t start_sample,
7db61e77
SA
72 uint64_t end_sample);
73
28a4c9c5 74private:
464f05d5 75 double samplerate_;
8dbbc7f0 76 const unsigned int num_channels_;
6f925ba9 77 deque< shared_ptr<LogicSegment> > segments_;
28a4c9c5 78};
51e77110 79
1b1ec774 80} // namespace data
51e77110 81} // namespace pv
640d091b 82
7a01bd36 83#endif // PULSEVIEW_PV_DATA_LOGIC_HPP