All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Events.hh
Go to the documentation of this file.
1 /*
2  * Copyright 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 
22 #include "gazebo/common/Console.hh"
24 #include "gazebo/common/Event.hh"
25 
26 namespace gazebo
27 {
28  namespace event
29  {
32 
35  class Events
36  {
41  public: template<typename T>
42  static ConnectionPtr ConnectPause(T _subscriber)
43  { return pause.Connect(_subscriber); }
44 
47  public: static void DisconnectPause(ConnectionPtr _subscriber)
48  { pause.Disconnect(_subscriber); }
49 
54  public: template<typename T>
55  static ConnectionPtr ConnectStep(T _subscriber)
56  { return step.Connect(_subscriber); }
59  public: static void DisconnectStep(ConnectionPtr _subscriber)
60  { step.Disconnect(_subscriber); }
61 
66  public: template<typename T>
67  static ConnectionPtr ConnectStop(T _subscriber)
68  { return stop.Connect(_subscriber); }
71  public: static void DisconnectStop(ConnectionPtr _subscriber)
72  { stop.Disconnect(_subscriber); }
73 
78  public: template<typename T>
79  static ConnectionPtr ConnectWorldCreated(T _subscriber)
80  { return worldCreated.Connect(_subscriber); }
82  public: static void DisconnectWorldCreated(ConnectionPtr _subscriber)
83  { worldCreated.Disconnect(_subscriber); }
84 
89  public: template<typename T>
90  static ConnectionPtr ConnectCreateEntity(T _subscriber)
91  { return entityCreated.Connect(_subscriber); }
94  public: static void DisconnectCreateEntity(ConnectionPtr _subscriber)
95  { entityCreated.Disconnect(_subscriber); }
96 
101  public: template<typename T>
103  { return setSelectedEntity.Connect(_subscriber); }
106  public: static void DisconnectSetSelectedEntity(ConnectionPtr _subscriber)
107  { setSelectedEntity.Disconnect(_subscriber); }
112  public: template<typename T>
113  static ConnectionPtr ConnectDeleteEntity(T _subscriber)
114  { return deleteEntity.Connect(_subscriber); }
117  public: static void DisconnectDeleteEntity(ConnectionPtr _subscriber)
118  { deleteEntity.Disconnect(_subscriber); }
123  public: template<typename T>
124  static ConnectionPtr ConnectAddEntity(T _subscriber)
125  { return addEntity.Connect(_subscriber); }
128  public: static void DisconnectAddEntity(ConnectionPtr _subscriber)
129  { addEntity.Disconnect(_subscriber); }
130 
131 
136  public: template<typename T>
138  {
139  // Putting in this comment so the deprecation message
140  // will be found easier: GAZEBO_DEPRECATED.
141  gzerr << "Events::ConnectWorldUpdateStart is deprecated "
142  << "in v 1.5.0. Please use "
143  << "Events::ConnectWorldUpdateBegin\n";
144  return worldUpdateStart.Connect(_subscriber);
145  }
146 
149  public: static void DisconnectWorldUpdateStart(ConnectionPtr _subscriber)
151 
156  public: template<typename T>
158  { return worldUpdateBegin.Connect(_subscriber); }
159 
162  public: static void DisconnectWorldUpdateBegin(
163  ConnectionPtr _subscriber);
164 
169  public: template<typename T>
170  static ConnectionPtr ConnectWorldUpdateEnd(T _subscriber)
171  { return worldUpdateEnd.Connect(_subscriber); }
174  public: static void DisconnectWorldUpdateEnd(ConnectionPtr _subscriber)
175  { worldUpdateEnd.Disconnect(_subscriber); }
176 
181  public: template<typename T>
182  static ConnectionPtr ConnectPreRender(T _subscriber)
183  { return preRender.Connect(_subscriber); }
186  public: static void DisconnectPreRender(ConnectionPtr _subscriber)
187  { preRender.Disconnect(_subscriber); }
192  public: template<typename T>
193  static ConnectionPtr ConnectRender(T _subscriber)
194  { return render.Connect(_subscriber); }
197  public: static void DisconnectRender(ConnectionPtr _subscriber)
198  { render.Disconnect(_subscriber); }
203  public: template<typename T>
204  static ConnectionPtr ConnectPostRender(T _subscriber)
205  { return postRender.Connect(_subscriber); }
208  public: static void DisconnectPostRender(ConnectionPtr _subscriber)
209  { postRender.Disconnect(_subscriber); }
214  public: template<typename T>
215  static ConnectionPtr ConnectDiagTimerStart(T _subscriber)
216  { return diagTimerStart.Connect(_subscriber); }
219  public: static void DisconnectDiagTimerStart(ConnectionPtr _subscriber)
220  { diagTimerStart.Disconnect(_subscriber); }
225  public: template<typename T>
226  static ConnectionPtr ConnectDiagTimerStop(T _subscriber)
227  { return diagTimerStop.Connect(_subscriber); }
230  public: static void DisconnectDiagTimerStop(ConnectionPtr _subscriber)
231  { diagTimerStop.Disconnect(_subscriber); }
232 
234  public: static EventT<void (bool)> pause;
235 
237  public: static EventT<void ()> step;
238 
240  public: static EventT<void ()> stop;
241 
244 
247 
250 
253 
256 
259 
262 
265 
267  public: static EventT<void ()> preRender;
268 
270  public: static EventT<void ()> render;
271 
273  public: static EventT<void ()> postRender;
274 
277 
280  };
282  }
283 }
284 #endif