Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork6
Overview Minimal Example
Andrew Gresyk edited this pageApr 1, 2022 ·3 revisions
#include<assert.h>#include<ffsm2/machine.hpp>structContext {bool on =false;};using Config = ffsm2::Config ::ContextT<Context&>;using M = ffsm2::MachineT<Config>;using FSM = M::PeerRoot<structOff,structOn >;structOff : FSM::State{voidenter(PlanControl& control) { control.context().on =false; }};structOn : FSM::State{voidenter(PlanControl& control) { control.context().on =true; }};intmain() { Context context; FSM::Instance machine{context}; machine.changeTo<On>(); machine.update();assert(context.on ==true);return0;}