Gazebo Gui

API Reference

3.12.0
TopicEcho.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_TOPICECHO_HH_
19 #define GZ_GUI_PLUGINS_TOPICECHO_HH_
20 
21 #ifdef _MSC_VER
22 #pragma warning(push, 0)
23 #endif
24 #include <google/protobuf/message.h>
25 #ifdef _MSC_VER
26 #pragma warning(pop)
27 #endif
28 
29 #ifndef _WIN32
30 # define TopicEcho_EXPORTS_API
31 #else
32 # if (defined(TopicEcho_EXPORTS))
33 # define TopicEcho_EXPORTS_API __declspec(dllexport)
34 # else
35 # define TopicEcho_EXPORTS_API __declspec(dllimport)
36 # endif
37 #endif
38 
39 #include <memory>
40 
41 #include "gz/gui/Plugin.hh"
42 
43 namespace ignition
44 {
45 namespace gui
46 {
47 namespace plugins
48 {
49  class TopicEchoPrivate;
50 
56  {
57  Q_OBJECT
58 
60  Q_PROPERTY(
61  QString topic
62  READ Topic
63  WRITE SetTopic
64  NOTIFY TopicChanged
65  )
66 
67 
68  Q_PROPERTY(
69  bool paused
70  READ Paused
71  WRITE SetPaused
72  NOTIFY PausedChanged
73  )
74 
76  public: TopicEcho();
77 
79  public: virtual ~TopicEcho();
80 
81  // Documentation inherited
82  public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem);
83 
87  public: Q_INVOKABLE QString Topic() const;
88 
92  public: Q_INVOKABLE void SetTopic(const QString &_topic);
93 
95  signals: void TopicChanged();
96 
97  public slots: void OnBuffer(const unsigned int _steps);
98 
101  public: Q_INVOKABLE bool Paused() const;
102 
105  public: Q_INVOKABLE void SetPaused(const bool &_paused);
106 
108  signals: void PausedChanged();
109 
112  signals: void AddMsg(QString _msg);
113 
116  private: void OnMessage(const google::protobuf::Message &_msg);
117 
119  private: void Stop();
120 
122  public slots: void OnEcho(const bool _checked);
123 
126  private slots: void OnAddMsg(QString _msg);
127 
130  private: std::unique_ptr<TopicEchoPrivate> dataPtr;
131  };
132 }
133 }
134 }
135 
136 #endif
#define TopicEcho_EXPORTS_API
Definition: TopicEcho.hh:30
Base class for Gazebo GUI plugins.
Definition: gz/gui/Plugin.hh:54
STL namespace.
Definition: gz/gui/Application.hh:35
Echo messages coming through an Gazebo transport topic.
Definition: TopicEcho.hh:55