mirror of
https://github.com/boostorg/msm.git
synced 2026-01-19 04:22:11 +00:00
First version of the backmp11 backend. Contains: - favor_runtime_speed policy that mainly replaces MPL with Mp11 - favor_compile_time that uses a new mechanism with dispatch tables per state
59 lines
3.5 KiB
C++
59 lines
3.5 KiB
C++
// Copyright 2024 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)
|
|
|
|
// back-end
|
|
#include <boost/msm/back/state_machine.hpp>
|
|
#include <boost/msm/back/favor_compile_time.hpp>
|
|
#include <boost/msm/backmp11/state_machine.hpp>
|
|
#include <boost/msm/backmp11/favor_compile_time.hpp>
|
|
#include <boost/msm/back11/state_machine.hpp>
|
|
|
|
template<typename Front>
|
|
using get_test_machines = boost::mpl::vector<
|
|
boost::msm::back::state_machine<Front>,
|
|
boost::msm::back::state_machine<Front, boost::msm::back::favor_compile_time>,
|
|
boost::msm::backmp11::state_machine<Front>,
|
|
boost::msm::backmp11::state_machine<Front, boost::msm::backmp11::favor_compile_time>,
|
|
boost::msm::back11::state_machine<Front>
|
|
>;
|
|
|
|
template <template <template <typename...> class, typename = void> class hierarchical>
|
|
using get_hierarchical_test_machines = boost::mpl::vector<
|
|
hierarchical<boost::msm::back::state_machine>,
|
|
hierarchical<boost::msm::back::state_machine, boost::msm::back::favor_compile_time>,
|
|
hierarchical<boost::msm::backmp11::state_machine>,
|
|
hierarchical<boost::msm::backmp11::state_machine, boost::msm::backmp11::favor_compile_time>,
|
|
hierarchical<boost::msm::back11::state_machine>
|
|
>;
|
|
|
|
#define BOOST_MSM_TEST_DEFINE_DEPENDENT_TEMPLATES(frontname) \
|
|
using base = msm::front::state_machine_def<frontname>; \
|
|
template<typename T1, class Event, typename T2> \
|
|
using _row = typename base::template _row<T1, Event, T2>; \
|
|
template< \
|
|
typename T1, \
|
|
class Event, \
|
|
typename T2, \
|
|
void (frontname::*action)(Event const&), \
|
|
bool (frontname::*guard)(Event const&) \
|
|
> using row = typename base::template row<T1, Event, T2, action, guard>; \
|
|
template< \
|
|
typename T1, \
|
|
class Event, \
|
|
typename T2, \
|
|
void (frontname::*action)(Event const&) \
|
|
> using a_row = typename base::template a_row<T1, Event, T2, action>; \
|
|
template< \
|
|
typename T1, \
|
|
class Event, \
|
|
typename T2, \
|
|
bool (frontname::*guard)(Event const&) \
|
|
> using g_row = typename base::template g_row<T1, Event, T2, guard>;
|