Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-17 08:50:41

0001 // Copyright 2025 Christian Granzin
0002 // Copyright 2008 Christophe Henry
0003 // henry UNDERSCORE christophe AT hotmail DOT com
0004 // This is an extended version of the state machine available in the boost::mpl library
0005 // Distributed under the same license as the original.
0006 // Copyright for the original version:
0007 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
0008 // under the Boost Software License, Version 1.0. (See accompanying
0009 // file LICENSE_1_0.txt or copy at
0010 // http://www.boost.org/LICENSE_1_0.txt)
0011 
0012 #ifndef BOOST_MSM_BACKMP11_DISPATCH_TABLE_H
0013 #define BOOST_MSM_BACKMP11_DISPATCH_TABLE_H
0014 
0015 #include <cstdint>
0016 #include <cstddef>
0017 
0018 #include <boost/mp11.hpp>
0019 #include <boost/msm/backmp11/common_types.hpp>
0020 
0021 namespace boost { namespace msm { namespace backmp11
0022 {
0023 
0024 namespace detail
0025 {
0026 
0027 // Value used to initialize a cell of the dispatch table
0028 template<typename Cell>
0029 struct init_cell_value
0030 {
0031     size_t index;
0032     Cell address;
0033 };
0034 template<size_t v1, typename Cell, Cell v2>
0035 struct init_cell_constant
0036 {
0037     static constexpr init_cell_value<Cell> value = {v1, v2};
0038 };
0039 
0040 // Type-punned init cell value to suppress redundant template instantiations
0041 typedef std::uintptr_t generic_cell; 
0042 struct generic_init_cell_value
0043 {
0044     size_t index;
0045     generic_cell address;
0046 };
0047 
0048 // Helper to create an array of init cell values for table initialization
0049 template<typename Cell, typename InitCellConstants, std::size_t... I>
0050 static const init_cell_value<Cell>* get_init_cells_impl(mp11::index_sequence<I...>)
0051 {
0052     static constexpr init_cell_value<Cell> values[] {mp11::mp_at_c<InitCellConstants, I>::value...};
0053     return values;
0054 }
0055 template<typename Cell, typename InitCellConstants>
0056 static const init_cell_value<Cell>* get_init_cells_impl(mp11::index_sequence<>)
0057 {
0058     return nullptr;
0059 }
0060 template<typename Cell, typename InitCellConstants>
0061 static const generic_init_cell_value* get_init_cells()
0062 {
0063     return reinterpret_cast<const generic_init_cell_value*>(
0064         get_init_cells_impl<Cell, InitCellConstants>(mp11::make_index_sequence<mp11::mp_size<InitCellConstants>::value>{}));
0065 }
0066 
0067 } // detail
0068 
0069 }}} // boost::msm::backmp11
0070 
0071 #endif //BOOST_MSM_BACKMP11_DISPATCH_TABLE_H