Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:58

0001 // Copyright 2008 Christophe Henry
0002 // henry UNDERSCORE christophe AT hotmail DOT com
0003 // This is taken from Boost.Proto's documentation
0004 // Copyright for the original version:
0005 // Copyright 2008 Eric Niebler. Distributed
0006 // under the Boost Software License, Version 1.0. (See accompanying
0007 // file LICENSE_1_0.txt or copy at
0008 // http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 #ifndef BOOST_MSM_BACK_FOLD_TO_LIST_H
0011 #define BOOST_MSM_BACK_FOLD_TO_LIST_H
0012 
0013 #include <boost/msm/proto_config.hpp>
0014 #include <boost/proto/core.hpp>
0015 #include <boost/proto/transform.hpp>
0016 #include <boost/msm/msm_grammar.hpp>
0017 #include <boost/fusion/container/list/cons.hpp>
0018 
0019 namespace boost { namespace msm { namespace back
0020 {
0021  struct state_copy_tag
0022  {
0023  };
0024 
0025 template<class X = proto::is_proto_expr>
0026 struct define_states_creation
0027 {
0028    BOOST_PROTO_BASIC_EXTENDS(
0029        proto::terminal<state_copy_tag>::type
0030      , define_states_creation
0031      , boost::msm::msm_domain
0032    )
0033 };
0034 
0035 define_states_creation<> const states_ = {{{}}};
0036 
0037  struct FoldToList
0038   : ::boost::proto::or_<
0039         // Don't add the states_ terminal to the list
0040         ::boost::proto::when<
0041             ::boost::proto::terminal< state_copy_tag >
0042           , ::boost::proto::_state
0043         >
0044         // Put all other terminals at the head of the
0045         // list that we're building in the "state" parameter
0046         // first states for the eUML states
0047       , ::boost::proto::when<
0048             ::boost::proto::terminal< state_tag >
0049             , boost::fusion::cons< ::boost::proto::_, ::boost::proto::_state>(
0050                 ::boost::proto::_, ::boost::proto::_state
0051             )
0052         >
0053         // then states from other front-ends
0054       , ::boost::proto::when<
0055       ::boost::proto::terminal< proto::_ >
0056             , boost::fusion::cons< ::boost::proto::_value, ::boost::proto::_state>(
0057                 ::boost::proto::_value, ::boost::proto::_state
0058     )
0059         >
0060         // For left-shift operations, first fold the right
0061         // child to a list using the current state. Use
0062         // the result as the state parameter when folding
0063         // the left child to a list.
0064       , ::boost::proto::when<
0065             ::boost::proto::shift_left<FoldToList, FoldToList>
0066           , FoldToList(
0067                 ::boost::proto::_left
0068               , ::boost::proto::call<FoldToList( ::boost::proto::_right, ::boost::proto::_state )>
0069             )
0070         >
0071     >
0072  {};
0073 
0074 }}}
0075 
0076 #endif //BOOST_MSM_BACK_FOLD_TO_LIST_H
0077