]> sigrok.org Git - pulseview.git/blob - pv/data/mathsignal.cpp
Introduce math signals
[pulseview.git] / pv / data / mathsignal.cpp
1 /*
2  * This file is part of the PulseView project.
3  *
4  * Copyright (C) 2020 Soeren Apel <soeren@apelpie.net>
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
17  * along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include <limits>
21
22 #include <QDebug>
23
24 #include "mathsignal.hpp"
25
26 #include <pv/globalsettings.hpp>
27 #include <pv/session.hpp>
28 #include <pv/data/analogsegment.hpp>
29 #include <pv/data/signalbase.hpp>
30
31 using std::make_shared;
32
33 namespace pv {
34 namespace data {
35
36 const int64_t MathSignal::ChunkLength = 256 * 1024;
37
38
39 MathSignal::MathSignal(pv::Session &session) :
40         SignalBase(nullptr, SignalBase::MathChannel),
41         session_(session)
42 {
43         shared_ptr<data::Analog> data(new data::Analog());
44         set_data(data);
45
46         shared_ptr<data::AnalogSegment> segment = make_shared<data::AnalogSegment>(
47                 *data, data->get_segment_count(), session.get_samplerate());
48
49         data->push_segment(segment);
50 }
51
52 MathSignal::~MathSignal()
53 {
54 }
55
56 void MathSignal::save_settings(QSettings &settings) const
57 {
58         (void)settings;
59 }
60
61 void MathSignal::restore_settings(QSettings &settings)
62 {
63         (void)settings;
64 }
65
66 } // namespace data
67 } // namespace pv