DiffEq - Modern C++ ODE Integration Library 1.0.0
High-performance C++ library for solving ODEs with async signal processing
Loading...
Searching...
No Matches
diffeq::core::composable::SignalDecorator< S > Class Template Reference

Signal decorator - adds signal processing to any integrator. More...

#include <signal_decorator.hpp>

Inheritance diagram for diffeq::core::composable::SignalDecorator< S >:
Collaboration diagram for diffeq::core::composable::SignalDecorator< S >:

Public Member Functions

 SignalDecorator (std::unique_ptr< AbstractIntegrator< S > > integrator, SignalConfig config={})
 Construct signal decorator.
 
void step (typename IntegratorDecorator< S >::state_type &state, typename IntegratorDecorator< S >::time_type dt) override
 Override step to add signal processing.
 
void integrate (typename IntegratorDecorator< S >::state_type &state, typename IntegratorDecorator< S >::time_type dt, typename IntegratorDecorator< S >::time_type end_time) override
 Override integrate to handle signal processing during integration.
 
void register_signal_handler (std::function< void(S &, typename IntegratorDecorator< S >::time_type)> handler, const std::string &signal_id="", SignalPriority priority=SignalPriority::NORMAL)
 Register a signal handler function.
 
void register_signal_handlers (const std::vector< std::function< void(S &, typename IntegratorDecorator< S >::time_type)> > &handlers)
 Register multiple signal handlers at once.
 
void clear_signal_handlers ()
 Clear all signal handlers.
 
size_t get_signal_handler_count () const
 Get number of registered signal handlers.
 
void process_signals_now (S &state, typename IntegratorDecorator< S >::time_type time)
 Force immediate signal processing.
 
const SignalStatsget_statistics () const
 Get signal processing statistics.
 
void reset_statistics ()
 Reset signal processing statistics.
 
bool is_processing_active () const
 Check if signal processing is currently active.
 
SignalConfigconfig ()
 Access and modify signal configuration.
 
const SignalConfigconfig () const
 
void update_config (SignalConfig new_config)
 Update signal configuration with validation.
 
- Public Member Functions inherited from diffeq::core::composable::IntegratorDecorator< S >
 IntegratorDecorator (std::unique_ptr< base_type > integrator)
 Construct decorator wrapping another integrator.
 
virtual ~IntegratorDecorator ()=default
 Virtual destructor for proper cleanup.
 
void step (state_type &state, time_type dt) override
 
void integrate (state_type &state, time_type dt, time_type end_time) override
 
time_type current_time () const override
 
void set_time (time_type t) override
 
void set_system (system_function sys) override
 
base_typewrapped ()
 Access to wrapped integrator for advanced use.
 
const base_typewrapped () const
 
bool has_wrapped_integrator () const
 Check if wrapped integrator exists.
 
- Public Member Functions inherited from diffeq::core::AbstractIntegrator< S >
 AbstractIntegrator (system_function sys)
 
time_type current_time () const
 
void set_time (time_type t)
 
void set_system (system_function sys)
 

Additional Inherited Members

- Public Types inherited from diffeq::core::composable::IntegratorDecorator< S >
using base_type = AbstractIntegrator< S >
 
using state_type = typename base_type::state_type
 
using time_type = typename base_type::time_type
 
using system_function = typename base_type::system_function
 
- Public Types inherited from diffeq::core::AbstractIntegrator< S >
using state_type = S
 
using time_type = typename S::value_type
 
using value_type = typename S::value_type
 
using system_function = std::function< void(time_type, const state_type &, state_type &)>
 
- Protected Member Functions inherited from diffeq::core::AbstractIntegrator< S >
void advance_time (time_type dt)
 
- Protected Attributes inherited from diffeq::core::composable::IntegratorDecorator< S >
std::unique_ptr< base_typewrapped_integrator_
 
- Protected Attributes inherited from diffeq::core::AbstractIntegrator< S >
system_function sys_
 
time_type current_time_
 

Detailed Description

template<system_state S>
class diffeq::core::composable::SignalDecorator< S >

Signal decorator - adds signal processing to any integrator.

This decorator provides comprehensive signal processing with the following features:

  • Multiple processing modes (sync, async, batch)
  • Signal priority handling
  • Real-time signal buffering and processing
  • Detailed statistics and performance monitoring

Key Design Principles:

  • Single Responsibility: ONLY handles signal processing
  • No Dependencies: Works with any integrator type
  • Real-time: Minimal latency signal handling
  • Thread-safe: Safe concurrent signal registration and processing

