ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
rad::Dispatcher Class Reference

#include <Dispatcher.hpp>

Public Types

using handler_t = std::function< void(AnyEvent const &)>
 
using token_t = std::unordered_multimap< std::string, handler_t >::iterator
 
using handler_t = std::function< void(AnyEvent const &)>
 
using token_t = std::unordered_multimap< std::string, handler_t >::iterator
 
using handler_t = std::function< void(AnyEvent const &)>
 
using token_t = std::unordered_multimap< std::string, handler_t >::iterator
 

Public Member Functions

 Dispatcher ()=default
 
token_t registerHandler (char const *eventId, handler_t handler)
 
void unregisterHandler (token_t token)
 
void dispatch (AnyEvent const &e) const
 
 Dispatcher ()=default
 
token_t registerHandler (char const *eventId, handler_t handler)
 
void unregisterHandler (token_t token)
 
void dispatch (AnyEvent const &e) const
 
 Dispatcher ()=default
 
token_t registerHandler (char const *eventId, handler_t handler)
 
void unregisterHandler (token_t token)
 
void dispatch (AnyEvent const &e) const
 

Detailed Description

Simple event dispatcher that dispatches event::AnyEvents to registered handlers.

Member Typedef Documentation

using rad::Dispatcher::handler_t = std::function<void(AnyEvent const&)>
using rad::Dispatcher::handler_t = std::function<void(AnyEvent const&)>
using rad::Dispatcher::handler_t = std::function<void(AnyEvent const&)>
using rad::Dispatcher::token_t = std::unordered_multimap<std::string, handler_t>::iterator
using rad::Dispatcher::token_t = std::unordered_multimap<std::string, handler_t>::iterator
using rad::Dispatcher::token_t = std::unordered_multimap<std::string, handler_t>::iterator

Constructor & Destructor Documentation

rad::Dispatcher::Dispatcher ( )
default

Constructor

Note
: We might want to have a dispatch policy to allow dispatching as tasks for concurrent handling.
rad::Dispatcher::Dispatcher ( )
default

Constructor

Note
: We might want to have a dispatch policy to allow dispatching as tasks for concurrent handling.
rad::Dispatcher::Dispatcher ( )
default

Constructor

Note
: We might want to have a dispatch policy to allow dispatching as tasks for concurrent handling.

Member Function Documentation

void rad::Dispatcher::dispatch ( rad::AnyEvent const e) const

Dispatch event to all event handlers registered to e.getId() event id.

Note
: If event handler throws an exception, this will be caught and ignored by dispatch.
void rad::Dispatcher::dispatch ( AnyEvent const e) const

Dispatch event to all event handlers registered to e.getId() event id.

Note
: If event handler throws an exception, this will be caught and ignored by dispatch.
void rad::Dispatcher::dispatch ( AnyEvent const e) const

Dispatch event to all event handlers registered to e.getId() event id.

Note
: If event handler throws an exception, this will be caught and ignored by dispatch.
token_t rad::Dispatcher::registerHandler ( char const eventId,
handler_t  handler 
)

Register event handler for specific event id.

Parameters
[in]eventIdThe event to register the handler for.
Returns
Registration token that can be used to unregister the handler.
token_t rad::Dispatcher::registerHandler ( char const eventId,
handler_t  handler 
)

Register event handler for specific event id.

Parameters
[in]eventIdThe event to register the handler for.
Returns
Registration token that can be used to unregister the handler.
rad::Dispatcher::token_t rad::Dispatcher::registerHandler ( char const eventId,
handler_t  handler 
)

Register event handler for specific event id.

Parameters
[in]eventIdThe event to register the handler for.
Returns
Registration token that can be used to unregister the handler.
void rad::Dispatcher::unregisterHandler ( token_t  token)

Unregister event handler using token received when registering the handler.

void rad::Dispatcher::unregisterHandler ( token_t  token)

Unregister event handler using token received when registering the handler.

void rad::Dispatcher::unregisterHandler ( token_t  token)

Unregister event handler using token received when registering the handler.


The documentation for this class was generated from the following files: