mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-26 20:38:45 +08:00
Updated from generator.
This commit is contained in:
parent
00d56bae66
commit
3d7adea287
18
src/fsm.h
18
src/fsm.h
@ -226,15 +226,12 @@ namespace etl
|
||||
state_list = p_states;
|
||||
number_of_states = etl::fsm_state_id_t(size);
|
||||
|
||||
ETL_ASSERT((number_of_states > 0), ETL_ERROR(etl::fsm_state_list_exception));
|
||||
|
||||
for (etl::fsm_state_id_t i = 0; i < size; ++i)
|
||||
{
|
||||
ETL_ASSERT((state_list[i] != nullptr), ETL_ERROR(etl::fsm_null_state_exception));
|
||||
}
|
||||
|
||||
bool ok = (number_of_states > 0) &&
|
||||
etl::is_sorted(state_list, state_list + number_of_states, fsm::CompareStateId());
|
||||
|
||||
ETL_ASSERT(ok, ETL_ERROR(etl::fsm_state_list_exception));
|
||||
}
|
||||
|
||||
//*******************************************
|
||||
@ -276,10 +273,9 @@ namespace etl
|
||||
{
|
||||
do
|
||||
{
|
||||
p_state = p_next_state;
|
||||
fsm_helper::on_exit_state(*p_state);
|
||||
|
||||
p_state = p_next_state;
|
||||
|
||||
next_state_id = fsm_helper::on_enter_state(*p_state);
|
||||
ETL_ASSERT(next_state_id < number_of_states, ETL_ERROR(etl::fsm_state_id_exception));
|
||||
|
||||
@ -363,14 +359,6 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
struct CompareStateId
|
||||
{
|
||||
bool operator()(etl::ifsm_state* lhs, etl::ifsm_state* rhs)
|
||||
{
|
||||
return lhs->get_state_id() < rhs->get_state_id();
|
||||
}
|
||||
};
|
||||
|
||||
etl::ifsm_state* p_state; ///< A pointer to the current state.
|
||||
etl::ifsm_state** state_list; ///< The list of added states.
|
||||
etl::fsm_state_id_t number_of_states; ///< The number of states.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user