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
-
T function event callback function signature N optional additional type to disambiguate events with same function signature
Member Typedef Documentation
◆ CallbackT
using CallbackT = std::function<T> |
Constructor & Destructor Documentation
◆ EventT()
Constructor.
◆ ~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] _subscriber Pointer to a callback function.
- Returns
- A Connection object, which will automatically call Disconnect when it goes out of scope.
- Parameters
-
[in] _subscriber the subscriber to connect.
◆ ConnectionCount()
unsigned int ConnectionCount |
Get the number of connections.
- Returns
- Number of connection to this Event.
- Number of connections.
◆ Disconnect()
|
virtual |
Disconnect a callback to this event.
Removes a connection.
- Parameters
-
[in] _id The id of the connection to disconnect. [in] _id the connection index.
Implements Event.
◆ operator()()
|
inline |
Access the signal.
References EventT< T, N >::Signal().
◆ Signal()
|
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: