A message wrapped to be used as type of argument for event handlers.
More...
#include <event_data.hpp>
template<typename M>
class so_5::mhood_t< M >
A message wrapped to be used as type of argument for event handlers.
- Since
- v.5.5.14
- Template Parameters
-
M | type of message or signal. |
- Note
- This class provides different sets of methods in dependency of type M. If M is a type derived from so_5::message_t, then there will be the following methods for immutable message M:
const M * get() const;
const M * operator->() const;
const M & operator*() const;
If M is a type derived from so_5::signal_t, then there will no be methods at all. It is because there is no actual message object for a signal. If M is user-type message then there will be the following methods for immutable message M: const M * get() const;
const M * operator->() const;
const M & operator*() const;
For mutable message M there will be the following methods is M is derived from so_5::message_t: M * get();
M * operator->();
M & operator*();
If mutable message M is not derived from so_5::message_t then there will be the following methods: M * get();
M * operator->();
M & operator*();
- Attention
- Method make_reference for mhood_t<mutable_msg<M>> will leave mhood object in nullptr state. It means that mhood must not be used after calling make_reference().
- Note
- Class mhood_t can be used for redirection of messages of user types. For example (since v.5.5.19):
{
...
void some_event( mhood_t< std::string > evt ) {
}
};
If mhood_t<mutable_msg<M>> is used then a redirection must be done this way: {
...
void some_event(
mhood_t< mutable_msg<std::string> > evt ) {
}
};
- Examples:
- so_5/make_pipeline/main.cpp, so_5/mchain_handler_formats/main.cpp, and so_5/wrapped_env_demo_3/main.cpp.
◆ base_type_t
◆ mhood_t()
The documentation for this class was generated from the following file: