]> sigrok.org Git - pulseview.git/blobdiff - pv/data/logic.hpp
Session: Fix issue #67 by improving error handling
[pulseview.git] / pv / data / logic.hpp
index a51850719bbeba7e8c1355860a162bedce2acc8f..07f8222c1946cc699828c6ac3cdc6c3d761eb67d 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_LOGIC_H
-#define PULSEVIEW_PV_DATA_LOGIC_H
+#ifndef PULSEVIEW_PV_DATA_LOGIC_HPP
+#define PULSEVIEW_PV_DATA_LOGIC_HPP
 
 #include "signaldata.hpp"
+#include "segment.hpp"
 
 #include <deque>
-#include <memory>
+
+#include <QObject>
+
+using std::deque;
+using std::shared_ptr;
+using std::vector;
 
 namespace pv {
 namespace data {
 
-class LogicSnapshot;
+class LogicSegment;
 
 class Logic : public SignalData
 {
+       Q_OBJECT
+
 public:
        Logic(unsigned int num_channels);
 
-       int get_num_channels() const;
+       unsigned int num_channels() const;
 
-       void push_snapshot(
-               std::shared_ptr<LogicSnapshot> &snapshot);
+       void push_segment(shared_ptr<LogicSegment> &segment);
 
-       const std::deque< std::shared_ptr<LogicSnapshot> >&
-               logic_snapshots() const;
+       const deque< shared_ptr<LogicSegment> >& logic_segments() const;
+       deque< shared_ptr<LogicSegment> >& logic_segments();
+
+       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);
+
+Q_SIGNALS:
+       void samples_cleared();
+
+       void samples_added(SharedPtrToSegment segment, uint64_t start_sample,
+               uint64_t end_sample);
+
+private Q_SLOTS:
+       void on_segment_completed();
 
 private:
+       double samplerate_;
        const unsigned int num_channels_;
-       std::deque< std::shared_ptr<LogicSnapshot> > snapshots_;
+       deque< shared_ptr<LogicSegment> > segments_;
 };
 
 } // namespace data
 } // namespace pv
 
-#endif // PULSEVIEW_PV_DATA_LOGIC_H
+#endif // PULSEVIEW_PV_DATA_LOGIC_HPP