-
-
Notifications
You must be signed in to change notification settings - Fork 75
Controls
Andrew Gresyk edited this page Apr 12, 2024
·
1 revision
-
Controlarguments 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. -
There are three controls (
PlanControl,FullControlandGuardControl), 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 |
| 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 planAccess mutable plan |
const Transition& PlanControl::request() const; |
Query current transition request |
const Transition& PlanControl::previousTransitions() const; |
Access the last processed transition |
| 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 |
| Method | Description |
|---|---|
const Transition& FullControl::currentTransitions() const;const Transition& FullControl::pendingTransition() const;
|
Query current transition Query pending transition |
void FullControl::cancelPendingTransition(); |
Cancel pending transition |