SObjectizer  5.5
Public Member Functions | Private Types | List of all members
so_5::mhood_t< M > Class Template Reference

A message wrapped to be used as type of argument for event handlers. More...

#include <event_data.hpp>

Inheritance diagram for so_5::mhood_t< M >:
so_5::details::mhood_base_t< M, T, Mut >

Public Member Functions

 mhood_t (message_ref_t &mf)
 

Private Types

using base_type_t = details::actual_mhood_base_type< M >
 

Detailed Description

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
Mtype 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;
so_5::intrusive_ptr_t< M > make_reference() 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*();
so_5::intrusive_ptr_t< M > make_reference();
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):
class redirector : public so_5::agent_t
{
...
void some_event( mhood_t< std::string > evt ) {
// Redirection of message to the different mbox.
so_5::send(m_another_mbox, evt);
}
};
If mhood_t<mutable_msg<M>> is used then a redirection must be done this way:
class redirector : public so_5::agent_t
{
...
void some_event( mhood_t< mutable_msg<std::string> > evt ) {
// Redirection of message to the different mbox.
so_5::send(m_another_mbox, std::move(evt));
// NOTE: evt is nullptr at this point. It must not be used anymore.
}
};
Examples:
so_5/make_pipeline/main.cpp, so_5/mchain_handler_formats/main.cpp, and so_5/wrapped_env_demo_3/main.cpp.

Member Typedef Documentation

◆ base_type_t

template<typename M>
using so_5::mhood_t< M >::base_type_t = details::actual_mhood_base_type<M>
private

Constructor & Destructor Documentation

◆ mhood_t()

template<typename M>
so_5::mhood_t< M >::mhood_t ( message_ref_t mf)
inline

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