Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59076 - in sandbox/msm/boost/msm/front: . detail
From: christophe.j.henry_at_[hidden]
Date: 2010-01-16 12:10:48


Author: chenry
Date: 2010-01-16 12:10:47 EST (Sat, 16 Jan 2010)
New Revision: 59076
URL: http://svn.boost.org/trac/boost/changeset/59076

Log:
added more rows
Added:
   sandbox/msm/boost/msm/front/detail/
   sandbox/msm/boost/msm/front/detail/row2_helper.hpp (contents, props changed)
Text files modified:
   sandbox/msm/boost/msm/front/row2.hpp | 77 ++++++++++-----------------------------
   1 files changed, 21 insertions(+), 56 deletions(-)

Added: sandbox/msm/boost/msm/front/detail/row2_helper.hpp
==============================================================================
--- (empty file)
+++ sandbox/msm/boost/msm/front/detail/row2_helper.hpp 2010-01-16 12:10:47 EST (Sat, 16 Jan 2010)
@@ -0,0 +1,71 @@
+// 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_ROW2_HELPER_HPP
+#define BOOST_MSM_ROW2_HELPER_HPP
+
+#include <boost/mpl/bool.hpp>
+#include <boost/fusion/include/at_key.hpp>
+
+namespace boost { namespace msm { namespace front
+{
+ namespace detail
+ {
+ template<
+ typename CalledForAction
+ , typename Event
+ , void (CalledForAction::*action)(Event const&)
+ >
+ struct row2_action_helper
+ {
+ template <class FSM,class Event,class SourceState,class TargetState, class AllStates>
+ static void call_helper(FSM&,Event const& evt,SourceState&,TargetState&,
+ AllStates& all_states,::boost::mpl::false_ const &)
+ {
+ // in this front-end, we don't need to know source and target states
+ ( ::boost::fusion::at_key<CalledForAction>(all_states).*action)(evt);
+ }
+ template <class FSM,class Event,class SourceState,class TargetState, class AllStates>
+ static void call_helper(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&,
+ ::boost::mpl::true_ const &)
+ {
+ // in this front-end, we don't need to know source and target states
+ (fsm.*action)(evt);
+ }
+ };
+
+ template<
+ typename CalledForGuard
+ , typename Event
+ , bool (CalledForGuard::*guard)(Event const&)
+ >
+ struct row2_guard_helper
+ {
+ template <class FSM,class Event,class SourceState,class TargetState,class AllStates>
+ static bool call_helper(FSM&,Event const& evt,SourceState&,TargetState&,
+ AllStates& all_states, ::boost::mpl::false_ const &)
+ {
+ // in this front-end, we don't need to know source and target states
+ return ( ::boost::fusion::at_key<CalledForGuard>(all_states).*guard)(evt);
+ }
+ template <class FSM,class Event,class SourceState,class TargetState,class AllStates>
+ static bool call_helper(FSM& fsm,Event const& evt,SourceState&,TargetState&,
+ AllStates&,::boost::mpl::true_ const &)
+ {
+ // in this front-end, we don't need to know source and target states
+ return (fsm.*guard)(evt);
+ }
+ };
+ }
+
+}}}
+
+#endif //BOOST_MSM_ROW2_HELPER_HPP
+

Modified: sandbox/msm/boost/msm/front/row2.hpp
==============================================================================
--- sandbox/msm/boost/msm/front/row2.hpp (original)
+++ sandbox/msm/boost/msm/front/row2.hpp 2010-01-16 12:10:47 EST (Sat, 16 Jan 2010)
@@ -15,57 +15,22 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/fusion/include/at_key.hpp>
 #include <boost/msm/row_tags.hpp>
+#include <boost/msm/front/detail/row2_helper.hpp>
 
 namespace boost { namespace msm { namespace front
 {
- namespace detail
- {
- template<
- typename CalledForAction
- , typename Event
- , void (CalledForAction::*action)(Event const&)
- >
- struct row2_action_helper
- {
- template <class FSM,class Event,class SourceState,class TargetState, class AllStates>
- static void call_helper(FSM&,Event const& evt,SourceState&,TargetState&,
- AllStates& all_states,::boost::mpl::false_ const &)
- {
- // in this front-end, we don't need to know source and target states
- ( ::boost::fusion::at_key<CalledForAction>(all_states).*action)(evt);
- }
- template <class FSM,class Event,class SourceState,class TargetState, class AllStates>
- static void call_helper(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&,
- ::boost::mpl::true_ const &)
- {
- // in this front-end, we don't need to know source and target states
- (fsm.*action)(evt);
- }
- };
-
- template<
- typename CalledForGuard
- , typename Event
- , bool (CalledForGuard::*guard)(Event const&)
- >
- struct row2_guard_helper
- {
- template <class FSM,class Event,class SourceState,class TargetState,class AllStates>
- static bool call_helper(FSM&,Event const& evt,SourceState&,TargetState&,
- AllStates& all_states, ::boost::mpl::false_ const &)
- {
- // in this front-end, we don't need to know source and target states
- return ( ::boost::fusion::at_key<CalledForGuard>(all_states).*guard)(evt);
- }
- template <class FSM,class Event,class SourceState,class TargetState,class AllStates>
- static bool call_helper(FSM& fsm,Event const& evt,SourceState&,TargetState&,
- AllStates&,::boost::mpl::true_ const &)
- {
- // in this front-end, we don't need to know source and target states
- return (fsm.*guard)(evt);
- }
- };
- }
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ >
+ struct _row2
+ {
+ typedef _row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ };
 
         template<
                 typename T1
@@ -85,7 +50,7 @@
                                 AllStates& all_states)
         {
             // in this front-end, we don't need to know source and target states
- detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::template call_helper
                 (fsm,evt,src,tgt,all_states,
                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
         }
@@ -111,7 +76,7 @@
                                 AllStates& all_states)
         {
             // in this front-end, we don't need to know source and target states
- detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
                 (fsm,evt,src,tgt,all_states,
                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
         }
@@ -120,7 +85,7 @@
                                AllStates& all_states)
         {
             // in this front-end, we don't need to know source and target states
- return detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
                 (fsm,evt,src,tgt,all_states,
                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
         }
@@ -143,7 +108,7 @@
                                AllStates& all_states)
         {
             // in this front-end, we don't need to know source and target states
- return detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
                 (fsm,evt,src,tgt,all_states,
                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
         }
@@ -166,7 +131,7 @@
                                 AllStates& all_states)
         {
             // in this front-end, we don't need to know source and target states
- detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
                 (fsm,evt,src,tgt,all_states,
                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
         }
@@ -191,7 +156,7 @@
                                 AllStates& all_states)
         {
             // in this front-end, we don't need to know source and target states
- detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
                 (fsm,evt,src,tgt,all_states,
                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
         }
@@ -200,7 +165,7 @@
                                AllStates& all_states)
         {
             // in this front-end, we don't need to know source and target states
- return detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
                 (fsm,evt,src,tgt,all_states,
                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
         }
@@ -222,7 +187,7 @@
                                AllStates& all_states)
         {
             // in this front-end, we don't need to know source and target states
- return detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
                 (fsm,evt,src,tgt,all_states,
                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
         }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk