CommRaT 2.0.0
C++20 Real-Time Messaging Framework
Loading...
Searching...
No Matches
commrat::MailboxSet< UserRegistry, OutputType, CommandTypes > Struct Template Reference

Complete set of mailboxes for one output type. More...

#include <commrat/module/mailbox/mailbox_set.hpp>

Public Types

using CmdMailbox = std::conditional_t< sizeof...(CommandTypes)==0, TypedMailbox< UserRegistry, SendOnlyTypes< OutputType > >, TypedMailbox< UserRegistry, ReceiveTypes< CommandTypes... >, SendOnlyTypes< OutputType > > >
 
using WorkMailbox = RegistryMailbox< SystemRegistry >
 
using PublishMailbox = TypedMailbox< UserRegistry, OutputType >
 

Public Member Functions

template<std::size_t OutputIndex = 0>
void initialize (const ModuleConfig &config)
 Initialize all mailboxes in this set.
 

Static Public Member Functions

static constexpr uint32_t calculate_base (uint8_t system_id, uint8_t instance_id)
 Calculate base address for this output type.
 

Public Attributes

std::optional< CmdMailboxcmd
 
std::optional< WorkMailboxwork
 
std::optional< PublishMailboxpublish
 
uint32_t base_address {0}
 

Detailed Description

template<typename UserRegistry, typename OutputType, typename... CommandTypes>
struct commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >

Complete set of mailboxes for one output type.

Each output type in a multi-output module gets its own MailboxSet. All mailboxes share the same base address: [output_type_id:16][system_id:8][instance_id:8]

Architecture:

  • CMD (base + 0): Receives user commands for this output type
  • WORK (base + 16): Handles subscription requests for this output type
  • PUBLISH (base + 32): Publishes this output type to subscribers
  • DATA (base + 48): Reserved for future use (inputs handled separately)

NOTE: These offsets are defined in MailboxType enum (module_config.hpp) All code MUST use MailboxType::DATA, not literal offsets!

Template Parameters
UserRegistryThe message registry for user-defined types
OutputTypeThe specific output data type this set serves
CommandTypesVariadic list of command types (for CMD mailbox)

Definition at line 35 of file mailbox_set.hpp.

Member Typedef Documentation

◆ CmdMailbox

template<typename UserRegistry , typename OutputType , typename... CommandTypes>
using commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::CmdMailbox = std::conditional_t< sizeof...(CommandTypes) == 0, TypedMailbox<UserRegistry, SendOnlyTypes<OutputType> >, TypedMailbox<UserRegistry, ReceiveTypes<CommandTypes...>, SendOnlyTypes<OutputType> > >

Definition at line 37 of file mailbox_set.hpp.

◆ PublishMailbox

template<typename UserRegistry , typename OutputType , typename... CommandTypes>
using commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::PublishMailbox = TypedMailbox<UserRegistry, OutputType>

Definition at line 46 of file mailbox_set.hpp.

◆ WorkMailbox

template<typename UserRegistry , typename OutputType , typename... CommandTypes>
using commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::WorkMailbox = RegistryMailbox<SystemRegistry>

Definition at line 45 of file mailbox_set.hpp.

Member Function Documentation

◆ calculate_base()

template<typename UserRegistry , typename OutputType , typename... CommandTypes>
static constexpr uint32_t commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::calculate_base ( uint8_t  system_id,
uint8_t  instance_id 
)
inlinestaticconstexpr

Calculate base address for this output type.

Definition at line 58 of file mailbox_set.hpp.

Referenced by commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::initialize().

◆ initialize()

Member Data Documentation

◆ base_address

template<typename UserRegistry , typename OutputType , typename... CommandTypes>
uint32_t commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::base_address {0}

◆ cmd

template<typename UserRegistry , typename OutputType , typename... CommandTypes>
std::optional<CmdMailbox> commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::cmd

◆ publish

template<typename UserRegistry , typename OutputType , typename... CommandTypes>
std::optional<PublishMailbox> commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::publish

◆ work

template<typename UserRegistry , typename OutputType , typename... CommandTypes>
std::optional<WorkMailbox> commrat::MailboxSet< UserRegistry, OutputType, CommandTypes >::work

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