Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/statechart/asynchronous_state_machine.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.5 KB
Line 
1#ifndef BOOST_STATECHART_ASYNCHRONOUS_STATE_MACHINE_HPP_INCLUDED
2#define BOOST_STATECHART_ASYNCHRONOUS_STATE_MACHINE_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/state_machine.hpp>
12#include <boost/statechart/fifo_scheduler.hpp>
13#include <boost/statechart/null_exception_translator.hpp>
14#include <boost/statechart/event_processor.hpp>
15
16#include <memory>   // std::allocator
17
18
19namespace boost
20{
21namespace statechart
22{
23
24
25
26class event_base;
27
28
29
30//////////////////////////////////////////////////////////////////////////////
31template< class MostDerived,
32          class InitialState,
33          class Scheduler = fifo_scheduler<>,
34          class Allocator = std::allocator< void >,
35          class ExceptionTranslator = null_exception_translator >
36class asynchronous_state_machine : public state_machine<
37  MostDerived, InitialState, Allocator, ExceptionTranslator >,
38  public event_processor< Scheduler >
39{
40  typedef state_machine< MostDerived,
41    InitialState, Allocator, ExceptionTranslator > machine_base;
42  typedef event_processor< Scheduler > processor_base;
43  protected:
44    //////////////////////////////////////////////////////////////////////////
45    typedef asynchronous_state_machine my_base;
46
47    asynchronous_state_machine( typename processor_base::my_context ctx ) :
48      processor_base( ctx )
49    {
50    }
51
52    virtual ~asynchronous_state_machine() {}
53
54  public:
55    //////////////////////////////////////////////////////////////////////////
56    // The following declarations should be private.
57    // They are only public because many compilers lack template friends.
58    //////////////////////////////////////////////////////////////////////////
59    void terminate()
60    {
61      processor_base::terminate();
62    }
63
64  private:
65    //////////////////////////////////////////////////////////////////////////
66    virtual void initiate_impl()
67    {
68      machine_base::initiate();
69    }
70
71    virtual void process_event_impl( const event_base & evt )
72    {
73      machine_base::process_event( evt );
74    }
75
76    virtual void terminate_impl()
77    {
78      machine_base::terminate();
79    }
80};
81
82
83
84} // namespace statechart
85} // namespace boost
86
87
88
89#endif
Note: See TracBrowser for help on using the repository browser.