class EventSignalBase
Clients can connect to the event signal to receive events, or disconnect from the event signal to stop receiving events.
At construction time, connect and disconnect callbacks can be provided that are called when the number of connected clients changes from zero to one or one to zero, respectively.
Members
EventSignalBase
Syntax: public inline EventSignalBase ( );
Constructs an event signal with empty connect and disconnect actions.
~EventSignalBase
Syntax: public inline virtual ~EventSignalBase ( );
Destructor.
RegisterCallback
Syntax: public inline CallbackToken RegisterCallback ( CallbackFunction callback );
Registers a callback to this EventSignalBase and assigns it a unique token.
Parameters
callback
The callback to register.
Returns
The new token associated with this registration that can be used for subsequent unregistration.
UnregisterCallback
Syntax: public inline bool UnregisterCallback ( CallbackToken token );
If present, unregisters a callback from this EventSource associated with the provided token. Tokens are returned from RegisterCallback at the time of registration.
Parameters
token
The token associated with the callback to be removed. This token is provided by the return value of RegisterCallback at the time of registration.
Returns
A value indicating whether any callback was unregistered in response to this request.
operator()
Syntax: public inline void operator() ( T t );
Function call operator. Signals the event with given arguments t to connected clients, see also Signal.
Parameters
t
Event arguments to signal.
UnregisterAllCallbacks
Syntax: public inline void UnregisterAllCallbacks ( );
Unregisters all registered callbacks.
Signal
Syntax: public inline void Signal ( T t );
Signals the event with given arguments t to all connected callbacks.
Parameters
t
Event arguments to signal.
IsConnected
Syntax: public inline bool IsConnected ( ) const;
Checks if a callback is connected.
Returns
true if a callback is connected
m_callbacks
Syntax: protected std::map< CallbackToken, CallbackFunction > m_callbacks;
m_nextCallbackToken
Syntax: protected CallbackToken m_nextCallbackToken;
m_mutex
Syntax: protected mutable std::recursive_mutex m_mutex;
CallbackFunction
Syntax: typedef CallbackFunction;
Callback type that is used for signalling the event to connected clients.
CallbackArgument
Syntax: typedef CallbackArgument;
The argument type for the callback event.
CallbackToken
Syntax: typedef CallbackToken;
A monotonically increasing token used for registration, tracking, and unregistration of callbacks.