Ignition Common

API Reference

4.5.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 (const 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 ignition::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()

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.

References map< K, T >::empty(), and map< K, T >::rbegin().

◆ ConnectionCount()

unsigned int ConnectionCount ( ) const

Get the number of connections.

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

References map< K, T >::size().

◆ 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.

References map< K, T >::end(), map< K, T >::erase(), map< K, T >::find(), and list< T >::push_back().

◆ operator()()

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

Access the signal.

◆ Signal()

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

Signal the event for all subscribers.


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