![]() |
CommRaT 2.0.0
C++20 Real-Time Messaging Framework
|
Mailbox with timestamped history for getData synchronization. More...
#include <commrat/mailbox/historical_mailbox.hpp>
Public Types | |
| using | Registry = UserRegistry |
| using | MailboxType = RegistryMailbox< UserRegistry > |
| using | HistoryBufferTuple = decltype(make_history_tuple_type(std::make_index_sequence< Registry::num_types >{})) |
Public Member Functions | |
| HistoricalMailbox (const MailboxConfig &config, Milliseconds default_tolerance=Milliseconds(50)) | |
| Constructor with mailbox config and default tolerance. | |
| auto | start () -> MailboxResult< void > |
| Start the mailbox (pass-through to underlying mailbox) | |
| void | stop () |
| Stop the mailbox (pass-through to underlying mailbox) | |
| template<typename T > | |
| auto | receive () -> MailboxResult< TimsMessage< T > > |
| Receive a message and automatically store in history. | |
| template<typename T > | |
| std::optional< TimsMessage< T > > | getData (uint64_t timestamp, Milliseconds tolerance=Milliseconds(-1), InterpolationMode mode=InterpolationMode::NEAREST) const |
| template<typename T > | |
| std::pair< uint64_t, uint64_t > | getTimestampRange () const |
| Get timestamp range currently buffered for type T. | |
| template<typename T > | |
| void | clearHistory () |
| Clear history for type T. | |
| void | clearAllHistory () |
| Clear all history buffers. | |
| template<typename T > | |
| auto | send (T &message, uint32_t dest_mailbox) -> MailboxResult< void > |
| Send a message (pass-through to underlying mailbox) | |
| uint32_t | get_mailbox_id () const |
| Get mailbox ID. | |
| bool | is_initialized () const |
| Check if mailbox is initialized. | |
Static Public Member Functions | |
| template<std::size_t... Is> | |
| static auto | make_history_tuple_type (std::index_sequence< Is... >) |
Mailbox with timestamped history for getData synchronization.
Wraps RegistryMailbox and maintains a TimestampedRingBuffer for each registered message type. Received messages are automatically stored in history, enabling getData() queries for multi-input synchronization.
| UserRegistry | Message registry (MessageRegistry<...>) |
| HistorySize | Maximum messages to buffer per type (default: 100) |
Thread Safety:
Usage Pattern:
Architecture:
Definition at line 63 of file historical_mailbox.hpp.
| using commrat::HistoricalMailbox< UserRegistry, HistorySize >::HistoryBufferTuple = decltype(make_history_tuple_type( std::make_index_sequence<Registry::num_types>{} )) |
Definition at line 76 of file historical_mailbox.hpp.
| using commrat::HistoricalMailbox< UserRegistry, HistorySize >::MailboxType = RegistryMailbox<UserRegistry> |
Definition at line 66 of file historical_mailbox.hpp.
| using commrat::HistoricalMailbox< UserRegistry, HistorySize >::Registry = UserRegistry |
Definition at line 65 of file historical_mailbox.hpp.
|
inlineexplicit |
Constructor with mailbox config and default tolerance.
| config | Mailbox configuration |
| default_tolerance | Default tolerance for getData (milliseconds) |
Definition at line 89 of file historical_mailbox.hpp.
|
inline |
Clear all history buffers.
Definition at line 213 of file historical_mailbox.hpp.
|
inline |
Clear history for type T.
Definition at line 205 of file historical_mailbox.hpp.
|
inline |
Get mailbox ID.
Definition at line 232 of file historical_mailbox.hpp.
References commrat::RegistryMailbox< Registry >::mailbox_id().
|
inline |
Definition at line 182 of file historical_mailbox.hpp.
|
inline |
Get timestamp range currently buffered for type T.
Definition at line 196 of file historical_mailbox.hpp.
|
inline |
Check if mailbox is initialized.
Definition at line 239 of file historical_mailbox.hpp.
|
inlinestatic |
Definition at line 70 of file historical_mailbox.hpp.
|
inline |
Receive a message and automatically store in history.
Receives next message of type T, stores it in history, and returns it. This is the PRIMARY input API - blocks until message arrives.
| T | Payload type (must be registered in UserRegistry) |
Definition at line 138 of file historical_mailbox.hpp.
|
inline |
Send a message (pass-through to underlying mailbox)
Definition at line 225 of file historical_mailbox.hpp.
References commrat::HistoricalMailbox< UserRegistry, HistorySize >::send().
Referenced by commrat::HistoricalMailbox< UserRegistry, HistorySize >::send().
|
inline |
Start the mailbox (pass-through to underlying mailbox)
Definition at line 101 of file historical_mailbox.hpp.
References commrat::RegistryMailbox< Registry >::mailbox_id(), and commrat::RegistryMailbox< Registry >::start().
|
inline |
Stop the mailbox (pass-through to underlying mailbox)
Definition at line 117 of file historical_mailbox.hpp.
References commrat::RegistryMailbox< Registry >::stop().