I have a difficulty in understanding the boost statechart history
functionality.
I have the following state machine.
struct InButtonPressed : sc::event<InButtonPressed> {};
struct OutButtonPressed : sc::event<OutButtonPressed> {};
struct InButtonPressed : sc::event<InButtonPressed> {};
struct InputProceed: sc::event<InputProceed> {};
struct OutputProceed: sc::event<OutputProceed> {};
struct CancelEvent: sc::event<CancelEvent> {};
struct Proceed: sc::event<Proceed> {};
struct Revert: sc::event<InputProceed> {};
struct RH_StateMachine : bsc::state_machine< RH_StateMachine, Idle > {};
struct Idle : bsc::state< Idle, RH_StateMachine> {
Idle(my_context ctx) : my_base(ctx){
std::cout << "[+] Idle" << std::endl;
}
~Idle(){std::cout << "[-] leaving Idle state... \n";}
typedef boost::mpl::list< bsc::transition< InButtonPressed, Input>,
bsc::transition< OutButtonPressed, Output>
>reactions;
};
struct Input : bsc::state< Input, RH_StateMachine> {
Input(my_context ctx) : my_base(ctx){
std::cout << "[+] Input" << std::endl;
}
~Input(){std::cout << "[-] leaving Input state... \n";}
typedef boost::bsc::transition< CancelEvent, Cancel>
>reactions;
};
struct Output : bsc::state< Output, RH_StateMachine> {
Output(my_context ctx) : my_base(ctx){
std::cout << "[+] Output" << std::endl;
}
~Output(){std::cout << "[-] leaving Output state... \n";}
typedef boost::bsc::transition< CancelEvent, Cancel>
>reactions;
};
struct Cancel::bsc::state