SObjectizer  5.5
Public Member Functions | Private Attributes | List of all members
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. More...
 
void prepare ()
 Prepare bunch to use with actual messages. More...
 
bool handle (const std::type_index &msg_type, message_ref_t &message, invocation_type_t invocation) const
 Find handler for a message and execute it. More...
 

Private Attributes

msg_type_and_handler_pair_t m_handlers [N]
 Vector of message handlers. More...
 

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. More...
 
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, invocation_type_t invocation)
 Find and exec message handler. More...
 

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

Constructor & Destructor Documentation

◆ handlers_bunch_t()

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

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.

◆ 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,
invocation_type_t  invocation 
) 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.
invocationIt is async message or service handler?

◆ 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.

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.


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