SObjectizer 5.8
Loading...
Searching...
No Matches
so_5::details::handlers_bunch_t< N > Class Template Reference

Template class for storing bunch of message handlers. More...

#include <handler_makers.hpp>

Inheritance diagram for so_5::details::handlers_bunch_t< N >:
so_5::details::handlers_bunch_basics_t

Public Member Functions

 handlers_bunch_t ()
 
void add_handler (std::size_t index, msg_type_and_handler_pair_t &&handler)
 Add another handler to the specified index.
 
void prepare ()
 Prepare bunch to use with actual messages.
 
bool handle (const std::type_index &msg_type, message_ref_t &message) const
 Find handler for a message and execute it.
 

Private Attributes

msg_type_and_handler_pair_t m_handlers [N]
 Vector of message handlers.
 

Additional Inherited Members

- Static Private Member Functions inherited from so_5::details::handlers_bunch_basics_t
static void prepare_handlers (msg_type_and_handler_pair_t *left, msg_type_and_handler_pair_t *right)
 Preparation of message handlers vector.
 
static SO_5_FUNC bool find_and_use_handler (const msg_type_and_handler_pair_t *left, const msg_type_and_handler_pair_t *right, const std::type_index &msg_type, message_ref_t &message)
 Find and exec message handler.
 

Detailed Description

template<std::size_t N>
class so_5::details::handlers_bunch_t< N >

Template class for storing bunch of message handlers.

Since
v.5.5.13

Definition at line 472 of file handler_makers.hpp.

Constructor & Destructor Documentation

◆ handlers_bunch_t()

template<std::size_t N>
so_5::details::handlers_bunch_t< N >::handlers_bunch_t ( )
inline

Definition at line 481 of file handler_makers.hpp.

Member Function Documentation

◆ add_handler()

template<std::size_t N>
void so_5::details::handlers_bunch_t< N >::add_handler ( std::size_t index,
msg_type_and_handler_pair_t && handler )
inline

Add another handler to the specified index.

Parameters
indexIndex for new handler.
handlerMessage handler to be added.

Definition at line 486 of file handler_makers.hpp.

◆ handle()

template<std::size_t N>
bool so_5::details::handlers_bunch_t< N >::handle ( const std::type_index & msg_type,
message_ref_t & message ) const
inline

Find handler for a message and execute it.

Return values
trueif handler was found.
falseif handler was not found.
Parameters
msg_typeType of a message or signal.
messageMessage instance to be processed.

Definition at line 512 of file handler_makers.hpp.

◆ prepare()

template<std::size_t N>
void so_5::details::handlers_bunch_t< N >::prepare ( )
inline

Prepare bunch to use with actual messages.

Note
This method must be called only after all handlers are stored in m_handlers vector.

Definition at line 501 of file handler_makers.hpp.

Member Data Documentation

◆ m_handlers

template<std::size_t N>
msg_type_and_handler_pair_t so_5::details::handlers_bunch_t< N >::m_handlers[N]
private

Vector of message handlers.

Will be ordered by msg_type after invoking prepare() method.

Definition at line 478 of file handler_makers.hpp.


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