Events.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 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#include <sdf/sdf.hh>
22
26#include "gazebo/util/system.hh"
27
28namespace gazebo
29{
30 namespace event
31 {
34
37 class GZ_COMMON_VISIBLE Events
38 {
43 public: template<typename T>
44 static ConnectionPtr ConnectPause(T _subscriber)
45 { return pause.Connect(_subscriber); }
46
51 public: template<typename T>
52 static ConnectionPtr ConnectStep(T _subscriber)
53 { return step.Connect(_subscriber); }
54
59 public: template<typename T>
60 static ConnectionPtr ConnectStop(T _subscriber)
61 { return stop.Connect(_subscriber); }
62
67 public: template<typename T>
68 static ConnectionPtr ConnectWorldCreated(T _subscriber)
69 { return worldCreated.Connect(_subscriber); }
70
75 public: template<typename T>
76 static ConnectionPtr ConnectCreateEntity(T _subscriber)
77 { return entityCreated.Connect(_subscriber); }
78
83 public: template<typename T>
85 { return setSelectedEntity.Connect(_subscriber); }
86
91 public: template<typename T>
92 static ConnectionPtr ConnectDeleteEntity(T _subscriber)
93 { return deleteEntity.Connect(_subscriber); }
94
99 public: template<typename T>
100 static ConnectionPtr ConnectAddEntity(T _subscriber)
101 { return addEntity.Connect(_subscriber); }
102
107 public: template<typename T>
109 { return worldUpdateBegin.Connect(_subscriber); }
110
119 public: template<typename T>
121 { return beforePhysicsUpdate.Connect(_subscriber); }
122
127 public: template<typename T>
129 { return worldUpdateEnd.Connect(_subscriber); }
130
135 public: template<typename T>
136 static ConnectionPtr ConnectWorldReset(T _subscriber)
137 { return worldReset.Connect(_subscriber); }
138
143 public: template<typename T>
144 static ConnectionPtr ConnectTimeReset(T _subscriber)
145 { return timeReset.Connect(_subscriber); }
146
151 public: template<typename T>
152 static ConnectionPtr ConnectRemoveSensor(T _subscriber)
153 { return removeSensor.Connect(_subscriber); }
154
159 public: template<typename T>
160 static ConnectionPtr ConnectCreateSensor(T _subscriber)
161 { return createSensor.Connect(_subscriber); }
162
167 public: template<typename T>
169 { return preRenderEnded.Connect(_subscriber); }
170
175 public: template<typename T>
176 static ConnectionPtr ConnectPreRender(T _subscriber)
177 { return preRender.Connect(_subscriber); }
178
183 public: template<typename T>
184 static ConnectionPtr ConnectRender(T _subscriber)
185 { return render.Connect(_subscriber); }
186
191 public: template<typename T>
192 static ConnectionPtr ConnectPostRender(T _subscriber)
193 { return postRender.Connect(_subscriber); }
194
199 public: template<typename T>
201 { return diagTimerStart.Connect(_subscriber); }
202
207 public: template<typename T>
209 { return diagTimerStop.Connect(_subscriber); }
210
215 public: template<typename T>
216 static ConnectionPtr ConnectSigInt(T _subscriber)
217 { return sigInt.Connect(_subscriber); }
218
220 public: static EventT<void (bool)> pause;
221
223 public: static EventT<void ()> step;
224
226 public: static EventT<void ()> stop;
227
229 public: static EventT<void ()> sigInt;
230
232 public: static EventT<void (std::string)> worldCreated;
233
235 public: static EventT<void (std::string)> entityCreated;
236
238 public: static EventT<void (std::string, std::string)> setSelectedEntity;
239
241 public: static EventT<void (std::string)> addEntity;
242
244 public: static EventT<void (std::string)> deleteEntity;
245
247 public: static EventT<void (const common::UpdateInfo &)> worldUpdateBegin;
248
250 public: static EventT<void (const common::UpdateInfo &)>
252
254 public: static EventT<void ()> worldUpdateEnd;
255
257 public: static EventT<void ()> worldReset;
258
260 public: static EventT<void ()> timeReset;
261
263 public: static EventT<void ()> preRender;
264
266 public: static EventT<void ()> preRenderEnded;
267
269 public: static EventT<void ()> render;
270
272 public: static EventT<void ()> postRender;
273
275 public: static EventT<void (std::string)> diagTimerStart;
276
278 public: static EventT<void (std::string)> diagTimerStop;
279
283 public: static EventT<void (std::string)> removeSensor;
284
293 public: static EventT<void (sdf::ElementPtr,
294 const std::string &,
295 const std::string &,
296 const uint32_t)> createSensor;
297 };
299 }
300}
301#endif
Information for use in an update event.
Definition UpdateInfo.hh:31
A class for event processing.
Definition Event.hh:100
An Event class to get notifications for simulator events.
Definition Events.hh:38
static ConnectionPtr ConnectPreRender(T _subscriber)
Render start signal.
Definition Events.hh:176
static ConnectionPtr ConnectWorldUpdateBegin(T _subscriber)
Connect a callback to the world update start signal.
Definition Events.hh:108
static EventT< void(std::string)> worldCreated
A world has been created.
Definition Events.hh:232
static EventT< void(const common::UpdateInfo &)> beforePhysicsUpdate
Collision detection has been done, physics update not yet.
Definition Events.hh:251
static ConnectionPtr ConnectSigInt(T _subscriber)
Connect a callback to the sigint event.
Definition Events.hh:216
static EventT< void()> worldReset
World reset signal.
Definition Events.hh:257
static EventT< void(std::string, std::string)> setSelectedEntity
An entity has been selected.
Definition Events.hh:238
static ConnectionPtr ConnectWorldReset(T _subscriber)
Connect to the world reset signal.
Definition Events.hh:136
static ConnectionPtr ConnectDiagTimerStop(T _subscriber)
Connect a callback to the diagnostic timer stop signal.
Definition Events.hh:208
static ConnectionPtr ConnectCreateSensor(T _subscriber)
Connect to the create sensor signal.
Definition Events.hh:160
static EventT< void(std::string)> diagTimerStop
Diagnostic timer stop.
Definition Events.hh:278
static ConnectionPtr ConnectCreateEntity(T _subscriber)
Connect a callback to the add entity signal.
Definition Events.hh:76
static EventT< void()> postRender
Post-Render.
Definition Events.hh:272
static ConnectionPtr ConnectTimeReset(T _subscriber)
Connect to the time reset signal.
Definition Events.hh:144
static ConnectionPtr ConnectPostRender(T _subscriber)
Connect a callback to the post render update signal.
Definition Events.hh:192
static ConnectionPtr ConnectDiagTimerStart(T _subscriber)
Connect a callback to the diagnostic timer start signal.
Definition Events.hh:200
static ConnectionPtr ConnectDeleteEntity(T _subscriber)
Connect a callback to the delete entity signal.
Definition Events.hh:92
static ConnectionPtr ConnectRender(T _subscriber)
Connect a callback to the render update signal.
Definition Events.hh:184
static EventT< void(std::string)> deleteEntity
An entity has been deleted.
Definition Events.hh:244
static EventT< void(std::string)> diagTimerStart
Diagnostic timer start.
Definition Events.hh:275
static EventT< void()> sigInt
Simulation SIGINT/SIGTERM signal.
Definition Events.hh:229
static EventT< void()> preRender
Pre-render.
Definition Events.hh:263
static EventT< void(std::string)> addEntity
An entity has been added.
Definition Events.hh:241
static EventT< void(bool)> pause
Pause signal.
Definition Events.hh:220
static ConnectionPtr ConnectWorldUpdateEnd(T _subscriber)
Connect a callback to the world update end signal.
Definition Events.hh:128
static EventT< void()> timeReset
Time reset signal.
Definition Events.hh:260
static EventT< void(const common::UpdateInfo &)> worldUpdateBegin
World update has started.
Definition Events.hh:247
static EventT< void()> worldUpdateEnd
World update has ended.
Definition Events.hh:254
static ConnectionPtr ConnectPause(T _subscriber)
Connect a callback to the pause signal.
Definition Events.hh:44
static ConnectionPtr ConnectStep(T _subscriber)
Connect a callback to the step signal.
Definition Events.hh:52
static ConnectionPtr ConnectRemoveSensor(T _subscriber)
Connect to the remove sensor signal.
Definition Events.hh:152
static ConnectionPtr ConnectBeforePhysicsUpdate(T _subscriber)
Connect a callback to the before physics update signal.
Definition Events.hh:120
static ConnectionPtr ConnectAddEntity(T _subscriber)
Connect a callback to the add entity signal.
Definition Events.hh:100
static EventT< void(std::string)> removeSensor
Remove a sensor.
Definition Events.hh:283
static ConnectionPtr ConnectStop(T _subscriber)
Connect a callback to the stop signal.
Definition Events.hh:60
static ConnectionPtr ConnectPreRenderEnded(T _subscriber)
End of prerender phase signal.
Definition Events.hh:168
static ConnectionPtr ConnectSetSelectedEntity(T _subscriber)
Connect a callback to the set selected entity signal.
Definition Events.hh:84
static EventT< void()> preRenderEnded
End of Pre-render.
Definition Events.hh:266
static EventT< void()> render
Render.
Definition Events.hh:269
static EventT< void()> stop
Simulation stop signal.
Definition Events.hh:226
static EventT< void(std::string)> entityCreated
An entity has been created.
Definition Events.hh:235
static EventT< void()> step
Step the simulation once signal.
Definition Events.hh:223
static ConnectionPtr ConnectWorldCreated(T _subscriber)
Connect a callback to the world created signal.
Definition Events.hh:68
static EventT< void(sdf::ElementPtr, const std::string &, const std::string &, const uint32_t)> createSensor
Create a sensor.
Definition Events.hh:296
ConnectionPtr Connect(const std::function< T > &_subscriber)
Connect a callback to this event.
Definition Event.hh:621
boost::shared_ptr< Connection > ConnectionPtr
Definition CommonTypes.hh:134
Forward declarations for the common classes.
Definition Animation.hh:27