CommRaT 2.0.0
C++20 Real-Time Messaging Framework
Loading...
Searching...
No Matches
commrat::LifecycleManager< ModuleType > Class Template Reference

Phase 6: Lifecycle Management CRTP Mixin. More...

#include <commrat/module/lifecycle/lifecycle_manager.hpp>

Inheritance diagram for commrat::LifecycleManager< ModuleType >:
commrat::Module< UserRegistry, OutputSpec_, InputSpec_, CommandTypes... >

Public Member Functions

void start ()
 Start the module.
 
void stop ()
 Stop the module.
 
bool is_running () const
 Check if module is currently running.
 

Detailed Description

template<typename ModuleType>
class commrat::LifecycleManager< ModuleType >

Phase 6: Lifecycle Management CRTP Mixin.

Manages module startup and shutdown sequences:

  • Mailbox initialization and startup
  • Thread spawning (work, command, data, secondary inputs)
  • Subscription setup
  • Graceful shutdown and cleanup
Template Parameters
ModuleTypeThe derived Module class (CRTP)

Definition at line 21 of file lifecycle_manager.hpp.

Member Function Documentation

◆ is_running()

template<typename ModuleType >
bool commrat::LifecycleManager< ModuleType >::is_running ( ) const
inline

Check if module is currently running.

Definition at line 179 of file lifecycle_manager.hpp.

◆ start()

template<typename ModuleType >
void commrat::LifecycleManager< ModuleType >::start ( )
inline

Start the module.

Orchestrates the complete startup sequence:

  1. Call on_init() hook
  2. Start all mailboxes (CMD, WORK, PUBLISH, DATA, multi-input)
  3. Mark running_ = true
  4. Call on_start() hook
  5. Spawn work threads (subscription protocol handlers)
  6. Spawn command thread (user command handler)
  7. Subscribe to configured input sources
  8. Spawn data thread (periodic/loop/continuous/multi-input)

Definition at line 36 of file lifecycle_manager.hpp.

◆ stop()

template<typename ModuleType >
void commrat::LifecycleManager< ModuleType >::stop ( )
inline

Stop the module.

Orchestrates the complete shutdown sequence:

  1. Call on_stop() hook
  2. Unsubscribe from all input sources
  3. Mark running_ = false (signals threads to exit)
  4. Join data thread
  5. Join secondary input threads (multi-input)
  6. Join work threads (single or multi-output)
  7. Join command thread
  8. Stop all mailboxes
  9. Call on_cleanup() hook

Definition at line 126 of file lifecycle_manager.hpp.


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