Gazebo Gui

API Reference

7.2.2
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/Export.hh"
26 #include "gz/gui/Plugin.hh"
27 
28 #ifndef _WIN32
29 # define WorldStats_EXPORTS_API
30 #else
31 # if (defined(WorldStats_EXPORTS))
32 # define WorldStats_EXPORTS_API __declspec(dllexport)
33 # else
34 # define WorldStats_EXPORTS_API __declspec(dllimport)
35 # endif
36 #endif
37 
38 namespace gz::gui::plugins
39 {
40  class WorldStatsPrivate;
41 
63  {
64  Q_OBJECT
65 
67  Q_PROPERTY(
68  QString realTimeFactor
69  READ RealTimeFactor
70  WRITE SetRealTimeFactor
71  NOTIFY RealTimeFactorChanged
72  )
73 
74 
75  Q_PROPERTY(
76  QString simTime
77  READ SimTime
78  WRITE SetSimTime
79  NOTIFY SimTimeChanged
80  )
81 
83  Q_PROPERTY(
84  QString realTime
85  READ RealTime
86  WRITE SetRealTime
87  NOTIFY RealTimeChanged
88  )
89 
91  Q_PROPERTY(
92  QString iterations
93  READ Iterations
94  WRITE SetIterations
95  NOTIFY IterationsChanged
96  )
97 
99  public: WorldStats();
100 
102  public: virtual ~WorldStats();
103 
104  // Documentation inherited
105  public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem);
106 
108  public slots: void ProcessMsg();
109 
112  public: Q_INVOKABLE QString RealTimeFactor() const;
113 
116  public: Q_INVOKABLE void SetRealTimeFactor(const QString &_realTimeFactor);
117 
119  signals: void RealTimeFactorChanged();
120 
123  public: Q_INVOKABLE QString SimTime() const;
124 
127  public: Q_INVOKABLE void SetSimTime(const QString &_simTime);
128 
130  signals: void SimTimeChanged();
131 
134  public: Q_INVOKABLE QString RealTime() const;
135 
138  public: Q_INVOKABLE void SetRealTime(const QString &_realTime);
139 
141  signals: void RealTimeChanged();
142 
145  public: Q_INVOKABLE QString Iterations() const;
146 
149  public: Q_INVOKABLE void SetIterations(const QString &_iterations);
150 
152  signals: void IterationsChanged();
153 
155  private: void OnWorldStatsMsg(const gz::msgs::WorldStatistics &_msg);
156 
157  // Private data
158  private: std::unique_ptr<WorldStatsPrivate> dataPtr;
159  };
160 } // namespace gz::gui::plugins
161 
162 #endif // GZ_GUI_PLUGINS_WORLDSTATS_HH_