File indexing completed on 2025-01-18 09:52:31
0001 #ifndef BOOST_STATECHART_ASYNCHRONOUS_STATE_MACHINE_HPP_INCLUDED
0002 #define BOOST_STATECHART_ASYNCHRONOUS_STATE_MACHINE_HPP_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <boost/statechart/state_machine.hpp>
0012 #include <boost/statechart/fifo_scheduler.hpp>
0013 #include <boost/statechart/null_exception_translator.hpp>
0014 #include <boost/statechart/event_processor.hpp>
0015
0016 #include <memory> // std::allocator
0017
0018
0019 namespace boost
0020 {
0021 namespace statechart
0022 {
0023
0024
0025
0026 class event_base;
0027
0028
0029
0030
0031 template< class MostDerived,
0032 class InitialState,
0033 class Scheduler = fifo_scheduler<>,
0034 class Allocator = std::allocator< none >,
0035 class ExceptionTranslator = null_exception_translator >
0036 class asynchronous_state_machine : public state_machine<
0037 MostDerived, InitialState, Allocator, ExceptionTranslator >,
0038 public event_processor< Scheduler >
0039 {
0040 typedef state_machine< MostDerived,
0041 InitialState, Allocator, ExceptionTranslator > machine_base;
0042 typedef event_processor< Scheduler > processor_base;
0043 protected:
0044
0045 typedef asynchronous_state_machine my_base;
0046
0047 asynchronous_state_machine( typename processor_base::my_context ctx ) :
0048 processor_base( ctx )
0049 {
0050 }
0051
0052 virtual ~asynchronous_state_machine() {}
0053
0054 public:
0055
0056
0057
0058
0059 void terminate()
0060 {
0061 processor_base::terminate();
0062 }
0063
0064 private:
0065
0066 virtual void initiate_impl()
0067 {
0068 machine_base::initiate();
0069 }
0070
0071 virtual void process_event_impl( const event_base & evt )
0072 {
0073 machine_base::process_event( evt );
0074 }
0075
0076 virtual void terminate_impl()
0077 {
0078 machine_base::terminate();
0079 }
0080 };
0081
0082
0083
0084 }
0085 }
0086
0087
0088
0089 #endif