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 
23 #include "gazebo/common/Console.hh"
25 #include "gazebo/common/Event.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace 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>
128  static ConnectionPtr ConnectWorldUpdateEnd(T _subscriber)
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>
168  static ConnectionPtr ConnectPreRender(T _subscriber)
169  { return preRender.Connect(_subscriber); }
170 
175  public: template<typename T>
176  static ConnectionPtr ConnectRender(T _subscriber)
177  { return render.Connect(_subscriber); }
178 
183  public: template<typename T>
184  static ConnectionPtr ConnectPostRender(T _subscriber)
185  { return postRender.Connect(_subscriber); }
186 
191  public: template<typename T>
192  static ConnectionPtr ConnectDiagTimerStart(T _subscriber)
193  { return diagTimerStart.Connect(_subscriber); }
194 
199  public: template<typename T>
200  static ConnectionPtr ConnectDiagTimerStop(T _subscriber)
201  { return diagTimerStop.Connect(_subscriber); }
202 
207  public: template<typename T>
208  static ConnectionPtr ConnectSigInt(T _subscriber)
209  { return sigInt.Connect(_subscriber); }
210 
212  public: static EventT<void (bool)> pause;
213 
215  public: static EventT<void ()> step;
216 
218  public: static EventT<void ()> stop;
219 
221  public: static EventT<void ()> sigInt;
222 
225 
228 
231 
234 
237 
240 
244 
247 
249  public: static EventT<void ()> worldReset;
250 
252  public: static EventT<void ()> timeReset;
253 
255  public: static EventT<void ()> preRender;
256 
258  public: static EventT<void ()> render;
259 
261  public: static EventT<void ()> postRender;
262 
265 
268 
273 
282  public: static EventT<void (sdf::ElementPtr,
283  const std::string &,
284  const std::string &,
285  const uint32_t)> createSensor;
286  };
288  }
289 }
290 #endif
static ConnectionPtr ConnectSigInt(T _subscriber)
Connect a callback to the sigint event.
Definition: Events.hh:208
static EventT< void(std::string, std::string)> setSelectedEntity
An entity has been selected.
Definition: Events.hh:230
static ConnectionPtr ConnectBeforePhysicsUpdate(T _subscriber)
Connect a callback to the before physics update signal.
Definition: Events.hh:120
static ConnectionPtr ConnectStop(T _subscriber)
Connect a callback to the stop signal.
Definition: Events.hh:60
Forward declarations for the common classes.
Definition: Animation.hh:26
An Event class to get notifications for simulator events.
Definition: Events.hh:37
static ConnectionPtr ConnectWorldUpdateBegin(T _subscriber)
Connect a callback to the world update start signal.
Definition: Events.hh:108
static ConnectionPtr ConnectCreateSensor(T _subscriber)
Connect to the create sensor signal.
Definition: Events.hh:160
static ConnectionPtr ConnectTimeReset(T _subscriber)
Connect to the time reset signal.
Definition: Events.hh:144
static ConnectionPtr ConnectWorldReset(T _subscriber)
Connect to the world reset signal.
Definition: Events.hh:136
static EventT< void()> worldUpdateEnd
World update has ended.
Definition: Events.hh:246
static EventT< void(const common::UpdateInfo &)> worldUpdateBegin
World update has started.
Definition: Events.hh:239
static EventT< void(const common::UpdateInfo &)> beforePhysicsUpdate
Collision detection has been done, physics update not yet.
Definition: Events.hh:243
static ConnectionPtr ConnectWorldUpdateEnd(T _subscriber)
Connect a callback to the world update end signal.
Definition: Events.hh:128
static ConnectionPtr ConnectPreRender(T _subscriber)
Render start signal.
Definition: Events.hh:168
static EventT< void()> timeReset
Time reset signal.
Definition: Events.hh:252
static EventT< void(std::string)> diagTimerStart
Diagnostic timer start.
Definition: Events.hh:264
static ConnectionPtr ConnectRemoveSensor(T _subscriber)
Connect to the remove sensor signal.
Definition: Events.hh:152
static ConnectionPtr ConnectPause(T _subscriber)
Connect a callback to the pause signal.
Definition: Events.hh:44
static ConnectionPtr ConnectDiagTimerStop(T _subscriber)
Connect a callback to the diagnostic timer stop signal.
Definition: Events.hh:200
static EventT< void(std::string)> deleteEntity
An entity has been deleted.
Definition: Events.hh:236
static ConnectionPtr ConnectRender(T _subscriber)
Connect a callback to the render update signal.
Definition: Events.hh:176
static EventT< void(bool)> pause
Pause signal.
Definition: Events.hh:212
static ConnectionPtr ConnectDiagTimerStart(T _subscriber)
Connect a callback to the diagnostic timer start signal.
Definition: Events.hh:192
static EventT< void(sdf::ElementPtr, const std::string &, const std::string &, const uint32_t)> createSensor
Create a sensor.
Definition: Events.hh:285
static EventT< void()> preRender
Pre-render.
Definition: Events.hh:255
static EventT< void()> stop
Simulation stop signal.
Definition: Events.hh:218
static EventT< void(std::string)> addEntity
An entity has been added.
Definition: Events.hh:233
static EventT< void()> sigInt
Simulation SIGINT/SIGTERM signal.
Definition: Events.hh:221
static ConnectionPtr ConnectPostRender(T _subscriber)
Connect a callback to the post render update signal.
Definition: Events.hh:184
static ConnectionPtr ConnectWorldCreated(T _subscriber)
Connect a callback to the world created signal.
Definition: Events.hh:68
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
static EventT< void()> render
Render.
Definition: Events.hh:258
static EventT< void()> step
Step the simulation once signal.
Definition: Events.hh:215
static EventT< void(std::string)> entityCreated
An entity has been created.
Definition: Events.hh:227
static ConnectionPtr ConnectDeleteEntity(T _subscriber)
Connect a callback to the delete entity signal.
Definition: Events.hh:92
static ConnectionPtr ConnectSetSelectedEntity(T _subscriber)
Connect a callback to the set selected entity signal.
Definition: Events.hh:84
static ConnectionPtr ConnectAddEntity(T _subscriber)
Connect a callback to the add entity signal.
Definition: Events.hh:100
static EventT< void()> worldReset
World reset signal.
Definition: Events.hh:249
static EventT< void(std::string)> removeSensor
Remove a sensor.
Definition: Events.hh:272
static EventT< void(std::string)> diagTimerStop
Diagnostic timer stop.
Definition: Events.hh:267
static ConnectionPtr ConnectStep(T _subscriber)
Connect a callback to the step signal.
Definition: Events.hh:52
static EventT< void(std::string)> worldCreated
A world has been created.
Definition: Events.hh:224
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:261