![]() |
CommRaT 2.0.0
C++20 Real-Time Messaging Framework
|
Command dispatcher mixin. More...
#include <commrat/module/lifecycle/command_dispatcher.hpp>
Protected Member Functions | |
| void | command_loop () |
| Command loop - receives and dispatches user commands. | |
| template<typename CmdT > | |
| void | handle_user_command (const CmdT &cmd) |
| Dispatch user command to on_command handler. | |
| template<typename CmdT > | |
| void | on_command (const CmdT &cmd) |
| Handle a specific command type (override in derived class) | |
Command dispatcher mixin.
Provides command_loop() and handle_user_command() for modules that accept user commands via the CMD mailbox.
| ModuleType | The derived Module class (CRTP) |
| CommandTypes | Variadic pack of command payload types |
Definition at line 26 of file command_dispatcher.hpp.
|
inlineprotected |
Command loop - receives and dispatches user commands.
Runs in a dedicated thread, blocking on CMD mailbox receives. Routes commands to on_command() handlers based on payload type.
Definition at line 34 of file command_dispatcher.hpp.
|
inlineprotected |
Dispatch user command to on_command handler.
| CmdT | Command payload type |
| cmd | Command payload |
Definition at line 66 of file command_dispatcher.hpp.
|
inlineprotected |
Handle a specific command type (override in derived class)
Default implementation does nothing. Derived classes should provide overloads for each command type they support:
void on_command(const ResetCmd& cmd) override { ... } void on_command(const CalibrateCmd& cmd) override { ... }
| CmdT | Command payload type |
| cmd | Command payload |
Definition at line 89 of file command_dispatcher.hpp.