MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ subscribe() [2/2]

template<EventHandler Handler>
void Lila::EventBus::subscribe ( EventType  type,
Handler &&  handler 
)
inline

Subscribe to an event type with a handler function.

Template Parameters
HandlerCallable matching EventHandler concept
Parameters
typeEventType to subscribe to
handlerHandler function

Definition at line 200 of file EventBus.hpp.

201 {
202 struct HandlerSubscription : Subscription {
203 Handler m_handler;
204 HandlerSubscription(Handler&& h)
205 : m_handler(std::forward<Handler>(h))
206 {
207 }
208 void on_event(const StreamEvent& event) override { m_handler(event); }
209 };
210
211 subscribe(type, std::make_shared<HandlerSubscription>(std::forward<Handler>(handler)));
212 }
void subscribe(EventType type, const std::shared_ptr< Subscription > &subscriber)
Subscribe to an event type with a Subscription object.
Definition EventBus.cpp:12

References subscribe().

+ Here is the call graph for this function: