Skip to content

Controls

Andrew Gresyk edited this page Apr 12, 2024 · 1 revision
  1. Control arguments are passed into all state methods to provide a point through which a state can interact with the FSM instance, e.g. initiating transitions to other states or regions.

  2. There are three controls (PlanControl, FullControl and GuardControl), each of which has move allowed functionality than the previous one.

Method Description
void State::enter(PlanControl&);
void State::reenter(PlanControl&);
void State::exit(PlanControl&);
On activation
On re-activation
On deactivation
void State::update(FullControl&);
void State::react<TEvent>(const TEvent&, FullControl&);
Update active states
Let active state to react to event
void State::entryGuard(GuardControl&);
void State::exitGuard(GuardControl&);
Entry guard
Exit guard

PlanControl

Method Description
static StateID PlanControl::stateId<TState>(); Query ID for a state type
Context& PlanControl::context();
const Context& PlanControl::context() const;
Access context
Context& PlanControl::_();
const Context& PlanControl::_() const;
Alternative access context
CPlan PlanControl::plan() const;
Plan PlanControl::plan();
Access const plan
Access mutable plan
const Transition& PlanControl::request() const; Query current transition request
const Transition& PlanControl::previousTransitions() const; Access the last processed transition

FullControl (includes everything from PlanControl)

Method Description
void FullControl::changeTo(const StateID);
void FullControl::changeTo<TState>();
Initiate a transition
void FullControl::changeWith(const StateID, const Payload&);
void FullControl::changeWith(const StateID, Payload&&);
void FullControl::changeWith<TState>(const Payload&);
void FullControl::changeWith<TState>(Payload&&);
Initiate a transition with a payload
void FullControl::succeed();
void FullControl::fail();
Succeed or fail a task

GuardControl (includes everything from FullControl)

Method Description
const Transition& FullControl::currentTransitions() const;
const Transition& FullControl::pendingTransition() const;
Query current transition
Query pending transition
void FullControl::cancelPendingTransition(); Cancel pending transition