#include "MsgDispatcher.h"
template<typename... TOptions>
class comms::MsgDispatcher< TOptions >
An auxiliary class to force a particular way of dispatching message to its handler.
If not options are provided, the dispatching is performed by invocation of comms::dispatchMsg() function.
- Template Parameters
-
TOptions | Options to force a particular dispatch way. Supported ones are:
|
|
using | MsgDispatcherTag = typename ParsedOptions::ForcedDispatch |
| Class detection tag.
|
|
using | ParsedOptions = ParsedOptionsInternal |
| Parsed Options.
|
|
|
template<typename TAllMessages , typename TMsg , typename THandler > |
static auto | dispatch (TMsg &&msg, THandler &&handler) -> decltype(dispatchInternal< TAllMessages >(msg, handler, Tag())) |
| Dispatch message to its handler.
|
|
template<typename TAllMessages , typename TMsgId , typename TMsg , typename THandler > |
static auto | dispatch (TMsgId &&id, std::size_t idx, TMsg &msg, THandler &handler) -> decltype(dispatchInternal< TAllMessages >(std::forward< TMsgId >(id), idx, msg, handler, Tag())) |
| Dispatch message to its handler.
|
|
template<typename TAllMessages , typename TMsgId , typename TMsg , typename THandler > |
static auto | dispatch (TMsgId &&id, TMsg &&msg, THandler &&handler) -> decltype(dispatchInternal< TAllMessages >(std::forward< TMsgId >(id), msg, handler, Tag())) |
| Dispatch message to its handler.
|
|
template<typename TAllMessages > |
static constexpr bool | isDispatchLinearSwitch () |
| Compile time inquiry whether linear switch dispatch is generated internally to map message ID to actual type.
|
|
template<typename TAllMessages > |
static constexpr bool | isDispatchPolymorphic () |
| Compile time inquiry whether polymorphic dispatch tables are generated internally to map message ID to actual type.
|
|
template<typename TAllMessages > |
static constexpr bool | isDispatchStaticBinSearch () |
| Compile time inquiry whether static binary search dispatch is generated internally to map message ID to actual type.
|
|
|
(Note that these are not member symbols.)
|
template<typename T > |
constexpr bool | isMsgDispatcher () |
| Compile time check whether the provided class is a variant of comms::MsgDispatcher.
|
|
◆ dispatch() [1/3]
template<typename... TOptions>
template<typename TAllMessages , typename TMsg , typename THandler >
static auto comms::MsgDispatcher< TOptions >::dispatch |
( |
TMsg && |
msg, |
|
|
THandler && |
handler |
|
) |
| -> decltype(dispatchInternal<TAllMessages>(msg, handler, Tag()))
|
|
static |
Dispatch message to its handler.
Similar to other dispatch(), but suitable for cases when message interface class provides a way to polymorphically dispatch message object to its handler (see Polymorphic Dispatch Message for Handling) and/or ability to polymorphically retrieve message ID information (see Polymorphic Retrieval of Message ID) as well as requiring messages tuple does NOT contain message classes with the same ID value.
- Template Parameters
-
TAllMessages | Bundle (std::tuple) of all supported message classes |
- Parameters
-
[in] | msg | Reference to message object. |
[in] | handler | Reference to handler objectz |
- Returns
- What the handle() member function(s) of the hander return.
◆ dispatch() [2/3]
template<typename... TOptions>
template<typename TAllMessages , typename TMsgId , typename TMsg , typename THandler >
static auto comms::MsgDispatcher< TOptions >::dispatch |
( |
TMsgId && |
id, |
|
|
std::size_t |
idx, |
|
|
TMsg & |
msg, |
|
|
THandler & |
handler |
|
) |
| -> decltype(dispatchInternal<TAllMessages>(std::forward<TMsgId>(id), idx, msg, handler, Tag()))
|
|
static |
◆ dispatch() [3/3]
template<typename... TOptions>
template<typename TAllMessages , typename TMsgId , typename TMsg , typename THandler >
static auto comms::MsgDispatcher< TOptions >::dispatch |
( |
TMsgId && |
id, |
|
|
TMsg && |
msg, |
|
|
THandler && |
handler |
|
) |
| -> decltype(dispatchInternal<TAllMessages>(std::forward<TMsgId>(id), msg, handler, Tag()))
|
|
static |
Dispatch message to its handler.
Similar to other dispatch(), but suitable for cases when messages tuple does NOT contain message classes with the same ID value.
- Template Parameters
-
TAllMessages | Bundle (std::tuple) of all supported message classes |
- Parameters
-
[in] | id | ID of the message. |
[in] | msg | Reference to message object. |
[in] | handler | Reference to handler object |
- Returns
- What the handle() member function(s) of the hander return.
◆ isDispatchLinearSwitch()
template<typename... TOptions>
template<typename TAllMessages >
◆ isDispatchPolymorphic()
template<typename... TOptions>
template<typename TAllMessages >
◆ isDispatchStaticBinSearch()
template<typename... TOptions>
template<typename TAllMessages >
The documentation for this class was generated from the following file: