• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef BOOST_STATECHART_EXAMPLE_SHOOTING_HPP_INCLUDED
2 #define BOOST_STATECHART_EXAMPLE_SHOOTING_HPP_INCLUDED
3 //////////////////////////////////////////////////////////////////////////////
4 // Copyright 2002-2006 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)
7 //////////////////////////////////////////////////////////////////////////////
8 
9 
10 
11 #include "Camera.hpp"
12 
13 #include <boost/statechart/event.hpp>
14 #include <boost/statechart/simple_state.hpp>
15 #include <boost/statechart/state.hpp>
16 #include <boost/statechart/transition.hpp>
17 #include <boost/statechart/custom_reaction.hpp>
18 #include <boost/statechart/deferral.hpp>
19 
20 #include <boost/mpl/list.hpp>
21 #include <boost/config.hpp>
22 
23 #ifdef BOOST_INTEL
24 #  pragma warning( disable: 304 ) // access control not specified
25 #endif
26 
27 
28 
29 namespace sc = boost::statechart;
30 namespace mpl = boost::mpl;
31 
32 
33 
34 //////////////////////////////////////////////////////////////////////////////
35 struct EvInFocus : sc::event< EvInFocus > {};
36 
37 struct Focusing;
38 struct Shooting : sc::simple_state< Shooting, Camera, Focusing >
39 {
40   typedef sc::transition< EvShutterRelease, NotShooting > reactions;
41 
42   Shooting();
43   ~Shooting();
44 
DisplayFocusedShooting45   void DisplayFocused( const EvInFocus & )
46   {
47     std::cout << "Focused!\n";
48   }
49 };
50 
51   struct Focusing : sc::state< Focusing, Shooting >
52   {
53     typedef mpl::list<
54       sc::custom_reaction< EvInFocus >,
55       sc::deferral< EvShutterFull >
56     > reactions;
57 
58     Focusing( my_context ctx );
59     sc::result react( const EvInFocus & );
60   };
61 
62 
63 
64 #endif
65