qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
qb::router::internal::EventPolicy Class Reference

Base policy for event handling. More...

#include <router.h>

Inheritance diagram for qb::router::internal::EventPolicy:

Protected Member Functions

template<typename _Handler, typename _Event>
void invoke (_Handler &handler, _Event &event) const
 Invoke a handler with an event.
template<typename _Event>
void dispose (_Event &event) const noexcept
 Dispose of an event if necessary.

Detailed Description

Base policy for event handling.

Defines common event handling operations like invocation and disposal.

Member Function Documentation

◆ invoke()

template<typename _Handler, typename _Event>
void qb::router::internal::EventPolicy::invoke ( _Handler & handler,
_Event & event ) const
inlineprotected

Invoke a handler with an event.

If the event type has an is_alive() method, it will be checked before invoking the handler.

Template Parameters
_HandlerHandler type
_EventEvent type
Parameters
handlerThe handler to invoke
eventThe event to pass to the handler

◆ dispose()

template<typename _Event>
void qb::router::internal::EventPolicy::dispose ( _Event & event) const
inlineprotectednoexcept

Dispose of an event if necessary.

If the event type is not trivially destructible and has an is_alive() method, it will be destructed when is_alive() returns false.

Template Parameters
_EventEvent type
Parameters
eventThe event to dispose