class EventSignal

class EventSignal
  : public EventSignalBase< T >

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

EventSignal

Syntax: public inline EventSignal ( );

Constructs an event signal with empty register and disconnect callbacks.

EventSignal

Syntax: public inline EventSignal ( NotifyCallback_Type connectedAndDisconnected );

Constructor.

Parameters

  • connectedAndDisconnected Callback to invoke if the number of connected clients changes from zero to one, or one to zero

EventSignal

Syntax: public inline EventSignal ( NotifyCallback_Type connected , NotifyCallback_Type disconnected );

Constructor.

Parameters

  • connected Callback to invoke if the number of connected clients changes from zero to one.

  • disconnected Callback to invoke if the number of connected clients changes from one to zero.

operator+=

Syntax: public inline EventSignal< T > & operator+= ( CallbackFunction callback );

Addition assignment operator overload. Connects the provided callback callback to the event signal, see also Connect.

Parameters

  • callback Callback to connect.

Returns

Event signal reference.

operator-=

Syntax: public inline EventSignal< T > & operator-= ( CallbackFunction callback );

Subtraction assignment operator overload. Disconnects the provided callback callback from the event signal, see also Disconnect.

Parameters

  • callback Callback to disconnect.

Returns

Event signal reference.

Connect

Syntax: public inline void Connect ( CallbackFunction callback );

Connects given callback function to the event signal, to be invoked when the event is signalled.

When the number of connected clients changes from zero to one, the connect callback will be called, if provided.

Parameters

  • callback Callback to connect.

Disconnect

Syntax: public inline void Disconnect ( CallbackFunction callback );

Disconnects given callback.

When the number of connected clients changes from one to zero, the disconnect callback will be called, if provided.

Parameters

  • callback Callback function.

DisconnectAll

Syntax: public inline void DisconnectAll ( );

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

CallbackFunction

Syntax: typedef CallbackFunction;

Callback type that is used for signalling the event to connected clients.

CallbackToken

Syntax: typedef CallbackToken;

A monotonically increasing token used for registration, tracking, and unregistration of callbacks.

NotifyCallback_Type

Syntax: typedef NotifyCallback_Type;

Type for callbacks used when any client connects to the signal (the number of connected clients changes from zero to one) or the last client disconnects from the signal (the number of connected clients changes from one to zero).