smclib.statemap module

class smclib.statemap.FSMContext(state)

Bases: object

The user can derive FSM contexts from this class and interface.

to them with the methods of this class. The finite state machine needs to be initialized to the starting state of the FSM. This must be done manually in the constructor of the derived class.

clearState()

Clear the current state.

emptyStateStack()

Remove all states from the state stack.

getDebugFlag()

Return the debug flag’s current setting.

getDebugStream()

Return the stream to which debug output is written.

getPreviousState()

Return the state which a transition left.

May be None

getState()

Return the current state.

getStateStackDepth()

Return the state stack’s depth.

getTransition()

Return the current transition’s name.

Used only for debugging purposes.

isInTransition()

Is this state machine already inside a transition?.

True if state is undefined.

isStateStackEmpty()

Return True if the state stack is empty and False otherwise.

popState()

Make the state on top of the state stack the current state.

pushState(state)

Push the current state on top of the state stack.

and make the specified state the current state.

setDebugFlag(flag)

Set the debug flag.

A true value means debugging is on and false means off.

setDebugStream(stream)

Set the debug output stream.

setState(state)

Set the current state to the specified state.

class smclib.statemap.State(name, id_)

Bases: object

base State class.

getId()

Return the state’s unique identifier.

getName()

Return the state’s printable name.

exception smclib.statemap.StateUndefinedException

Bases: Exception

A StateUndefinedException is thrown by.

an SMC-generated state machine whenever a transition is taken and there is no state currently set. This occurs when a transition is issued from within a transition action.

exception smclib.statemap.TransitionUndefinedException

Bases: Exception

A TransitionUndefinedException is thrown by.

an SMC-generated state machine whenever a transition is taken which: - Is not explicitly defined in the current state. - Is not explicitly defined in the current FSM’s default state. - There is no Default transition in the current state.