sl@0
|
1 |
#ifndef BOOST_STATECHART_DEFERRAL_HPP_INCLUDED
|
sl@0
|
2 |
#define BOOST_STATECHART_DEFERRAL_HPP_INCLUDED
|
sl@0
|
3 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
4 |
// Copyright 2002-2006 Andreas Huber Doenni
|
sl@0
|
5 |
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
sl@0
|
6 |
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
7 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
8 |
|
sl@0
|
9 |
|
sl@0
|
10 |
|
sl@0
|
11 |
#include <boost/statechart/result.hpp>
|
sl@0
|
12 |
|
sl@0
|
13 |
|
sl@0
|
14 |
|
sl@0
|
15 |
namespace boost
|
sl@0
|
16 |
{
|
sl@0
|
17 |
namespace statechart
|
sl@0
|
18 |
{
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
class event_base;
|
sl@0
|
23 |
|
sl@0
|
24 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
25 |
template< class Event >
|
sl@0
|
26 |
class deferral
|
sl@0
|
27 |
{
|
sl@0
|
28 |
public:
|
sl@0
|
29 |
//////////////////////////////////////////////////////////////////////////
|
sl@0
|
30 |
// The following declarations should be private.
|
sl@0
|
31 |
// They are only public because many compilers lack template friends.
|
sl@0
|
32 |
//////////////////////////////////////////////////////////////////////////
|
sl@0
|
33 |
template< class State, class EventBase, class IdType >
|
sl@0
|
34 |
static detail::reaction_result react(
|
sl@0
|
35 |
State & stt, const EventBase &, const IdType & eventType )
|
sl@0
|
36 |
{
|
sl@0
|
37 |
if ( eventType == Event::static_type() )
|
sl@0
|
38 |
{
|
sl@0
|
39 |
return detail::result_utility::get_result( stt.defer_event() );
|
sl@0
|
40 |
}
|
sl@0
|
41 |
else
|
sl@0
|
42 |
{
|
sl@0
|
43 |
return detail::no_reaction;
|
sl@0
|
44 |
}
|
sl@0
|
45 |
}
|
sl@0
|
46 |
};
|
sl@0
|
47 |
|
sl@0
|
48 |
template<>
|
sl@0
|
49 |
class deferral< event_base >
|
sl@0
|
50 |
{
|
sl@0
|
51 |
public:
|
sl@0
|
52 |
//////////////////////////////////////////////////////////////////////////
|
sl@0
|
53 |
// The following declarations should be private.
|
sl@0
|
54 |
// They are only public because many compilers lack template friends.
|
sl@0
|
55 |
//////////////////////////////////////////////////////////////////////////
|
sl@0
|
56 |
template< class State, class EventBase, class IdType >
|
sl@0
|
57 |
static detail::reaction_result react(
|
sl@0
|
58 |
State & stt, const EventBase &, const IdType & )
|
sl@0
|
59 |
{
|
sl@0
|
60 |
return detail::result_utility::get_result( stt.defer_event() );
|
sl@0
|
61 |
}
|
sl@0
|
62 |
};
|
sl@0
|
63 |
|
sl@0
|
64 |
|
sl@0
|
65 |
|
sl@0
|
66 |
} // namespace statechart
|
sl@0
|
67 |
} // namespace boost
|
sl@0
|
68 |
|
sl@0
|
69 |
|
sl@0
|
70 |
|
sl@0
|
71 |
#endif
|