My Project
event_processor.hpp
Go to the documentation of this file.
1 #ifndef BOOST_STATECHART_EVENT_PROCESSOR_INCLUDED
2 #define BOOST_STATECHART_EVENT_PROCESSOR_INCLUDED
3 // Copyright 2002-2008 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)
8 
9 
10 
11 namespace boost
12 {
13 namespace statechart
14 {
15 
16 
17 
18 class event_base;
19 
20 
21 
23 template< class Scheduler >
25 {
26  public:
28  virtual ~event_processor() {}
29 
30  Scheduler & my_scheduler() const
31  {
32  return myScheduler_;
33  }
34 
35  typedef typename Scheduler::processor_handle processor_handle;
36 
38  {
39  return myHandle_;
40  }
41 
42  void initiate()
43  {
44  initiate_impl();
45  }
46 
47  void process_event( const event_base & evt )
48  {
49  process_event_impl( evt );
50  }
51 
52  void terminate()
53  {
54  terminate_impl();
55  }
56 
57  protected:
59  typedef const typename Scheduler::processor_context & my_context;
60 
62  myScheduler_( ctx.my_scheduler() ),
63  myHandle_( ctx.my_handle() )
64  {
65  }
66 
67  private:
69  virtual void initiate_impl() = 0;
70  virtual void process_event_impl( const event_base & evt ) = 0;
71  virtual void terminate_impl() = 0;
72 
73  // avoids C4512 (assignment operator could not be generated)
74  event_processor & operator=( const event_processor & );
75 
76  Scheduler & myScheduler_;
77  const processor_handle myHandle_;
78 };
79 
80 
81 
82 } // namespace statechart
83 } // namespace boost
84 
85 
86 
87 #endif
boost::statechart::event_processor::terminate
void terminate()
Definition: event_processor.hpp:52
boost::statechart::event_processor
Definition: event_processor.hpp:25
boost::statechart::event_processor::my_handle
processor_handle my_handle() const
Definition: event_processor.hpp:37
boost::statechart::event_processor::processor_handle
Scheduler::processor_handle processor_handle
Definition: event_processor.hpp:35
boost
Definition: asynchronous_state_machine.hpp:20
boost::statechart::event_processor::~event_processor
virtual ~event_processor()
Definition: event_processor.hpp:28
boost::statechart::event_processor::initiate
void initiate()
Definition: event_processor.hpp:42
boost::statechart::event_processor::process_event
void process_event(const event_base &evt)
Definition: event_processor.hpp:47
boost::statechart::event_base
Definition: event_base.hpp:51
boost::statechart::event_processor::my_context
const Scheduler::processor_context & my_context
Definition: event_processor.hpp:59
boost::statechart::event_processor::event_processor
event_processor(my_context ctx)
Definition: event_processor.hpp:61
boost::statechart::event_processor::my_scheduler
Scheduler & my_scheduler() const
Definition: event_processor.hpp:30