fix doc example typo
[boost.git] / boost / statechart / event_processor.hpp
blobf764a6dc475ff2ed865486c4112caaa771889e31
1 #ifndef BOOST_STATECHART_EVENT_PROCESSOR_INCLUDED
2 #define BOOST_STATECHART_EVENT_PROCESSOR_INCLUDED
3 //////////////////////////////////////////////////////////////////////////////
4 // 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)
7 //////////////////////////////////////////////////////////////////////////////
11 namespace boost
13 namespace statechart
18 class event_base;
22 //////////////////////////////////////////////////////////////////////////////
23 template< class Scheduler >
24 class event_processor
26 public:
27 //////////////////////////////////////////////////////////////////////////
28 virtual ~event_processor() {}
30 Scheduler & my_scheduler() const
32 return myScheduler_;
35 typedef typename Scheduler::processor_handle processor_handle;
37 processor_handle my_handle() const
39 return myHandle_;
42 void initiate()
44 initiate_impl();
47 void process_event( const event_base & evt )
49 process_event_impl( evt );
52 void terminate()
54 terminate_impl();
57 protected:
58 //////////////////////////////////////////////////////////////////////////
59 typedef const typename Scheduler::processor_context & my_context;
61 event_processor( my_context ctx ) :
62 myScheduler_( ctx.my_scheduler() ),
63 myHandle_( ctx.my_handle() )
67 private:
68 //////////////////////////////////////////////////////////////////////////
69 virtual void initiate_impl() = 0;
70 virtual void process_event_impl( const event_base & evt ) = 0;
71 virtual void terminate_impl() = 0;
73 // avoids C4512 (assignment operator could not be generated)
74 event_processor & operator=( const event_processor & );
76 Scheduler & myScheduler_;
77 const processor_handle myHandle_;
82 } // namespace statechart
83 } // namespace boost
87 #endif