1 //////////////////////////////////////////////////////////////////////////////
2 // Copyright 2002-2006 Andreas Huber Doenni
3 // Distributed under the Boost Software License, Version 1.0. (See accompany-
4 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 //////////////////////////////////////////////////////////////////////////////
9 #include "Precompiled.hpp"
10 #include "Shooting.hpp"
13 #include <boost/config.hpp>
16 # pragma warning( disable: 383 ) // reference to temporary used
21 //////////////////////////////////////////////////////////////////////////////
24 std::cout << "Entering Shooting\n";
29 std::cout << "Exiting Shooting\n";
32 //////////////////////////////////////////////////////////////////////////////
33 struct Storing : sc::simple_state< Storing, Shooting >
37 std::cout << "Picture taken!\n";
41 //////////////////////////////////////////////////////////////////////////////
42 struct Focused : sc::simple_state< Focused, Shooting >
44 typedef sc::custom_reaction< EvShutterFull > reactions;
46 sc::result react( const EvShutterFull & );
49 sc::result Focused::react( const EvShutterFull & )
51 if ( context< Camera >().IsMemoryAvailable() )
53 return transit< Storing >();
57 std::cout << "Cache memory full. Please wait...\n";
58 return discard_event();
62 //////////////////////////////////////////////////////////////////////////////
63 Focusing::Focusing( my_context ctx ) : my_base( ctx )
65 post_event( boost::intrusive_ptr< EvInFocus >( new EvInFocus() ) );
68 sc::result Focusing::react( const EvInFocus & evt )
70 return transit< Focused >( &Shooting::DisplayFocused, evt );