template<typename Tag, typename... Types>
struct so_5::tuple_as_message_t< Tag, Types >
A template which allows to use tuples as messages.
- Since
- v.5.5.5
- Template Parameters
-
Tag | a type tag for distinguish messages with the same fields list. |
Types | types for message fields. |
This template is added to allow a user to use simple constructs for very simple messages, when there is no need to define a full class for message.
Just for comparison:
{
const std::uint8_t * m_data;
process_data( const std::uint8_t * data )
: m_data( data )
{}
};
void data_processing_agent::evt_process_data( const process_data & evt )
{
do_data_processing( evt.m_data );
}
And this the one possible usage of tuple_as_message_t for the same task:
struct process_data_tag {};
void data_processing_agent::evt_process_data( const process_data & evt )
{
do_data_processing( std::get<0>( evt ) );
}
Or even yet more simplier and dirtier:
std::integral_constant<int, 0>, const std::uint8_t * >;
void data_processing_agent::evt_process_data( const process_data & evt )
{
do_data_processing( std::get<0>( evt ) );
}