Gazebo Gui

API Reference

9.0.0~pre1
Publisher.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17
18#ifndef GZ_GUI_PLUGINS_PUBLISHER_HH_
19#define GZ_GUI_PLUGINS_PUBLISHER_HH_
20
21#include <memory>
22
23#include "gz/gui/Plugin.hh"
24#include <gz/utils/ImplPtr.hh>
25
26#ifndef _WIN32
27# define Publisher_EXPORTS_API __attribute__ ((visibility ("default")))
28#else
29# if (defined(Publisher_EXPORTS))
30# define Publisher_EXPORTS_API __declspec(dllexport)
31# else
32# define Publisher_EXPORTS_API __declspec(dllimport)
33# endif
34#endif
35
36namespace gz::gui::plugins
37{
42 class Publisher_EXPORTS_API Publisher : public Plugin
43 {
44 Q_OBJECT
45
47 Q_PROPERTY(
48 QString msgType
49 READ MsgType
50 WRITE SetMsgType
51 NOTIFY MsgTypeChanged
52 )
53
54
55 Q_PROPERTY(
56 QString msgData
57 READ MsgData
58 WRITE SetMsgData
59 NOTIFY MsgDataChanged
60 )
61
63 Q_PROPERTY(
64 QString topic
65 READ Topic
66 WRITE SetTopic
67 NOTIFY TopicChanged
68 )
69
71 Q_PROPERTY(
72 double frequency
73 READ Frequency
74 WRITE SetFrequency
75 NOTIFY FrequencyChanged
76 )
77
79 public: Publisher();
80
82 public: virtual ~Publisher();
83
84 // Documentation inherited
85 public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem);
86
89 public slots: void OnPublish(const bool _checked);
90
94 public: Q_INVOKABLE QString MsgType() const;
95
99 public: Q_INVOKABLE void SetMsgType(const QString &_msgType);
100
102 signals: void MsgTypeChanged();
103
107 public: Q_INVOKABLE QString MsgData() const;
108
112 public: Q_INVOKABLE void SetMsgData(const QString &_msgData);
113
115 signals: void MsgDataChanged();
116
120 public: Q_INVOKABLE QString Topic() const;
121
125 public: Q_INVOKABLE void SetTopic(const QString &_topic);
126
128 signals: void TopicChanged();
129
132 public: Q_INVOKABLE double Frequency() const;
133
136 public: Q_INVOKABLE void SetFrequency(const double _frequency);
137
139 signals: void FrequencyChanged();
140
143 private: GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
144 };
145} // namespace gz::gui::plugins
146
147#endif // GZ_GUI_PLUGINS_PUBLISHER_HH_