mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-26 20:38:45 +08:00
Added experimental FSM template.
This commit is contained in:
parent
a0f3b45643
commit
3bb2b5fed6
@ -96,13 +96,28 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
//*******************************************
|
||||
etl::fsm_state_id_t get_state_id() const
|
||||
{
|
||||
return state_id;
|
||||
}
|
||||
|
||||
virtual etl::fsm_state_id_t on_event(const etl::ifsm_event& event) = 0;
|
||||
virtual etl::fsm_state_id_t get_state_id() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
//*******************************************
|
||||
ifsm_state(etl::fsm_state_id_t state_id_)
|
||||
: state_id(state_id_)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void on_enter_state() {};
|
||||
virtual void on_exit_state() {};
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t state_id;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
@ -117,6 +132,12 @@ namespace etl
|
||||
THIS_STATE_ID = STATE_ID_
|
||||
};
|
||||
|
||||
//*******************************************
|
||||
fsm_state()
|
||||
: ifsm_state(THIS_STATE_ID)
|
||||
{
|
||||
}
|
||||
|
||||
//*******************************************
|
||||
etl::fsm_state_id_t on_event(const etl::ifsm_event& event)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user