-
Notifications
You must be signed in to change notification settings - Fork 1
HierarchicalStateMachine ctor()
Initializes a HierarchicalStateMachine<TContext> instance that has a specified context and a flag indicating whether to handle deep transitions.
template<class TContext>
HierarchicalStateMachine(TContext* context, bool handleDeepTransition = false)-
TContext: The type of the context, which holds data or behavior relevant to the state machine.
-
context: The context associated with this state machine. -
handleDeepTransition: Indicates whether to handle deep transitions.
If handleDeepTransition is true, transitions from lower-level states to higher-level states will cause the state to exit and re-enter, instead of just reusing the existing state.
Deep transition execution can be viewed here for more details.
// primitive context
int foo1 = 5;
HierarchicalStateMachine<int> foo1SM(&foo1);
float foo2 = 1.0f;
HierarchicalStateMachine<float> foo2SM(&foo2, true); // can handle deep transitions
// user-defined context
struct FooStructContext; // implementation omitted for brevity
auto fooContext1 = FooStructContext();
auto fooContext1SM = HierarchicalStateMachine<FooStructContext>(&fooContext1);
class FooClassContext; // implementation omitted for brevity
auto fooContext2 = FooClassContext();
auto fooContext2SM = HierarchicalStateMachine<FooClassContext>(&fooContext2, true); // can handle deep transitionsCommon Types
→ StateStatus (enum)
→ StateCallback (alias)
Finite State Machine (FSM)
→ State
→ ctor()
→ isInState()
→ transitionTo()
→ update()
Hierarchical State Machine (HSM)
→ State
→ ctor()
→ isInState()
→ transitionTo()
→ update()
State Base
→ ctor()
→ is()
→ enter()
→ update()
→ exit()
State Machine Handler
→ ctor()
→ getNextState()
→ getActiveState()
→ isInState()
→ setNextState()
→ queueTransition()
→ beginTransitionQueue()
→ endTransitionQueue()
→ execute()