My Project
transition.hpp
Go to the documentation of this file.
1 #ifndef BOOST_STATECHART_TRANSITION_HPP_INCLUDED
2 #define BOOST_STATECHART_TRANSITION_HPP_INCLUDED
3 // Copyright 2002-2008 Andreas Huber Doenni
5 // Distributed under the Boost Software License, Version 1.0. (See accompany-
6 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 
10 
12 
13 #include <boost/statechart/detail/reaction_dispatcher.hpp>
14 
15 
16 
17 namespace boost
18 {
19 namespace statechart
20 {
21 
22 
23 
25 template< class Event, class Destination,
26  class TransitionContext = detail::no_context< Event >,
27  void ( TransitionContext::*pTransitionAction )( const Event & ) =
28  &detail::no_context< Event >::no_function >
30 {
31  private:
33  template< class State >
34  struct reactions
35  {
36  static result react_without_action( State & stt )
37  {
38  return stt.template transit< Destination >();
39  }
40 
41  static result react_with_action( State & stt, const Event & evt )
42  {
43  return stt.template transit< Destination >( pTransitionAction, evt );
44  }
45  };
46 
47  public:
49  // The following declarations should be private.
50  // They are only public because many compilers lack template friends.
52  template< class State, class EventBase, class IdType >
54  State & stt, const EventBase & evt, const IdType & eventType )
55  {
56  typedef detail::reaction_dispatcher<
57  reactions< State >, State, EventBase, Event, TransitionContext, IdType
58  > dispatcher;
59  return dispatcher::react( stt, evt, eventType );
60  }
61 };
62 
63 
64 
65 } // namespace statechart
66 } // namespace boost
67 
68 
69 
70 #endif
boost::statechart::transition
Definition: transition.hpp:30
boost::statechart::detail::safe_reaction_result
Definition: result.hpp:38
boost
Definition: asynchronous_state_machine.hpp:20
boost::statechart::detail::reaction_result
reaction_result
Definition: result.hpp:26
boost::statechart::transition::react
static detail::reaction_result react(State &stt, const EventBase &evt, const IdType &eventType)
Definition: transition.hpp:53
result.hpp