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 9 10 11 #include <boost/statechart/event.hpp> 12 #include <boost/statechart/state_machine.hpp> 13 #include <boost/statechart/simple_state.hpp> 14 #include <boost/statechart/custom_reaction.hpp> 15 16 #include <boost/config.hpp> 17 18 #ifdef BOOST_INTEL 19 # pragma warning( disable: 304 ) // access control not specified 20 #endif 21 22 23 24 namespace sc = boost::statechart; 25 26 27 28 ////////////////////////////////////////////////////////////////////////////// 29 struct EvShutterHalf : sc::event< EvShutterHalf > {}; 30 struct EvShutterFull : sc::event< EvShutterFull > {}; 31 struct EvShutterRelease : sc::event< EvShutterRelease > {}; 32 struct EvConfig : sc::event< EvConfig > {}; 33 34 struct NotShooting; 35 struct Camera : sc::state_machine< Camera, NotShooting > 36 { IsMemoryAvailableCamera37 bool IsMemoryAvailable() const { return true; } IsBatteryLowCamera38 bool IsBatteryLow() const { return false; } 39 }; 40 41 struct Idle; 42 struct NotShooting : sc::simple_state< NotShooting, Camera, Idle > 43 { 44 typedef sc::custom_reaction< EvShutterHalf > reactions; 45 46 NotShooting(); 47 ~NotShooting(); 48 49 sc::result react( const EvShutterHalf & ); 50 }; 51 52 struct Idle : sc::simple_state< Idle, NotShooting > 53 { 54 typedef sc::custom_reaction< EvConfig > reactions; 55 56 Idle(); 57 ~Idle(); 58 59 sc::result react( const EvConfig & ); 60 }; 61 62 63 64 #endif 65