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
CInvalidArgumentException
– One or more unknown states specified.CInvalidArgumentException
– Empty vector of states specified.CInvalidArgumentException
– Empty callback handler specified.COutOfResourcesException
– No resources available to subscribe callback.CCommunicationErrorException
– Protocol error.CConnectionLostException
– Connection to controller lost.CRebootedException
– Controller has been rebooted since this object reference was retrieved, invalidating this reference.
- Remarks
If the state already matches one of the specified states, a callback is generated immediately.