Gazebo Sim

API Reference

8.7.0
EventManager Class Reference

The EventManager is used to send/receive notifications of simulator events. More...

#include <EventManager.hh>

Public Member Functions

 EventManager ()=default
 Constructor. More...
 
 EventManager (const EventManager &)=delete
 
 ~EventManager ()=default
 Destructor. More...
 
template<typename E >
gz::common::ConnectionPtr Connect (const typename E::CallbackT &_subscriber)
 Add a connection to an event. More...
 
template<typename E >
unsigned int ConnectionCount ()
 Get connection count for a particular event Connection count for the event. More...
 
template<typename E , typename ... Args>
void Emit (Args &&... _args)
 Emit an event signal to connected subscribers. More...
 
EventManageroperator= (const EventManager &)=delete
 

Detailed Description

The EventManager is used to send/receive notifications of simulator events.

The simulator environment and corresponding systems can either connect to an Event or emit an Event as needed to signal actions that need to occur.

See events for a complete list of events. TODO: if visibility is added here the MSVC is unable to compile it. The use of smart pointer inside the unordered_map (events method) is the cause of it. Maybe a compiler bug?

Constructor & Destructor Documentation

◆ EventManager() [1/2]

EventManager ( )
default

Constructor.

◆ EventManager() [2/2]

EventManager ( const EventManager )
delete

◆ ~EventManager()

~EventManager ( )
default

Destructor.

Member Function Documentation

◆ Connect()

gz::common::ConnectionPtr Connect ( const typename E::CallbackT &  _subscriber)
inline

Add a connection to an event.

Parameters
[in]_subscriberA std::function callback function. The function signature must match that of the event (template parameter E).
Returns
A Connection pointer, which will automatically call Disconnect when it goes out of scope.

References std::endl(), and gzerr.

◆ ConnectionCount()

unsigned int ConnectionCount ( )
inline

Get connection count for a particular event Connection count for the event.

References std::endl(), and gzerr.

◆ Emit()

void Emit ( Args &&...  _args)
inline

Emit an event signal to connected subscribers.

Parameters
[in]_argsfunction arguments to be passed to the event callbacks. Must match the signature of the event type E.

References std::endl(), and gzerr.

◆ operator=()

EventManager& operator= ( const EventManager )
delete

The documentation for this class was generated from the following file: