Skip to content

Commit edbbc63

Browse files
authored
Update README.md
1 parent d406551 commit edbbc63

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,24 +311,32 @@ The predefined HeapAllocator is simply an allocator based on std::pmr::new_delet
311311

312312
2) Transition to another state with transition action:
313313

314-
// Using class StatemachineImplementation member function
315314
return Fsm::TransitionTo(Fsm::kState1, &StatemachineImplementation::SomeAction);
316315

317-
3) No transition - event is handled, but no state transition occurs:
316+
3) Transition to another state with MULTIPLE transition actions:
317+
318+
static const auto kActions = std::to_array<Fsm::ActionType>({&Fsm::Impl::Action1, &Fsm::Impl::Action2, &Fsm::Impl::Action3});
319+
return Fsm::TransitionTo(Fsm::kState1, kActions);
320+
321+
4) No transition - event is handled, but no state transition occurs:
318322

319323
return Fsm::NoTransition();
320324

321-
4) No state transition, but an action is executed:
325+
5) No state transition, but an action is executed:
322326

323-
// Using class StatemachineImplementation member function
324327
return Fsm::NoTransition(&StatemachineImplementation::SomeAction);
325328

326-
5) Event is not handled in this state. In hierarchical statemachines, the event will be passed to parent state handler.
329+
6) No state transition, but MULTIPLE actions are executed:
330+
331+
static const auto kActions = std::to_array<Fsm::ActionType>({&Fsm::Impl::Action1, &Fsm::Impl::Action2, &Fsm::Impl::Action3});
332+
return Fsm::NoTransition(kActions);
333+
334+
7) Event is not handled in this state. In hierarchical statemachines, the event will be passed to parent state handler.
327335
When topmost state does not handle the event, fsm_.on_unhandled_event_ is called.
328336

329337
return Fsm::UnhandledEvent();
330338

331-
6) Defer event (needs external framework support)
339+
8) Defer event (needs external framework support)
332340

333341
return Fsm::DeferEvent();
334342

@@ -404,15 +412,15 @@ Example:
404412

405413
### Function signatures
406414

407-
- State handlers. The ImplPtr allows to call implementation member functions.
415+
- State handlers
408416

409417
Fsm::Transition (*)(Fsm::ImplPtr impl, Fsm::Event event)
410418

411-
- Entry/Exit actions. Actions are member functions of a class.
419+
- Entry/Exit actions. Actions are member functions of an interface/class.
412420

413421
void (Fsm::ImplPtr)()
414422

415-
- Transition actions. The signature allows to use class/interface member functions as actions. The argument "event" may be useful in actions because the action may depend on the event type or attributes of the event.
423+
- Transition actions. Actions are member functions of an interface/class.
416424

417425
void (Fsm::ImplPtr)(Fsm::Event event)
418426

0 commit comments

Comments
 (0)