-
-
Notifications
You must be signed in to change notification settings - Fork 63
Advanced Plans
Andrew Gresyk edited this page Apr 2, 2022
·
2 revisions
-
Plans are sequences of transitions.
-
Plans are attached to regions.
-
Planned transitions link origin and destination states.
-
Planned transitions can have payloads.
-
Planned transitions are triggered when origin state succeeds.
-
Enable plan support
#define HFSM2_ENABLE_PLANS #include <hfsm2/machine.hpp>
-
Set maximum number of tasks across all plans of the FSM instance
using Config = hfsm2::Config ::TaskCapacityN<N>; using M = hfsm2::MachineT<Config>;
Control Methods
Method | Description |
---|---|
CPlan PlanControl::plan() const; Plan PlanControl::plan();
|
Access constant plan Access mutable plan
|
void PlanControl::succeed(); void PlanControl::fail();
|
Called when all [Plans](../wiki/Advanced-Plans) tasks succeeded Called when all plan tasks failed
|
Method | Description |
---|---|
operator CPlan::bool() const; |
Check if plan isn't empty |
CIterator CPlan::first() const; Iterator Plan::first();
|
Range-based for loopiteration over plan tasks |
void Plan::clear(); |
Clear plan |
bool Plan::change(const StateID, const StateID); bool Plan::change<TOrigin>(const StateID); bool Plan::change<TOrigin, TDestination>();
|
Append a default transition to the plan |
bool Plan::changeWith(const StateID, const StateID, const Payload&); bool Plan::changeWith<TOrigin>(const StateID, const Payload&); bool Plan::changeWith<TOrigin, TDestination>(const Payload&);
|
Append a default transition with const payload
|
bool Plan::changeWith(const StateID, const StateID, Payload&&); bool Plan::changeWith<TOrigin>(const StateID, Payload&&); bool Plan::changeWith<TOrigin, TDestination>(Payload&&);
|
Append a default transition with moved payload |