Debian Codegraph @

src/plots.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2016-2017, Mike Walters <[email protected]>
3 *
4 * This file is part of inspectrum.
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 3 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 "amplitudedemod.h"
21 #include "frequencydemod.h"
22 #include "phasedemod.h"
23 #include "threshold.h"
24 #include "traceplot.h"
25
26 #include "plots.h"
27
28 std::multimap<std::type_index, PlotInfo> Plots::plots;
29 Plots::_init Plots::_initializer;
30
31 Plot* Plots::samplePlot(std::shared_ptr<AbstractSampleSource> source)
32 {
33 return new TracePlot(source);
34 }
35
36 Plot* Plots::amplitudePlot(std::shared_ptr<AbstractSampleSource> source)
37 {
38 typedef SampleSource<std::complex<float>> Source;
39 std::shared_ptr<Source> concrete = std::dynamic_pointer_cast<Source>(source);
40 return new TracePlot( std::make_shared<AmplitudeDemod>(concrete) );
41 }
42
43 Plot* Plots::frequencyPlot(std::shared_ptr<AbstractSampleSource> source)
44 {
45 typedef SampleSource<std::complex<float>> Source;
46 std::shared_ptr<Source> concrete = std::dynamic_pointer_cast<Source>(source);
47 return new TracePlot( std::make_shared<FrequencyDemod>( concrete ) );
48 }
49
50 Plot* Plots::phasePlot(std::shared_ptr<AbstractSampleSource> source)
51 {
52 typedef SampleSource<std::complex<float>> Source;
53 std::shared_ptr<Source> concrete = std::dynamic_pointer_cast<Source>(source);
54 return new TracePlot(std::make_shared<PhaseDemod>(concrete));
55 }
56
57 Plot* Plots::thresholdPlot(std::shared_ptr<AbstractSampleSource> source)
58 {
59 typedef SampleSource<float> Source;
60 std::shared_ptr<Source> concrete= std::dynamic_pointer_cast<Source>(source);
61 return new TracePlot( std::make_shared<Threshold>( concrete ) );
62 }