Lysa  0.0
Lysa 3D Engine
EventSubscriptions Class Reference

Detailed Description

Simplify multiple subscription management. This collection is not thread-safe.

Public Member Functions

 EventSubscriptions () = default
 
 ~EventSubscriptions ()
 
 EventSubscriptions (const EventSubscriptions &) = delete
 
EventSubscriptions & operator= (const EventSubscriptions &) = delete
 
unique_id subscribe (const event_type &type, EventHandlerCallback handler)
 
unique_id subscribe (const event_type &type, unique_id target, EventHandlerCallback handler)
 
unique_id subscribe (const event_type &type, SignalHandlerCallback handler)
 
void unsubscribe (unique_id id)
 
void clear ()
 

Constructor & Destructor Documentation

EventSubscriptions ( )
default

Construct an empty collection without accessing the context.

~EventSubscriptions ( )

Remove all owned subscriptions.

EventSubscriptions ( const EventSubscriptions &  )
delete

Member Function Documentation

void clear ( )

Remove all owned subscriptions

EventSubscriptions& operator= ( const EventSubscriptions &  )
delete
unique_id subscribe ( const event_type &  type,
EventHandlerCallback  handler 
)

Subscribe to queued events

Parameters
typeEvent kind to receive.
handlerCallback owned by the event manager.
Returns
Handler identifier, usable with unsubscribe().
unique_id subscribe ( const event_type &  type,
SignalHandlerCallback  handler 
)

Subscribe to a synchronous signal

Parameters
typeSignal kind to receive.
handlerCallback owned by the signal manager.
Returns
Handler identifier, usable with unsubscribe().
unique_id subscribe ( const event_type &  type,
unique_id  target,
EventHandlerCallback  handler 
)

Subscribe to queued events

Parameters
typeEvent kind to receive.
targetTarget identifier matched against Event::id.
handlerCallback owned by the event manager.
Returns
Handler identifier, usable with unsubscribe().
void unsubscribe ( unique_id  id)

Remove one owned subscription