My Project
in_state_reaction.hpp
Go to the documentation of this file.
1 #ifndef BOOST_STATECHART_IN_STATE_REACTION_HPP_INCLUDED
2 #define BOOST_STATECHART_IN_STATE_REACTION_HPP_INCLUDED
3 // Copyright 2005-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 
24 class event_base;
25 
27 template< class Event,
28  class ReactionContext = detail::no_context< Event >,
29  void ( ReactionContext::*pAction )( const Event & ) =
30  &detail::no_context< Event >::no_function >
32 {
33  private:
35  template< class State >
36  struct reactions
37  {
38  static result react_without_action( State & stt )
39  {
40  return stt.discard_event();
41  }
42 
43  static result react_with_action( State & stt, const Event & evt )
44  {
45  ( stt.template context< ReactionContext >().*pAction )( evt );
46  return react_without_action( stt );
47  }
48  };
49 
50  public:
52  // The following declarations should be private.
53  // They are only public because many compilers lack template friends.
55  template< class State, class EventBase, class IdType >
57  State & stt, const EventBase & evt, const IdType & eventType )
58  {
59  typedef detail::reaction_dispatcher<
60  reactions< State >, State, EventBase, Event, ReactionContext, IdType
61  > dispatcher;
62  return dispatcher::react( stt, evt, eventType );
63  }
64 };
65 
66 
67 
68 } // namespace statechart
69 } // namespace boost
70 
71 
72 
73 #endif
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::in_state_reaction::react
static detail::reaction_result react(State &stt, const EventBase &evt, const IdType &eventType)
Definition: in_state_reaction.hpp:56
boost::statechart::in_state_reaction
Definition: in_state_reaction.hpp:32
result.hpp