diff --git a/lib/include/srslte/common/fsm.h b/lib/include/srslte/common/fsm.h index 1fc1da192..54efb4aed 100644 --- a/lib/include/srslte/common/fsm.h +++ b/lib/include/srslte/common/fsm.h @@ -99,25 +99,17 @@ using fsm_transitions = typename FSM::derived_view::transitions; //! Detection of enter/exit methods of a state. template -auto call_enter(FSM* f, State* s) -> decltype(s->enter(f), std::true_type{}) +auto call_enter(FSM* f, State* s) -> decltype(s->enter(f)) { s->enter(f); - return std::true_type{}; -} -auto call_enter(...) -> std::false_type -{ - return {}; } +void call_enter(...) {} template -auto call_exit(FSM* f, State* s) -> decltype(s->exit(f), std::true_type{}) +auto call_exit(FSM* f, State* s) -> decltype(s->exit(f)) { s->exit(f); - return std::true_type{}; -} -auto call_exit(...) -> std::false_type -{ - return {}; } +void call_exit(...) {} //! Find State in FSM recursively (e.g. find State in FSM,FSM::parentFSM,FSM::parentFSM::parentFSM,...) template @@ -145,8 +137,6 @@ struct state_traits { static_assert(FSM::template can_hold_state(), "FSM type does not hold provided State\n"); using state_t = State; using is_subfsm = std::integral_constant()>; - using has_enter = decltype(fsm_details::call_enter((FSM*)nullptr, (State*)nullptr)); - using has_exit = decltype(fsm_details::call_exit((FSM*)nullptr, (State*)nullptr)); //! enter new state. enter is called recursively for subFSMs static void enter_state(FSM* f, State* s) { enter_(f, s, is_subfsm{}); } diff --git a/lib/test/common/fsm_test.cc b/lib/test/common/fsm_test.cc index 6f3202c7e..785903a82 100644 --- a/lib/test/common/fsm_test.cc +++ b/lib/test/common/fsm_test.cc @@ -171,9 +171,6 @@ static_assert(fsm1::can_hold_state(), "failed can_hold_state check static_assert(std::is_same, void>::value, "get state list failed\n"); static_assert(std::is_same, void>::value, "get state list failed\n"); -static_assert(fsm_details::state_traits::has_enter::value, "Failed detection of enter method\n"); -static_assert(fsm_details::state_traits::has_exit::value == false, - "Failed detection of exit method\n"); } // namespace fsm_details } // namespace srslte