Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:32

0001 #ifndef BOOST_STATECHART_TRANSITION_HPP_INCLUDED
0002 #define BOOST_STATECHART_TRANSITION_HPP_INCLUDED
0003 //////////////////////////////////////////////////////////////////////////////
0004 // Copyright 2002-2008 Andreas Huber Doenni
0005 // Distributed under the Boost Software License, Version 1.0. (See accompany-
0006 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 //////////////////////////////////////////////////////////////////////////////
0008 
0009 
0010 
0011 #include <boost/statechart/result.hpp>
0012 
0013 #include <boost/statechart/detail/reaction_dispatcher.hpp>
0014 
0015 
0016 
0017 namespace boost
0018 {
0019 namespace statechart
0020 {
0021 
0022 
0023 
0024 //////////////////////////////////////////////////////////////////////////////
0025 template< class Event, class Destination,
0026           class TransitionContext = detail::no_context< Event >,
0027           void ( TransitionContext::*pTransitionAction )( const Event & ) =
0028             &detail::no_context< Event >::no_function >
0029 class transition
0030 {
0031   private:
0032     //////////////////////////////////////////////////////////////////////////
0033     template< class State >
0034     struct reactions
0035     {
0036       static result react_without_action( State & stt )
0037       {
0038         return stt.template transit< Destination >();
0039       }
0040 
0041       static result react_with_action( State & stt, const Event & evt )
0042       {
0043         return stt.template transit< Destination >( pTransitionAction, evt );
0044       }
0045     };
0046 
0047   public:
0048     //////////////////////////////////////////////////////////////////////////
0049     // The following declarations should be private.
0050     // They are only public because many compilers lack template friends.
0051     //////////////////////////////////////////////////////////////////////////
0052     template< class State, class EventBase, class IdType >
0053     static detail::reaction_result react(
0054       State & stt, const EventBase & evt, const IdType & eventType )
0055     {
0056       typedef detail::reaction_dispatcher<
0057         reactions< State >, State, EventBase, Event, TransitionContext, IdType
0058       > dispatcher;
0059       return dispatcher::react( stt, evt, eventType );
0060     }
0061 };
0062 
0063 
0064 
0065 } // namespace statechart
0066 } // namespace boost
0067 
0068 
0069 
0070 #endif