All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Events.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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 ConnectPreRender(T _subscriber)
163  { return preRender.Connect(_subscriber); }
166  public: static void DisconnectPreRender(ConnectionPtr _subscriber)
167  { preRender.Disconnect(_subscriber); }
172  public: template<typename T>
173  static ConnectionPtr ConnectRender(T _subscriber)
174  { return render.Connect(_subscriber); }
177  public: static void DisconnectRender(ConnectionPtr _subscriber)
178  { render.Disconnect(_subscriber); }
183  public: template<typename T>
184  static ConnectionPtr ConnectPostRender(T _subscriber)
185  { return postRender.Connect(_subscriber); }
188  public: static void DisconnectPostRender(ConnectionPtr _subscriber)
189  { postRender.Disconnect(_subscriber); }
194  public: template<typename T>
195  static ConnectionPtr ConnectDiagTimerStart(T _subscriber)
196  { return diagTimerStart.Connect(_subscriber); }
199  public: static void DisconnectDiagTimerStart(ConnectionPtr _subscriber)
200  { diagTimerStart.Disconnect(_subscriber); }
205  public: template<typename T>
206  static ConnectionPtr ConnectDiagTimerStop(T _subscriber)
207  { return diagTimerStop.Connect(_subscriber); }
210  public: static void DisconnectDiagTimerStop(ConnectionPtr _subscriber)
211  { diagTimerStop.Disconnect(_subscriber); }
212 
217  public: template<typename T>
218  static ConnectionPtr ConnectSigInt(T _subscriber)
219  { return sigInt.Connect(_subscriber); }
222  public: static void DisconnectSigInt(ConnectionPtr _subscriber)
223  { sigInt.Disconnect(_subscriber); }
224 
226  public: static EventT<void (bool)> pause;
227 
229  public: static EventT<void ()> step;
230 
232  public: static EventT<void ()> stop;
233 
235  public: static EventT<void ()> sigInt;
236 
239 
242 
245 
248 
251 
254 
257 
259  public: static EventT<void ()> preRender;
260 
262  public: static EventT<void ()> render;
263 
265  public: static EventT<void ()> postRender;
266 
269 
272  };
274  }
275 }
276 #endif
static ConnectionPtr ConnectPreRender(T _subscriber)
Render start signal.
Definition: Events.hh:162
static EventT< void(std::string)> deleteEntity
An entity has been deleted.
Definition: Events.hh:250
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:271
static EventT< void()> stop
Simulation stop signal.
Definition: Events.hh:232
static void DisconnectDiagTimerStop(ConnectionPtr _subscriber)
Disconnect a boost::slot the diagnostic timer stop signal.
Definition: Events.hh:210
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:256
static void DisconnectSigInt(ConnectionPtr _subscriber)
Disconnect a boost::slot to the sigint event.
Definition: Events.hh:222
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:268
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:238
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:206
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:199
static ConnectionPtr ConnectRender(T _subscriber)
Connect a boost::slot the render update signal.
Definition: Events.hh:173
static EventT< void()> postRender
Post-Render.
Definition: Events.hh:265
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:244
static void DisconnectPostRender(ConnectionPtr _subscriber)
Disconnect a boost::slot the post render update signal.
Definition: Events.hh:188
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:229
static EventT< void(bool)> pause
Pause signal.
Definition: Events.hh:226
static ConnectionPtr ConnectPostRender(T _subscriber)
Connect a boost::slot the post render update signal.
Definition: Events.hh:184
static ConnectionPtr ConnectSigInt(T _subscriber)
Connect a boost::slot to the sigint event.
Definition: Events.hh:218
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:253
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:235
static EventT< void()> render
Render.
Definition: Events.hh:262
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:259
static ConnectionPtr ConnectDiagTimerStart(T _subscriber)
Connect a boost::slot the diagnostic timer start signal.
Definition: Events.hh:195
static EventT< void(std::string)> addEntity
An entity has been added.
Definition: Events.hh:247
GAZEBO_VISIBLE void stop()
static void DisconnectRender(ConnectionPtr _subscriber)
Disconnect a boost::slot the render update signal.
Definition: Events.hh:177
static void DisconnectPreRender(ConnectionPtr _subscriber)
Disconnect a render start signal.
Definition: Events.hh:166
static ConnectionPtr ConnectCreateEntity(T _subscriber)
Connect a boost::slot the the add entity signal.
Definition: Events.hh:91
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:241
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