Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:32

0001 #ifndef BOOST_STATECHART_TERMINATION_HPP_INCLUDED
0002 #define BOOST_STATECHART_TERMINATION_HPP_INCLUDED
0003 //////////////////////////////////////////////////////////////////////////////
0004 // Copyright 2002-2006 Andreas Huber Doenni
0005 // Distributed under the Boost Software License, Version 1.0. (See accompany-
0006 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 //////////////////////////////////////////////////////////////////////////////
0008 
0009 
0010 
0011 #include <boost/statechart/result.hpp>
0012 
0013 
0014 
0015 namespace boost
0016 {
0017 namespace statechart
0018 {
0019 
0020 
0021 
0022 class event_base;
0023 
0024 //////////////////////////////////////////////////////////////////////////////
0025 template< class Event >
0026 class termination
0027 {
0028   public:
0029     //////////////////////////////////////////////////////////////////////////
0030     // The following declarations should be private.
0031     // They are only public because many compilers lack template friends.
0032     //////////////////////////////////////////////////////////////////////////
0033     template< class State, class EventBase, class IdType >
0034     static detail::reaction_result react(
0035       State & stt, const EventBase &, const IdType & eventType )
0036     {
0037       if ( eventType == Event::static_type() )
0038       {
0039         return detail::result_utility::get_result( stt.terminate() );
0040       }
0041       else
0042       {
0043         return detail::no_reaction;
0044       }
0045     }
0046 };
0047 
0048 template<>
0049 class termination< event_base >
0050 {
0051   public:
0052     //////////////////////////////////////////////////////////////////////////
0053     // The following declarations should be private.
0054     // They are only public because many compilers lack template friends.
0055     //////////////////////////////////////////////////////////////////////////
0056     template< class State, class EventBase, class IdType >
0057     static detail::reaction_result react(
0058       State & stt, const EventBase &, const IdType & )
0059     {
0060       return detail::result_utility::get_result( stt.terminate() );
0061     }
0062 };
0063 
0064 
0065 
0066 } // namespace statechart
0067 } // namespace boost
0068 
0069 
0070 
0071 #endif