File indexing completed on 2025-01-30 10:00:51
0001 #ifndef BOOST_STATECHART_EVENT_PROCESSOR_INCLUDED
0002 #define BOOST_STATECHART_EVENT_PROCESSOR_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011 namespace boost
0012 {
0013 namespace statechart
0014 {
0015
0016
0017
0018 class event_base;
0019
0020
0021
0022
0023 template< class Scheduler >
0024 class event_processor
0025 {
0026 public:
0027
0028 virtual ~event_processor() {}
0029
0030 Scheduler & my_scheduler() const
0031 {
0032 return myScheduler_;
0033 }
0034
0035 typedef typename Scheduler::processor_handle processor_handle;
0036
0037 processor_handle my_handle() const
0038 {
0039 return myHandle_;
0040 }
0041
0042 void initiate()
0043 {
0044 initiate_impl();
0045 }
0046
0047 void process_event( const event_base & evt )
0048 {
0049 process_event_impl( evt );
0050 }
0051
0052 void terminate()
0053 {
0054 terminate_impl();
0055 }
0056
0057 protected:
0058
0059 typedef const typename Scheduler::processor_context & my_context;
0060
0061 event_processor( my_context ctx ) :
0062 myScheduler_( ctx.my_scheduler() ),
0063 myHandle_( ctx.my_handle() )
0064 {
0065 }
0066
0067 private:
0068
0069 virtual void initiate_impl() = 0;
0070 virtual void process_event_impl( const event_base & evt ) = 0;
0071 virtual void terminate_impl() = 0;
0072
0073
0074 event_processor & operator=( const event_processor & );
0075
0076 Scheduler & myScheduler_;
0077 const processor_handle myHandle_;
0078 };
0079
0080
0081
0082 }
0083 }
0084
0085
0086
0087 #endif