datastreamer_base.h
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5  */
6 
7 #ifndef DATA_STREAMER_TEMPLATE_H
8 #define DATA_STREAMER_TEMPLATE_H
9 
10 #include <mutex>
11 #include <unordered_set>
12 #include "PlotJuggler/plotdata.h"
13 #include "PlotJuggler/pj_plugin.h"
15 
16 namespace PJ
17 {
26 {
27  Q_OBJECT
28 public:
29  DataStreamer() = default;
30 
31  virtual ~DataStreamer() = default;
32 
39  virtual bool start(QStringList* pre_selected_sources) = 0;
40 
44  virtual void shutdown() = 0;
45 
51  virtual bool isRunning() const = 0;
52 
57  virtual std::pair<QAction*, int> notificationAction()
58  {
59  return { nullptr, 0 };
60  }
61 
62  std::mutex& mutex()
63  {
64  return _mutex;
65  }
66 
67  void setMaximumRangeX(double range);
68 
70  {
71  return _data_map;
72  }
73 
74  const PlotDataMapRef& dataMap() const
75  {
76  return _data_map;
77  }
78 
79  void setParserFactories(ParserFactories* parsers);
80 
81  const ParserFactories* parserFactories() const;
82 
83 signals:
84 
86  void clearBuffers();
87 
89  void removeGroup(std::string group_name);
90 
93  void dataReceived();
94 
97  void closed();
98 
99  // Plugin notifications.
100  // PJ modifies the "notifications" button to indicate whether there are any
101  void notificationsChanged(int active_notification_count);
102 
103 private:
104  std::mutex _mutex;
106  QAction* _start_streamer;
108 };
109 
110 using DataStreamerPtr = std::shared_ptr<DataStreamer>;
111 
112 } // namespace PJ
113 
114 QT_BEGIN_NAMESPACE
115 #define DataStream_iid "facontidavide.PlotJuggler3.DataStreamer"
116 Q_DECLARE_INTERFACE(PJ::DataStreamer, DataStream_iid)
117 QT_END_NAMESPACE
118 
119 #endif
PJ::DataStreamer::notificationsChanged
void notificationsChanged(int active_notification_count)
PJ::DataStreamer::isRunning
virtual bool isRunning() const =0
isRunning
PJ::DataStreamer::notificationAction
virtual std::pair< QAction *, int > notificationAction()
Gets the action to execute when clicking the 'notifications' button and the current number of outstan...
Definition: datastreamer_base.h:57
PJ::DataStreamer::setMaximumRangeX
void setMaximumRangeX(double range)
Definition: datastreamer_base.cpp:12
DataStream_iid
#define DataStream_iid
Definition: datastreamer_base.h:115
PJ::PlotJugglerPlugin
The PlotJugglerPlugin is the base class of all the plugins.
Definition: pj_plugin.h:22
PJ::DataStreamer::removeGroup
void removeGroup(std::string group_name)
All the series which share this group, will be deleted.
PJ::DataStreamer
The DataStreamer base classm used to read streaming of data.
Definition: datastreamer_base.h:25
PJ::DataStreamer::_mutex
std::mutex _mutex
Definition: datastreamer_base.h:104
PJ::DataStreamerPtr
std::shared_ptr< DataStreamer > DataStreamerPtr
Definition: datastreamer_base.h:110
PJ::DataStreamer::_parser_factories
ParserFactories * _parser_factories
Definition: datastreamer_base.h:107
PJ::DataStreamer::DataStreamer
DataStreamer()=default
PJ::DataStreamer::shutdown
virtual void shutdown()=0
shutdown Stop streaming
PJ::DataStreamer::parserFactories
const ParserFactories * parserFactories() const
Definition: datastreamer_base.cpp:34
PJ::DataStreamer::dataMap
PlotDataMapRef & dataMap()
Definition: datastreamer_base.h:69
PJ::DataStreamer::start
virtual bool start(QStringList *pre_selected_sources)=0
start streaming.
PJ::DataStreamer::closed
void closed()
PJ::DataStreamer::~DataStreamer
virtual ~DataStreamer()=default
PJ::DataStreamer::_data_map
PlotDataMapRef _data_map
Definition: datastreamer_base.h:105
plotdata.h
pj_plugin.h
PJ::DataStreamer::setParserFactories
void setParserFactories(ParserFactories *parsers)
Definition: datastreamer_base.cpp:29
PJ::ParserFactories
std::map< QString, std::shared_ptr< ParserFactoryPlugin > > ParserFactories
Definition: messageparser_base.h:157
PJ::DataStreamer::clearBuffers
void clearBuffers()
Request the main application to clear previous data points.
PJ::DataStreamer::dataMap
const PlotDataMapRef & dataMap() const
Definition: datastreamer_base.h:74
PJ::DataStreamer::dataReceived
void dataReceived()
PJ::DataStreamer::_start_streamer
QAction * _start_streamer
Definition: datastreamer_base.h:106
PJ
Definition: dataloader_base.h:16
PJ::DataStreamer::mutex
std::mutex & mutex()
Definition: datastreamer_base.h:62
PJ::PlotDataMapRef
Definition: plotdata.h:34
messageparser_base.h


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:22