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 
105  std::mutex _mutex;
107  QAction* _start_streamer;
109 };
110 
111 using DataStreamerPtr = std::shared_ptr<DataStreamer>;
112 
113 } // namespace PJ
114 
115 QT_BEGIN_NAMESPACE
116 #define DataStream_iid "facontidavide.PlotJuggler3.DataStreamer"
117 Q_DECLARE_INTERFACE(PJ::DataStreamer, DataStream_iid)
118 QT_END_NAMESPACE
119 
120 #endif
DataStreamer()=default
virtual void shutdown()=0
shutdown Stop streaming
virtual bool start(QStringList *pre_selected_sources)=0
start streaming.
std::map< QString, std::shared_ptr< ParserFactoryPlugin > > ParserFactories
PlotDataMapRef _data_map
The DataStreamer base classm used to read streaming of data.
void setParserFactories(ParserFactories *parsers)
std::mutex & mutex()
void setMaximumRangeX(double range)
ParserFactories * _parser_factories
const ParserFactories * parserFactories() const
virtual bool isRunning() const =0
isRunning
std::shared_ptr< DataStreamer > DataStreamerPtr
PlotDataMapRef & dataMap()
virtual std::pair< QAction *, int > notificationAction()
Gets the action to execute when clicking the &#39;notifications&#39; button and the current number of outstan...
virtual ~DataStreamer()=default
void clearBuffers()
Request the main application to clear previous data points.
const PlotDataMapRef & dataMap() const
void removeGroup(std::string group_name)
All the series which share this group, will be deleted.
#define DataStream_iid
void notificationsChanged(int active_notification_count)
The PlotJugglerPlugin is the base class of all the plugins.
Definition: pj_plugin.h:22


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:01:02