the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 71 lines 2.0 kB view raw
1#ifndef BOOST_STATECHART_TERMINATION_HPP_INCLUDED 2#define BOOST_STATECHART_TERMINATION_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/result.hpp> 12 13 14 15namespace boost 16{ 17namespace statechart 18{ 19 20 21 22class event_base; 23 24////////////////////////////////////////////////////////////////////////////// 25template< class Event > 26class termination 27{ 28 public: 29 ////////////////////////////////////////////////////////////////////////// 30 // The following declarations should be private. 31 // They are only public because many compilers lack template friends. 32 ////////////////////////////////////////////////////////////////////////// 33 template< class State, class EventBase, class IdType > 34 static detail::reaction_result react( 35 State & stt, const EventBase &, const IdType & eventType ) 36 { 37 if ( eventType == Event::static_type() ) 38 { 39 return detail::result_utility::get_result( stt.terminate() ); 40 } 41 else 42 { 43 return detail::no_reaction; 44 } 45 } 46}; 47 48template<> 49class termination< event_base > 50{ 51 public: 52 ////////////////////////////////////////////////////////////////////////// 53 // The following declarations should be private. 54 // They are only public because many compilers lack template friends. 55 ////////////////////////////////////////////////////////////////////////// 56 template< class State, class EventBase, class IdType > 57 static detail::reaction_result react( 58 State & stt, const EventBase &, const IdType & ) 59 { 60 return detail::result_utility::get_result( stt.terminate() ); 61 } 62}; 63 64 65 66} // namespace statechart 67} // namespace boost 68 69 70 71#endif