SubscribeState

virtual PSubscription IStateMachine::SubscribeState(const std::vector<T> &states, StateMachineStateHandler<T> handler) = 0

Subscribes a callback to be executed when the state of the state machine changes to one of the specified states.

Parameters
  • states – States for which the callback is triggered.

  • handler – Function to be called when the state machine state changes to one of the specified states.

Returns

PSubscription – An ISubscription for the callback.

Throws
Remarks

If the state already matches one of the specified states, a callback is generated immediately.