statepublisher_base.h
Go to the documentation of this file.
1 #ifndef STATEPUBLISHER_TEMPLATE_H
2 #define STATEPUBLISHER_TEMPLATE_H
3 
4 #include <QObject>
5 #include <QtPlugin>
6 #include <QMenu>
7 #include <QDomElement>
8 #include <functional>
9 #include "PlotJuggler/plotdata.h"
10 
11 
13 
14 public:
15 
16  virtual bool enabled() const = 0;
17 
18  virtual const char* name() const = 0;
19 
20  virtual void updateState(double current_time) = 0;
21 
22  virtual void play(double interval) = 0;
23 
24  virtual ~StatePublisher() {}
25 
26  virtual void setEnabled(bool enabled)
27  {
28  auto prev = _action->blockSignals(true);
29  _action->setChecked(enabled);
30  _action->blockSignals(prev);
31  }
32 
33  virtual bool isDebugPlugin() { return false; }
34 
35  virtual void setParentMenu(QMenu* parent_menu, QAction* parent_action)
36  {
37  _menu = parent_menu;
38  _action = parent_action;
39  }
40 
41  virtual QWidget* embeddedWidget() { return nullptr; }
42 
43  virtual bool xmlSaveState(QDomDocument &doc, QDomElement &parent_element) const { return false; }
44 
45  virtual bool xmlLoadState(const QDomElement &parent_element ) { return false; }
46 
47  void setDataMap(const PlotDataMapRef* datamap) { _datamap = datamap; }
48 
49  QDomElement xmlSaveState(QDomDocument &doc) const
50  {
51  QDomElement plugin_elem = doc.createElement("plugin");
52  plugin_elem.setAttribute("ID", QString(this->name()).replace(" ", "_") );
53  xmlSaveState(doc, plugin_elem);
54  return plugin_elem;
55  }
56 
57 
58 protected:
59  QMenu* _menu;
60  QAction* _action;
62 };
63 
64 QT_BEGIN_NAMESPACE
65 
66 #define StatePublisher_iid "com.icarustechnology.PlotJuggler.StatePublisher"
67 
68 Q_DECLARE_INTERFACE(StatePublisher, StatePublisher_iid)
69 
70 QT_END_NAMESPACE
71 
72 
73 #endif
74 
virtual bool xmlLoadState(const QDomElement &parent_element)
virtual const char * name() const =0
virtual bool isDebugPlugin()
virtual void setParentMenu(QMenu *parent_menu, QAction *parent_action)
QDomElement xmlSaveState(QDomDocument &doc) const
virtual QWidget * embeddedWidget()
const PlotDataMapRef * _datamap
virtual void updateState(double current_time)=0
#define StatePublisher_iid
void setDataMap(const PlotDataMapRef *datamap)
virtual bool enabled() const =0
virtual void play(double interval)=0
virtual ~StatePublisher()
virtual bool xmlSaveState(QDomDocument &doc, QDomElement &parent_element) const
virtual void setEnabled(bool enabled)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18