From f4d19a6d4404f83f5fadd8ea46e3754d89502031 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 5 May 2020 13:54:49 +0100 Subject: [PATCH] added fsm table formmatting comments --- lib/test/common/fsm_test.cc | 40 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/lib/test/common/fsm_test.cc b/lib/test/common/fsm_test.cc index 1b537b077..a54ecc06a 100644 --- a/lib/test/common/fsm_test.cc +++ b/lib/test/common/fsm_test.cc @@ -73,9 +73,16 @@ public: protected: // list of states state_list states{this}; - using transitions = transition_table, - row, - row >; + // clang-format off + using transitions = transition_table< + // Start Target Event Action + // +------------+-------------+----+----------------------+ + row, + row, + row + // +------------+-------------+----+----------------------+ + >; + // clang-format on }; private: @@ -89,9 +96,16 @@ protected: // list of states + transitions state_list states = {this, idle_st{}, state1{}, fsm2{this}}; - using transitions = transition_table, - row, - row >; + // clang-format off + using transitions = transition_table< + // Start Target Event Action + // +------------+-------------+----+------------------+ + row< idle_st, state1, ev1, &fsm1::action1>, + row< state1, fsm2, ev1, &fsm1::action2>, + row< state1, idle_st, ev2, &fsm1::action3> + // +------------+-------------+----+--------------------+ + >; + // clang-format on }; void fsm1::idle_st::enter(fsm1* f) @@ -254,10 +268,16 @@ protected: bool is_failure(procstate1& s, const procevent1& ev) const { return not ev.is_success; } state_list states{this, idle_st{}, procstate1{}}; - using transitions = - transition_table, &proc1::init>, - row, - row >; + // clang-format off + using transitions = transition_table< + // Start Target Event Action Guard (optional) + // +------------+-------------+----------------------------+------------------------+--------------------+ + row< idle_st, procstate1, srslte::proc_launch_ev, &proc1::init >, + row< procstate1, idle_st, procevent1, &proc1::handle_success, &proc1::is_success >, + row< procstate1, idle_st, procevent1, &proc1::handle_failure, &proc1::is_failure > + // +------------+-------------+----------------------------+------------------------+--------------------+ + >; + // clang-format on }; void proc1::init(idle_st& s, procstate1& d, const srslte::proc_launch_ev& ev)