Gazebo Common

API Reference

5.6.0
EventT< T, N > Class Template Reference

A class for event processing. More...

#include <Event.hh>

Public Types

using CallbackT = std::function< T >
 

Public Member Functions

 EventT ()
 Constructor. More...
 
virtual ~EventT ()
 Destructor. More...
 
ConnectionPtr Connect (const CallbackT &_subscriber)
 Connect a callback to this event. More...
 
unsigned int ConnectionCount () const
 Get the number of connections. More...
 
virtual void Disconnect (int _id)
 Disconnect a callback to this event. More...
 
template<typename ... Args>
void operator() (Args &&... args)
 Access the signal. More...
 
template<typename ... Args>
void Signal (Args &&... args)
 Signal the event for all subscribers. More...
 
- Public Member Functions inherited from Event
 Event ()
 Constructor. More...
 
virtual ~Event ()
 Destructor. More...
 
void SetSignaled (bool _sig)
 Set whether this event has been signaled. More...
 
bool Signaled () const
 Get whether this event has been signaled. More...
 

Detailed Description

template<typename T, typename N = void>
class gz::common::EventT< T, N >

A class for event processing.

Template Parameters
Tfunction event callback function signature
Noptional additional type to disambiguate events with same function signature

Member Typedef Documentation

◆ CallbackT

Constructor & Destructor Documentation

◆ EventT()

Constructor.

◆ ~EventT()

~EventT
virtual

Destructor.

Destructor. Deletes all the associated connections.

Member Function Documentation

◆ Connect()

ConnectionPtr Connect ( const CallbackT _subscriber)

Connect a callback to this event.

Adds a connection.

Parameters
[in]_subscriberPointer to a callback function.
Returns
A Connection object, which will automatically call Disconnect when it goes out of scope.
Parameters
[in]_subscriberthe subscriber to connect.

◆ ConnectionCount()

unsigned int ConnectionCount

Get the number of connections.

Returns
Number of connection to this Event.
Number of connections.

◆ Disconnect()

void Disconnect ( int  _id)
virtual

Disconnect a callback to this event.

Removes a connection.

Parameters
[in]_idThe id of the connection to disconnect.
[in]_idthe connection index.

Implements Event.

◆ operator()()

void operator() ( Args &&...  args)
inline

Access the signal.

References EventT< T, N >::Signal().

◆ Signal()

void Signal ( Args &&...  args)
inline

Signal the event for all subscribers.

References Event::SetSignaled().

Referenced by EventT< T, N >::operator()().


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