Events.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 #ifndef _EVENTS_HH_
18 #define _EVENTS_HH_
19 
20 #include <string>
21 
22 #include "gazebo/common/Console.hh"
24 #include "gazebo/common/Event.hh"
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace event
30  {
33 
37  {
42  public: template<typename T>
43  static ConnectionPtr ConnectPause(T _subscriber)
44  { return pause.Connect(_subscriber); }
45 
48  public: static void DisconnectPause(ConnectionPtr _subscriber)
49  { pause.Disconnect(_subscriber); }
50 
55  public: template<typename T>
56  static ConnectionPtr ConnectStep(T _subscriber)
57  { return step.Connect(_subscriber); }
60  public: static void DisconnectStep(ConnectionPtr _subscriber)
61  { step.Disconnect(_subscriber); }
62 
67  public: template<typename T>
68  static ConnectionPtr ConnectStop(T _subscriber)
69  { return stop.Connect(_subscriber); }
72  public: static void DisconnectStop(ConnectionPtr _subscriber)
73  { stop.Disconnect(_subscriber); }
74 
79  public: template<typename T>
80  static ConnectionPtr ConnectWorldCreated(T _subscriber)
81  { return worldCreated.Connect(_subscriber); }
83  public: static void DisconnectWorldCreated(ConnectionPtr _subscriber)
84  { worldCreated.Disconnect(_subscriber); }
85 
90  public: template<typename T>
91  static ConnectionPtr ConnectCreateEntity(T _subscriber)
92  { return entityCreated.Connect(_subscriber); }
95  public: static void DisconnectCreateEntity(ConnectionPtr _subscriber)
96  { entityCreated.Disconnect(_subscriber); }
97 
102  public: template<typename T>
104  { return setSelectedEntity.Connect(_subscriber); }
107  public: static void DisconnectSetSelectedEntity(ConnectionPtr _subscriber)
108  { setSelectedEntity.Disconnect(_subscriber); }
113  public: template<typename T>
114  static ConnectionPtr ConnectDeleteEntity(T _subscriber)
115  { return deleteEntity.Connect(_subscriber); }
118  public: static void DisconnectDeleteEntity(ConnectionPtr _subscriber)
119  { deleteEntity.Disconnect(_subscriber); }
124  public: template<typename T>
125  static ConnectionPtr ConnectAddEntity(T _subscriber)
126  { return addEntity.Connect(_subscriber); }
129  public: static void DisconnectAddEntity(ConnectionPtr _subscriber)
130  { addEntity.Disconnect(_subscriber); }
131 
136  public: template<typename T>
138  { return worldUpdateBegin.Connect(_subscriber); }
139 
142  public: static void DisconnectWorldUpdateBegin(
143  ConnectionPtr _subscriber);
144 
149  public: template<typename T>
150  static ConnectionPtr ConnectWorldUpdateEnd(T _subscriber)
151  { return worldUpdateEnd.Connect(_subscriber); }
154  public: static void DisconnectWorldUpdateEnd(ConnectionPtr _subscriber)
155  { worldUpdateEnd.Disconnect(_subscriber); }
156 
161  public: template<typename T>
162  static ConnectionPtr ConnectWorldReset(T _subscriber)
163  { return worldReset.Connect(_subscriber); }
164 
167  public: static void DisconnectWorldReset(ConnectionPtr _subscriber)
168  { worldReset.Disconnect(_subscriber); }
169 
174  public: template<typename T>
175  static ConnectionPtr ConnectPreRender(T _subscriber)
176  { return preRender.Connect(_subscriber); }
179  public: static void DisconnectPreRender(ConnectionPtr _subscriber)
180  { preRender.Disconnect(_subscriber); }
185  public: template<typename T>
186  static ConnectionPtr ConnectRender(T _subscriber)
187  { return render.Connect(_subscriber); }
190  public: static void DisconnectRender(ConnectionPtr _subscriber)
191  { render.Disconnect(_subscriber); }
196  public: template<typename T>
197  static ConnectionPtr ConnectPostRender(T _subscriber)
198  { return postRender.Connect(_subscriber); }
201  public: static void DisconnectPostRender(ConnectionPtr _subscriber)
202  { postRender.Disconnect(_subscriber); }
207  public: template<typename T>
208  static ConnectionPtr ConnectDiagTimerStart(T _subscriber)
209  { return diagTimerStart.Connect(_subscriber); }
212  public: static void DisconnectDiagTimerStart(ConnectionPtr _subscriber)
213  { diagTimerStart.Disconnect(_subscriber); }
218  public: template<typename T>
219  static ConnectionPtr ConnectDiagTimerStop(T _subscriber)
220  { return diagTimerStop.Connect(_subscriber); }
223  public: static void DisconnectDiagTimerStop(ConnectionPtr _subscriber)
224  { diagTimerStop.Disconnect(_subscriber); }
225 
230  public: template<typename T>
231  static ConnectionPtr ConnectSigInt(T _subscriber)
232  { return sigInt.Connect(_subscriber); }
235  public: static void DisconnectSigInt(ConnectionPtr _subscriber)
236  { sigInt.Disconnect(_subscriber); }
237 
239  public: static EventT<void (bool)> pause;
240 
242  public: static EventT<void ()> step;
243 
245  public: static EventT<void ()> stop;
246 
248  public: static EventT<void ()> sigInt;
249 
252 
255 
258 
261 
264 
267 
270 
272  public: static EventT<void ()> worldReset;
273 
275  public: static EventT<void ()> preRender;
276 
278  public: static EventT<void ()> render;
279 
281  public: static EventT<void ()> postRender;
282 
285 
288  };
290  }
291 }
292 #endif
static ConnectionPtr ConnectPreRender(T _subscriber)
Render start signal.
Definition: Events.hh:175
static EventT< void(std::string)> deleteEntity
An entity has been deleted.
Definition: Events.hh:263
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:144
static void DisconnectPause(ConnectionPtr _subscriber)
Disconnect a boost::slot the the pause signal.
Definition: Events.hh:48
static EventT< void(std::string)> diagTimerStop
Diagnostic timer stop.
Definition: Events.hh:287
static EventT< void()> stop
Simulation stop signal.
Definition: Events.hh:245
static void DisconnectDiagTimerStop(ConnectionPtr _subscriber)
Disconnect a boost::slot the diagnostic timer stop signal.
Definition: Events.hh:223
An Event class to get notifications for simulator events.
Definition: Events.hh:36
static ConnectionPtr ConnectAddEntity(T _subscriber)
Connect a boost::slot the the add entity signal.
Definition: Events.hh:125
static EventT< void()> worldUpdateEnd
World update has ended.
Definition: Events.hh:269
static void DisconnectSigInt(ConnectionPtr _subscriber)
Disconnect a boost::slot to the sigint event.
Definition: Events.hh:235
static void DisconnectStop(ConnectionPtr _subscriber)
Disconnect a boost::slot the the stop signal.
Definition: Events.hh:72
static ConnectionPtr ConnectWorldCreated(T _subscriber)
Connect a boost::slot the the world created signal.
Definition: Events.hh:80
static void DisconnectDeleteEntity(ConnectionPtr _subscriber)
Disconnect a boost::slot the delete entity.
Definition: Events.hh:118
static EventT< void(std::string)> diagTimerStart
Diagnostic timer start.
Definition: Events.hh:284
static ConnectionPtr ConnectStop(T _subscriber)
Connect a boost::slot the the stop signal.
Definition: Events.hh:68
static ConnectionPtr ConnectStep(T _subscriber)
Connect a boost::slot the the step signal.
Definition: Events.hh:56
static EventT< void(std::string)> worldCreated
A world has been created.
Definition: Events.hh:251
static ConnectionPtr ConnectDeleteEntity(T _subscriber)
Connect a boost::slot the delete entity.
Definition: Events.hh:114
static ConnectionPtr ConnectDiagTimerStop(T _subscriber)
Connect a boost::slot the diagnostic timer stop signal.
Definition: Events.hh:219
static void DisconnectStep(ConnectionPtr _subscriber)
Disconnect a boost::slot the the step signal.
Definition: Events.hh:60
static void DisconnectDiagTimerStart(ConnectionPtr _subscriber)
Disconnect a boost::slot the diagnostic timer start signal.
Definition: Events.hh:212
static ConnectionPtr ConnectRender(T _subscriber)
Connect a boost::slot the render update signal.
Definition: Events.hh:186
static EventT< void()> postRender
Post-Render.
Definition: Events.hh:281
static void DisconnectWorldReset(ConnectionPtr _subscriber)
Disconnect from the world reset signal.
Definition: Events.hh:167
static ConnectionPtr ConnectWorldUpdateBegin(T _subscriber)
Connect a boost::slot the the world update start signal.
Definition: Events.hh:137
static EventT< void(std::string, std::string)> setSelectedEntity
An entity has been selected.
Definition: Events.hh:257
static ConnectionPtr ConnectWorldReset(T _subscriber)
Connect to the the world reset signal.
Definition: Events.hh:162
static void DisconnectPostRender(ConnectionPtr _subscriber)
Disconnect a boost::slot the post render update signal.
Definition: Events.hh:201
static void DisconnectCreateEntity(ConnectionPtr _subscriber)
Disconnect a boost::slot the the add entity signal.
Definition: Events.hh:95
static EventT< void()> step
Step the simulation once signal.
Definition: Events.hh:242
static EventT< void(bool)> pause
Pause signal.
Definition: Events.hh:239
static ConnectionPtr ConnectPostRender(T _subscriber)
Connect a boost::slot the post render update signal.
Definition: Events.hh:197
static ConnectionPtr ConnectSigInt(T _subscriber)
Connect a boost::slot to the sigint event.
Definition: Events.hh:231
static ConnectionPtr ConnectSetSelectedEntity(T _subscriber)
Connect a boost::slot the set selected entity.
Definition: Events.hh:103
static EventT< void(const common::UpdateInfo &)> worldUpdateBegin
World update has started.
Definition: Events.hh:266
static void DisconnectWorldCreated(ConnectionPtr _subscriber)
Disconnect a boost::slot the the world created signal.
Definition: Events.hh:83
static EventT< void()> sigInt
Simulation stop signal.
Definition: Events.hh:248
static EventT< void()> render
Render.
Definition: Events.hh:278
static void DisconnectWorldUpdateEnd(ConnectionPtr _subscriber)
Disconnect a boost::slot the the world update end signal.
Definition: Events.hh:154
static EventT< void()> preRender
Pre-render.
Definition: Events.hh:275
static ConnectionPtr ConnectDiagTimerStart(T _subscriber)
Connect a boost::slot the diagnostic timer start signal.
Definition: Events.hh:208
static EventT< void(std::string)> addEntity
An entity has been added.
Definition: Events.hh:260
GAZEBO_VISIBLE void stop()
static void DisconnectRender(ConnectionPtr _subscriber)
Disconnect a boost::slot the render update signal.
Definition: Events.hh:190
static void DisconnectPreRender(ConnectionPtr _subscriber)
Disconnect a render start signal.
Definition: Events.hh:179
static ConnectionPtr ConnectCreateEntity(T _subscriber)
Connect a boost::slot the the add entity signal.
Definition: Events.hh:91
static EventT< void()> worldReset
World reset signal.
Definition: Events.hh:272
static ConnectionPtr ConnectWorldUpdateEnd(T _subscriber)
Connect a boost::slot the the world update end signal.
Definition: Events.hh:150
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
static void DisconnectSetSelectedEntity(ConnectionPtr _subscriber)
Disconnect a boost::slot the set selected entity.
Definition: Events.hh:107
static EventT< void(std::string)> entityCreated
An entity has been created.
Definition: Events.hh:254
static void DisconnectAddEntity(ConnectionPtr _subscriber)
Disconnect a boost::slot the the add entity signal.
Definition: Events.hh:129
static ConnectionPtr ConnectPause(T _subscriber)
Connect a boost::slot the the pause signal.
Definition: Events.hh:43