1 2 #ifndef BOOST_FSM_STATE_INCLUDED 3 #define BOOST_FSM_STATE_INCLUDED 4 5 // Copyright Aleksey Gurtovoy 2002-2004 6 // 7 // Distributed under the Boost Software License, Version 1.0. 8 // (See accompanying file LICENSE_1_0.txt or copy at 9 // http://www.boost.org/LICENSE_1_0.txt) 10 // 11 // See http://www.boost.org/libs/mpl for documentation. 12 13 // $Id$ 14 // $Date$ 15 // $Revision$ 16 17 #include <boost/mpl/integral_c.hpp> 18 19 namespace fsm { namespace aux { 20 21 namespace mpl = boost::mpl; 22 23 // represent a FSM state 24 25 template< 26 typename T 27 , long State 28 , void (T::* invariant_func)() const 29 > 30 struct state 31 : mpl::integral_c<long,State> 32 { do_check_invariantfsm::aux::state33 static long do_check_invariant(T const& x) 34 { 35 if (invariant_func) (x.*invariant_func)(); 36 return State; 37 } 38 }; 39 40 }} 41 42 #endif // BOOST_FSM_STATE_INCLUDED 43