Definition at line 128 of file signal_decorator.hpp.

Constructor & Destructor Documentation

◆ SignalDecorator()

template<system_state S>
diffeq::core::composable::SignalDecorator< S >::SignalDecorator ( std::unique_ptr< AbstractIntegrator< S > >  integrator,
SignalConfig  config = {} 
)
inlineexplicit

Construct signal decorator.

Parameters
integratorThe integrator to wrap
configSignal configuration (validated on construction)
Exceptions
std::invalid_argumentif config is invalid

Definition at line 145 of file signal_decorator.hpp.

Member Function Documentation

◆ clear_signal_handlers()

template<system_state S>
void diffeq::core::composable::SignalDecorator< S >::clear_signal_handlers ( )
inline

Clear all signal handlers.

Definition at line 232 of file signal_decorator.hpp.

◆ config() [1/2]

Access and modify signal configuration.

Definition at line 283 of file signal_decorator.hpp.

◆ config() [2/2]

template<system_state S>
const SignalConfig & diffeq::core::composable::SignalDecorator< S >::config ( ) const
inline

Definition at line 284 of file signal_decorator.hpp.

◆ get_signal_handler_count()

template<system_state S>
size_t diffeq::core::composable::SignalDecorator< S >::get_signal_handler_count ( ) const
inline

Get number of registered signal handlers.

Definition at line 245 of file signal_decorator.hpp.

◆ get_statistics()

template<system_state S>
const SignalStats & diffeq::core::composable::SignalDecorator< S >::get_statistics ( ) const
inline

Get signal processing statistics.

Definition at line 262 of file signal_decorator.hpp.

◆ integrate()

template<system_state S>
void diffeq::core::composable::SignalDecorator< S >::integrate ( typename IntegratorDecorator< S >::state_type &  state,
typename IntegratorDecorator< S >::time_type  dt,
typename IntegratorDecorator< S >::time_type  end_time 
)
inlineoverride

Override integrate to handle signal processing during integration.

Definition at line 173 of file signal_decorator.hpp.

◆ is_processing_active()

template<system_state S>
bool diffeq::core::composable::SignalDecorator< S >::is_processing_active ( ) const
inline

Check if signal processing is currently active.

Definition at line 276 of file signal_decorator.hpp.

◆ process_signals_now()

template<system_state S>
void diffeq::core::composable::SignalDecorator< S >::process_signals_now ( S &  state,
typename IntegratorDecorator< S >::time_type  time 
)
inline

Force immediate signal processing.

Parameters
stateCurrent state
timeCurrent time

Definition at line 255 of file signal_decorator.hpp.

◆ register_signal_handler()

template<system_state S>
void diffeq::core::composable::SignalDecorator< S >::register_signal_handler ( std::function< void(S &, typename IntegratorDecorator< S >::time_type)>  handler,
const std::string &  signal_id = "",
SignalPriority  priority = SignalPriority::NORMAL 
)
inline

Register a signal handler function.

Parameters
handlerFunction to handle signals: void(S& state, T time)
signal_idOptional identifier for the signal
prioritySignal priority level

Definition at line 194 of file signal_decorator.hpp.

◆ register_signal_handlers()

template<system_state S>
void diffeq::core::composable::SignalDecorator< S >::register_signal_handlers ( const std::vector< std::function< void(S &, typename IntegratorDecorator< S >::time_type)>  ,
handlers 
)
inline

Register multiple signal handlers at once.

Parameters
handlersVector of signal handler functions

Definition at line 220 of file signal_decorator.hpp.

◆ reset_statistics()

template<system_state S>
void diffeq::core::composable::SignalDecorator< S >::reset_statistics ( )
inline

Reset signal processing statistics.

Definition at line 269 of file signal_decorator.hpp.

◆ step()

template<system_state S>
void diffeq::core::composable::SignalDecorator< S >::step ( typename IntegratorDecorator< S >::state_type &  state,
typename IntegratorDecorator< S >::time_type  dt 
)
inlineoverride

Override step to add signal processing.

Definition at line 156 of file signal_decorator.hpp.

◆ update_config()

template<system_state S>
void diffeq::core::composable::SignalDecorator< S >::update_config ( SignalConfig  new_config)
inline

Update signal configuration with validation.

Parameters
new_configNew configuration
Exceptions
std::invalid_argumentif new config is invalid

Definition at line 291 of file signal_decorator.hpp.

Here is the call graph for this function:

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