OpenHantek
exporterregistry.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0+
2 
3 #pragma once
4 
5 #include <QObject>
6 #include <memory>
7 #include <set>
8 #include <vector>
9 
10 // Post processing forwards
11 class Processor;
12 class PPresult;
13 
14 // Settings forwards
15 class DsoSettings;
16 namespace Dso {
17 struct ControlSpecification;
18 }
19 
20 // Exporter forwards
21 class ExporterInterface;
22 
23 class ExporterRegistry : public QObject {
24  Q_OBJECT
25 
26  public:
28  QObject *parent = nullptr);
29 
30  // Sample input. This will proably be performed in the post processing
31  // thread context. Do not open GUI dialogs or interrupt the control flow.
32  void addRawSamples(PPresult *data);
33  void input(std::shared_ptr<PPresult> data);
34 
35  void registerExporter(ExporterInterface *exporter);
36  void setExporterEnabled(ExporterInterface *exporter, bool enabled);
37 
39 
40  // Iterate over this class object
41  std::vector<ExporterInterface *>::const_iterator begin();
42  std::vector<ExporterInterface *>::const_iterator end();
43 
47 
48  private:
50  std::vector<ExporterInterface *> exporters;
52  std::list<ExporterInterface *> enabledExporters;
54  std::set<ExporterInterface *> waitToSaveExporters;
55 
61  bool processData(std::shared_ptr<PPresult> &data, ExporterInterface *const &exporter);
62 
63  signals:
64  void exporterStatusChanged(const QString &exporterName, const QString &status);
66 };
Definition: exporterinterface.h:17
void input(std::shared_ptr< PPresult > data)
Definition: exporterregistry.cpp:31
std::vector< ExporterInterface * >::const_iterator end()
Definition: exporterregistry.cpp:84
Definition: exporterregistry.h:23
std::set< ExporterInterface * > waitToSaveExporters
List of exporters that wait to be called back by the user to save their work.
Definition: exporterregistry.h:54
void addRawSamples(PPresult *data)
Definition: exporterregistry.cpp:25
void registerExporter(ExporterInterface *exporter)
Definition: exporterregistry.cpp:36
Holds the settings of the program.
Definition: dsosettings.h:16
std::list< ExporterInterface * > enabledExporters
List of exporters that collect samples at the moment.
Definition: exporterregistry.h:52
void exporterProgressChanged()
void setExporterEnabled(ExporterInterface *exporter, bool enabled)
Definition: exporterregistry.cpp:41
ExporterRegistry(const Dso::ControlSpecification *deviceSpecification, DsoSettings *settings, QObject *parent=nullptr)
Definition: exporterregistry.cpp:12
const Dso::ControlSpecification * deviceSpecification
Device specifications.
Definition: exporterregistry.h:45
const DsoSettings * settings
Definition: exporterregistry.h:46
void exporterStatusChanged(const QString &exporterName, const QString &status)
Stores the specifications of the currently connected device.
Definition: controlspecification.h:42
bool processData(std::shared_ptr< PPresult > &data, ExporterInterface *const &exporter)
Definition: exporterregistry.cpp:16
Definition: processor.h:7
std::vector< ExporterInterface * >::const_iterator begin()
Definition: exporterregistry.cpp:82
void checkForWaitingExporters()
Definition: exporterregistry.cpp:70
std::vector< ExporterInterface * > exporters
List of all available exporters.
Definition: exporterregistry.h:50
Post processing results.
Definition: ppresult.h:36
Definition: TriggerDock.h:15