Shooting.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #include "Camera.hpp"
  9. #include <boost/statechart/event.hpp>
  10. #include <boost/statechart/simple_state.hpp>
  11. #include <boost/statechart/state.hpp>
  12. #include <boost/statechart/transition.hpp>
  13. #include <boost/statechart/custom_reaction.hpp>
  14. #include <boost/statechart/deferral.hpp>
  15. #include <boost/mpl/list.hpp>
  16. #include <boost/config.hpp>
  17. #ifdef BOOST_INTEL
  18. # pragma warning( disable: 304 ) // access control not specified
  19. #endif
  20. namespace sc = boost::statechart;
  21. namespace mpl = boost::mpl;
  22. //////////////////////////////////////////////////////////////////////////////
  23. struct EvInFocus : sc::event< EvInFocus > {};
  24. struct Focusing;
  25. struct Shooting : sc::simple_state< Shooting, Camera, Focusing >
  26. {
  27. typedef sc::transition< EvShutterRelease, NotShooting > reactions;
  28. Shooting();
  29. ~Shooting();
  30. void DisplayFocused( const EvInFocus & )
  31. {
  32. std::cout << "Focused!\n";
  33. }
  34. };
  35. struct Focusing : sc::state< Focusing, Shooting >
  36. {
  37. typedef mpl::list<
  38. sc::custom_reaction< EvInFocus >,
  39. sc::deferral< EvShutterFull >
  40. > reactions;
  41. Focusing( my_context ctx );
  42. sc::result react( const EvInFocus & );
  43. };
  44. #endif