Camera.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef BOOST_STATECHART_EXAMPLE_CAMERA_HPP_INCLUDED
  2. #define BOOST_STATECHART_EXAMPLE_CAMERA_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 <boost/statechart/event.hpp>
  9. #include <boost/statechart/state_machine.hpp>
  10. #include <boost/statechart/simple_state.hpp>
  11. #include <boost/statechart/custom_reaction.hpp>
  12. #include <boost/config.hpp>
  13. #ifdef BOOST_INTEL
  14. # pragma warning( disable: 304 ) // access control not specified
  15. #endif
  16. namespace sc = boost::statechart;
  17. //////////////////////////////////////////////////////////////////////////////
  18. struct EvShutterHalf : sc::event< EvShutterHalf > {};
  19. struct EvShutterFull : sc::event< EvShutterFull > {};
  20. struct EvShutterRelease : sc::event< EvShutterRelease > {};
  21. struct EvConfig : sc::event< EvConfig > {};
  22. struct NotShooting;
  23. struct Camera : sc::state_machine< Camera, NotShooting >
  24. {
  25. bool IsMemoryAvailable() const { return true; }
  26. bool IsBatteryLow() const { return false; }
  27. };
  28. struct Idle;
  29. struct NotShooting : sc::simple_state< NotShooting, Camera, Idle >
  30. {
  31. typedef sc::custom_reaction< EvShutterHalf > reactions;
  32. NotShooting();
  33. ~NotShooting();
  34. sc::result react( const EvShutterHalf & );
  35. };
  36. struct Idle : sc::simple_state< Idle, NotShooting >
  37. {
  38. typedef sc::custom_reaction< EvConfig > reactions;
  39. Idle();
  40. ~Idle();
  41. sc::result react( const EvConfig & );
  42. };
  43. #endif