![]() |
CommRaT 2.0.0
C++20 Real-Time Messaging Framework
|
CommRaT Application Template - Main User-Facing Interface. More...
#include <commrat/commrat.hpp>
Public Types | |
| using | payload_types = typename Registry::PayloadTypes |
| template<typename OutputSpec_ , typename InputSpec_ , typename... CommandTypes> | |
| using | Module = commrat::Module< Registry, OutputSpec_, InputSpec_, CommandTypes... > |
| Module template - create modules for this application. | |
| template<typename PayloadT > | |
| using | Mailbox = RegistryMailbox< Registry > |
| Mailbox template - create mailboxes for this application. | |
| template<std::size_t HistorySize> | |
| using | HistoricalMailbox = commrat::HistoricalMailbox< Registry, HistorySize > |
| HistoricalMailbox template - mailbox with time-synchronized getData() | |
| using | Introspection = IntrospectionHelper< CommRaT > |
| Introspection helper - export message schemas to any format. | |
Public Types inherited from commrat::MessageRegistry< MessageDefs... > | |
| using | PayloadTypes = typename ExtractPayloads< ProcessedDefs >::PayloadTypes |
| using | PayloadTypeFor = typename TypeByID< ID, 0 >::type |
| Get the payload type by message ID (compile-time) | |
| using | type_at = std::tuple_element_t< I, PayloadTypes > |
| Get payload type at index I. | |
Additional Inherited Members | |
Static Public Member Functions inherited from commrat::MessageRegistry< MessageDefs... > | |
| static constexpr size_t | calc_max_size (std::tuple< Payloads... > *) |
| static constexpr size_t | max_size_for_types () |
| Calculate maximum message size for specific payload types. | |
| static constexpr uint32_t | get_message_id () |
| Get the message ID for a given payload type. | |
| static auto | serialize (T &message) |
| Serialize a message with automatic type registration check. | |
| static auto | serialize (TimsMessage< PayloadT > &message) |
| Serialize a TimsMessage<PayloadT> wrapper. | |
| static auto | deserialize (std::span< const std::byte > data) |
| Deserialize a message with known type at compile time. | |
| static auto | deserialize (std::span< const std::byte > data) |
| Deserialize a TimsMessage<PayloadT> wrapper. | |
| static bool | visit (uint32_t msg_id, std::span< const std::byte > data, Visitor &&visitor) |
| Visit a message by its message ID using a visitor. | |
| static bool | dispatch (uint32_t msg_id, std::span< const std::byte > data, Callback &&callback) |
| Deserialize message by ID and dispatch to callback. | |
| static constexpr size_t | max_buffer_size () |
| Get maximum buffer size needed for any message in the registry. | |
| static constexpr size_t | size () |
| Get number of registered message types. | |
| static constexpr auto | get_all_ids_impl (std::tuple< Defs... > *) |
| Get list of all message IDs in the registry. | |
| static constexpr auto | message_ids () |
| static constexpr std::size_t | get_type_index () |
| Get type index for payload type T. | |
Static Public Attributes inherited from commrat::MessageRegistry< MessageDefs... > | |
| static constexpr bool | is_registered_v |
| static constexpr size_t | num_types |
| static constexpr size_t | max_message_size |
| static constexpr bool | is_registered |
| Check if a payload type is registered. | |
| static constexpr bool | has_message_id |
| Check if a message ID is registered. | |
CommRaT Application Template - Main User-Facing Interface.
This is the primary entry point for defining a CommRaT application. Combines MessageRegistry with Module/Mailbox factories for clean, type-safe messaging.
| MessageDefs | Message definitions using MessageDefinition<PayloadType, ...> |
Key Features:
Usage Example:
Advantages over raw MessageRegistry:
Definition at line 111 of file commrat.hpp.
| using commrat::CommRaT< MessageDefs >::HistoricalMailbox = commrat::HistoricalMailbox<Registry, HistorySize> |
HistoricalMailbox template - mailbox with time-synchronized getData()
Provides RACK-style timestamp-based message retrieval for multi-rate sensor fusion. Buffers recent messages and returns the closest match to a requested timestamp.
| HistorySize | Number of messages to buffer per type (circular buffer) |
Use Case: Synchronizing sensors with different rates
Algorithm:
getData(target_timestamp, tolerance) finds closest messagesizeof(TimsMessage<T>) * HistorySize per type Definition at line 224 of file commrat.hpp.
| using commrat::CommRaT< MessageDefs >::Introspection = IntrospectionHelper<CommRaT> |
Introspection helper - export message schemas to any format.
Provides registry-wide schema export combining:
Supports any rfl format: JSON, YAML, TOML, XML, etc.
Usage:
What's exported:
message_id - Unique ID for routing/filteringpayload_type - Human-readable type namefull_type - Complete TimsMessage<T> typemax_message_size - Buffer allocation hintUse cases:
Definition at line 263 of file commrat.hpp.
| using commrat::CommRaT< MessageDefs >::Mailbox = RegistryMailbox<Registry> |
Mailbox template - create mailboxes for this application.
For advanced use cases that need direct mailbox access outside of Module. Most users won't need this - Module handles mailboxes automatically.
| PayloadT | Message payload type (must be registered in this application) |
Usage (Advanced):
Definition at line 189 of file commrat.hpp.
| using commrat::CommRaT< MessageDefs >::Module = commrat::Module<Registry, OutputSpec_, InputSpec_, CommandTypes...> |
Module template - create modules for this application.
This is the preferred user-facing API for defining modules. Automatically binds the module to this application's message registry.
| OutputSpec_ | Output specification: Output<T>, Outputs<T, U, ...>, or NoOutput |
| InputSpec_ | Input specification: Input<T>, Inputs<T, U, ...>, PeriodicInput, or LoopInput |
| CommandTypes | Optional command types this module handles |
Usage:
I/O Specification Examples:
Module<Output<T>, PeriodicInput> - Periodic generation of single outputModule<Output<T>, Input<U>> - Transform U → T on each inputModule<Outputs<T, U>, PeriodicInput> - Periodic generation of multiple outputsModule<Output<T>, Inputs<U, V>> - Fuse U and V → T with synchronizationModule<Output<T>, LoopInput> - Maximum throughput computationDefinition at line 160 of file commrat.hpp.
| using commrat::CommRaT< MessageDefs >::payload_types = typename Registry::PayloadTypes |
Definition at line 126 of file commrat.hpp.