CommRaT 2.0.0
C++20 Real-Time Messaging Framework
Loading...
Searching...
No Matches
commrat::MultiInputProcessor< ModuleType, InputTypesTuple, OutputData, OutputTypesTuple, InputCount > Class Template Reference

Multi-input processing mixin. More...

#include <commrat/module/io/multi_input_processor.hpp>

Protected Member Functions

template<std::size_t PrimaryIdx>
auto receive_primary_input () -> MailboxResult< TimsMessage< std::tuple_element_t< PrimaryIdx, InputTypesTuple > > >
 Receive from primary input mailbox.
 
template<std::size_t PrimaryIdx, typename PrimaryMsgType >
std::optional< InputTypesTuple > gather_all_inputs (const PrimaryMsgType &primary_msg)
 Gather all inputs synchronized to primary timestamp.
 
template<typename O = OutputData, typename = std::enable_if_t<!std::is_void_v<O>>>
void call_multi_input_process (const InputTypesTuple &inputs, O &output)
 Call multi-input process with single output.
 
void call_multi_input_multi_output_process (const InputTypesTuple &inputs, OutputTypesTuple &outputs)
 Call multi-input process with multi-output.
 

Detailed Description

template<typename ModuleType, typename InputTypesTuple, typename OutputData, typename OutputTypesTuple, std::size_t InputCount>
class commrat::MultiInputProcessor< ModuleType, InputTypesTuple, OutputData, OutputTypesTuple, InputCount >

Multi-input processing mixin.

Provides helpers for:

  • Receiving from primary input mailbox
  • Gathering all inputs synchronized to primary timestamp
  • Calling multi-input process() methods with proper unpacking
Template Parameters
ModuleTypeThe derived Module class (CRTP)
InputTypesTupleTuple of input payload types
OutputDataSingle output type (or void)
OutputTypesTupleTuple of output types (for multi-output)
InputCountNumber of inputs

Definition at line 34 of file multi_input_processor.hpp.

Member Function Documentation

◆ call_multi_input_multi_output_process()

template<typename ModuleType , typename InputTypesTuple , typename OutputData , typename OutputTypesTuple , std::size_t InputCount>
void commrat::MultiInputProcessor< ModuleType, InputTypesTuple, OutputData, OutputTypesTuple, InputCount >::call_multi_input_multi_output_process ( const InputTypesTuple &  inputs,
OutputTypesTuple outputs 
)
inlineprotected

Call multi-input process with multi-output.

Unpacks both tuples and calls process(const T1&, ..., O1&, O2&, ...)

Parameters
inputsTuple of all input payloads
outputsTuple of output payloads (passed by reference)

Definition at line 118 of file multi_input_processor.hpp.

◆ call_multi_input_process()

template<typename ModuleType , typename InputTypesTuple , typename OutputData , typename OutputTypesTuple , std::size_t InputCount>
template<typename O = OutputData, typename = std::enable_if_t<!std::is_void_v<O>>>
void commrat::MultiInputProcessor< ModuleType, InputTypesTuple, OutputData, OutputTypesTuple, InputCount >::call_multi_input_process ( const InputTypesTuple &  inputs,
O &  output 
)
inlineprotected

Call multi-input process with single output.

Unpacks InputTypesTuple and calls process(const T1&, const T2&, ..., Output&) SFINAE: Only enabled when OutputData is not void (single output case)

Parameters
inputsTuple of all input payloads
outputReference to output data to populate

Definition at line 106 of file multi_input_processor.hpp.

◆ gather_all_inputs()

template<typename ModuleType , typename InputTypesTuple , typename OutputData , typename OutputTypesTuple , std::size_t InputCount>
template<std::size_t PrimaryIdx, typename PrimaryMsgType >
std::optional< InputTypesTuple > commrat::MultiInputProcessor< ModuleType, InputTypesTuple, OutputData, OutputTypesTuple, InputCount >::gather_all_inputs ( const PrimaryMsgType &  primary_msg)
inlineprotected

Gather all inputs synchronized to primary timestamp.

Places primary input at its index, then uses getData to synchronize all secondary inputs to the primary's timestamp.

Template Parameters
PrimaryIdxIndex of primary input
PrimaryMsgTypeType of primary TimsMessage
Parameters
primary_msgReceived primary message with timestamp
Returns
Tuple of all inputs if sync succeeded, nullopt otherwise

Definition at line 71 of file multi_input_processor.hpp.

◆ receive_primary_input()

template<typename ModuleType , typename InputTypesTuple , typename OutputData , typename OutputTypesTuple , std::size_t InputCount>
template<std::size_t PrimaryIdx>
auto commrat::MultiInputProcessor< ModuleType, InputTypesTuple, OutputData, OutputTypesTuple, InputCount >::receive_primary_input ( ) -> MailboxResult<TimsMessage<std::tuple_element_t<PrimaryIdx, InputTypesTuple>>>
inlineprotected

Receive from primary input mailbox.

Blocking receive that drives the execution rate of multi-input modules.

Template Parameters
PrimaryIdxIndex of primary input in InputTypesTuple
Returns
Received TimsMessage or error

Definition at line 45 of file multi_input_processor.hpp.

References commrat::NotInitialized.


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