Gazebo Gui

API Reference

9.0.0
WorldStats.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_WORLDSTATS_HH_
19#define GZ_GUI_PLUGINS_WORLDSTATS_HH_
20
21#include <memory>
22
23#include <gz/msgs/world_stats.pb.h>
24
25#include "gz/gui/Plugin.hh"
26
27#include <gz/utils/ImplPtr.hh>
28
29#ifndef _WIN32
30# define WorldStats_EXPORTS_API __attribute__ ((visibility ("default")))
31#else
32# if (defined(WorldStats_EXPORTS))
33# define WorldStats_EXPORTS_API __declspec(dllexport)
34# else
35# define WorldStats_EXPORTS_API __declspec(dllimport)
36# endif
37#endif
38
39namespace gz::gui::plugins
40{
62 {
63 Q_OBJECT
64
66 Q_PROPERTY(
67 QString realTimeFactor
68 READ RealTimeFactor
69 WRITE SetRealTimeFactor
70 NOTIFY RealTimeFactorChanged
71 )
72
73
74 Q_PROPERTY(
75 QString simTime
76 READ SimTime
77 WRITE SetSimTime
78 NOTIFY SimTimeChanged
79 )
80
82 Q_PROPERTY(
83 QString realTime
84 READ RealTime
85 WRITE SetRealTime
86 NOTIFY RealTimeChanged
87 )
88
90 Q_PROPERTY(
91 QString iterations
92 READ Iterations
93 WRITE SetIterations
94 NOTIFY IterationsChanged
95 )
96
98 public: WorldStats();
99
101 public: ~WorldStats() override;
102
103 // Documentation inherited
104 public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
105
107 public slots: void ProcessMsg();
108
111 public: Q_INVOKABLE QString RealTimeFactor() const;
112
115 public: Q_INVOKABLE void SetRealTimeFactor(const QString &_realTimeFactor);
116
118 signals: void RealTimeFactorChanged();
119
122 public: Q_INVOKABLE QString SimTime() const;
123
126 public: Q_INVOKABLE void SetSimTime(const QString &_simTime);
127
129 signals: void SimTimeChanged();
130
133 public: Q_INVOKABLE QString RealTime() const;
134
137 public: Q_INVOKABLE void SetRealTime(const QString &_realTime);
138
140 signals: void RealTimeChanged();
141
144 public: Q_INVOKABLE QString Iterations() const;
145
148 public: Q_INVOKABLE void SetIterations(const QString &_iterations);
149
151 signals: void IterationsChanged();
152
154 private: void OnWorldStatsMsg(const gz::msgs::WorldStatistics &_msg);
155
156 // Private data
157 GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
158 };
159} // namespace gz::gui::plugins
160
161#endif // GZ_GUI_PLUGINS_WORLDSTATS_HH_