// Copyright 2025 Christian Granzin // Copyright 2008 Christophe Henry // henry UNDERSCORE christophe AT hotmail DOT com // This is an extended version of the state machine available in the boost::mpl library // Distributed under the same license as the original. // Copyright for the original version: // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed // under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MSM_BACKMP11_STATE_MACHINE_CONFIG_HPP #define BOOST_MSM_BACKMP11_STATE_MACHINE_CONFIG_HPP #include namespace boost::msm::backmp11 { namespace detail { struct config_tag {}; // Check whether a type is a config. template using is_config = std::is_same; } // namespace detail /// No derived is configured. /// See @ref state_machine. struct no_derived {}; /// Configuration parameters to select how events are dispatched. namespace dispatch_strategy { /** Generates a flat fold of inline comparison branches. The code can be optimized to a jump table. - + Best executable size and runtime speed for most compilers - + No indirection — fully inlinable - \- O(n) comparisons in the worst case */ struct flat_fold {}; /** Generates an array of function pointers. - + O(1) dispatch - + Slightly better compile times - \- Indirect call through function pointer — not inlinable - \- Larger executable size (one pointer per state per event type) */ struct function_pointer_array {}; } // namespace dispatch_strategy /** Optimizes for runtime speed (see @ref state_machine_config::compile_policy). Provides the best runtime speed and executable size at the cost of increased compile time. */ struct favor_runtime_speed { /// Dispatch strategy for processing events. Defaults to @ref dispatch_strategy::flat_fold. using dispatch_strategy = dispatch_strategy::flat_fold; }; /** Optimizes for compile time (see @ref state_machine_config::compile_policy). Trades lower compile time for bigger executable size and lower runtime speed. Does not support the following features: - event hierarchies - Kleene events */ struct favor_compile_time {}; /// No context is configured (see @ref state_machine_config::context). struct no_context {}; /// No root state machine is configured (see @ref state_machine_config::root_sm). struct no_root_sm {}; /// Passes the immediate parent machine as `Fsm` argument /// (see @ref state_machine_config::fsm_parameter). struct local_transition_owner {}; /** * @brief Defines the container type and inline storage for the event pool (see * @ref state_machine_config::event_pool). * * @tparam Container Type of the container to use. * @tparam InlineCapacity Max inline storage per event. * @tparam InlineAlign Inline storage alignment. */ template