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. | |
virtual | ~EventT () |
Destructor. | |
ConnectionPtr | Connect (const CallbackT &_subscriber) |
Connect a callback to this event. | |
unsigned int | ConnectionCount () const |
Get the number of connections. | |
virtual void | Disconnect (int _id) |
Disconnect a callback to this event. | |
template<typename ... Args> | |
void | operator() (Args &&... args) |
Access the signal. | |
template<typename ... Args> | |
void | Signal (Args &&... args) |
Signal the event for all subscribers. | |
Public Member Functions inherited from Event | |
Event () | |
Constructor. | |
virtual | ~Event () |
Destructor. | |
void | SetSignaled (bool _sig) |
Set whether this event has been signaled. | |
bool | Signaled () const |
Get whether this event has been signaled. | |
Detailed Description
template<typename T, typename N = void>
class gz::common::EventT< T, N >
class gz::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
template<typename T , typename N = void>
using CallbackT = std::function<T> |
Constructor & Destructor Documentation
◆ EventT()
template<typename T , typename N >
EventT | ( | ) |
Constructor.
◆ ~EventT()
template<typename T , typename N >
|
virtual |
Destructor.
Destructor. Deletes all the associated connections.
Member Function Documentation
◆ Connect()
template<typename T , typename N >
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()
template<typename T , typename N >
unsigned int ConnectionCount | ( | ) | const |
Get the number of connections.
- Returns
- Number of connection to this Event.
- Number of connections.
◆ Disconnect()
template<typename T , typename N >
|
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()()
template<typename T , typename N = void>
template<typename ... Args>
|
inline |
Access the signal.
References EventT< T, N >::Signal().
◆ Signal()
template<typename T , typename N = void>
template<typename ... 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: