StateMachine.RaisePushStateEvent method (1 of 2)
Raise a special event that performs a push state operation at the end of the current action.
protected void RaisePushStateEvent(Type state)
parameter | description |
---|---|
state | Type of the state. |
Remarks
Pushing a state does not pop the current State
, instead it pushes the specified State
on the active state stack so that you can have multiple active states. In this case events can be handled by all active states on the stack. This is shorthand for the following code:
class Event E { }
[OnEventPushState(typeof(E), typeof(S))]
this.RaiseEvent(new E());
This event is not handled until the action that calls this method returns control back to the Coyote runtime. It is handled before any other events are dequeued from the inbox. Only one of the following can be called per action: RaiseEvent
, RaiseGotoStateEvent
, RaisePushStateEvent
or RaisePopStateEvent
and RaiseHaltEvent
. An Assert is raised if you accidentally try and do two of these operations in a single action.
See Also
- class StateMachine
- namespace Microsoft.Coyote.Actors
- assembly Microsoft.Coyote.Actors
StateMachine.RaisePushStateEvent<TState> method (2 of 2)
Raise a special event that performs a push state operation at the end of the current action.
protected void RaisePushStateEvent<TState>()
where TState : State
parameter | description |
---|---|
TState | Type of the state. |
Remarks
Pushing a state does not pop the current State
, instead it pushes the specified State
on the active state stack so that you can have multiple active states. In this case events can be handled by all active states on the stack. This is shorthand for the following code:
class Event E { }
[OnEventPushState(typeof(E), typeof(S))]
this.RaiseEvent(new E());
This event is not handled until the action that calls this method returns control back to the Coyote runtime. It is handled before any other events are dequeued from the inbox. Only one of the following can be called per action: RaiseEvent
, RaiseGotoStateEvent
, RaisePushStateEvent
or RaisePopStateEvent
and RaiseHaltEvent
. An Assert is raised if you accidentally try and do two of these operations in a single action.
See Also
- class State
- class StateMachine
- namespace Microsoft.Coyote.Actors
- assembly Microsoft.Coyote.Actors