Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ClassicFSM Class Reference
Inheritance diagram for ClassicFSM:

## Public Member Functions
| __init__ (self, name, states=[], initialStateName=None, finalStateName=None, onUndefTransition=DISALLOW_VERBOSE)
| __repr__ (self)
| __str__ (self)
| addState (self, state)
| conditional_request (self, aStateName, enterArgList=[], exitArgList=[])
| enterInitialState (self, argList=[])
| forceTransition (self, aStateName, enterArgList=[], exitArgList=[])
| getCurrentState (self)
| getFinalState (self)
| getInitialState (self)
| getName (self)
| getStateNamed (self, stateName)
| getStates (self)
| hasStateNamed (self, stateName)
| isInternalStateInFlux (self)
| request (self, aStateName, enterArgList=[], exitArgList=[], force=0)
| requestFinalState (self)
| setFinalState (self, finalStateName)
| setInitialState (self, initialStateName)
| setName (self, name)
| setStates (self, states)
| view (self)
Public Member Functions inherited from DirectObject
| __init__ (self)
| accept (self, event, method, extraArgs=[])
| acceptOnce (self, event, method, extraArgs=[])
| addTask (self, *args, **kwargs)
| detectLeaks (self)
| doMethodLater (self, *args, **kwargs)
| getAllAccepting (self)
| ignore (self, event)
| ignoreAll (self)
| isAccepting (self, event)
| isIgnoring (self, event)
| removeAllTasks (self)
| removeTask (self, taskOrName)

## Public Attributes
int | inspecting = 0
int | onUndefTransition = onUndefTransition

## Static Public Attributes
int | ALLOW = 0
int | DISALLOW = 1
int | DISALLOW_VERBOSE = 2
int | ERROR = 3
| notify = directNotify.newCategory("ClassicFSM")
Static Public Attributes inherited from DirectObject
| accept_once = acceptOnce
| add_task = addTask
| detect_leaks = detectLeaks
| do_method_later = doMethodLater
| get_all_accepting = getAllAccepting
| ignore_all = ignoreAll
| is_accepting = isAccepting
| is_ignoring = isIgnoring
| remove_all_tasks = removeAllTasks
| remove_task = removeTask

## Additional Inherited Members
Protected Member Functions inherited from DirectObject
| _addTask (self, task)
| _clearTask (self, task)
Protected Attributes inherited from DirectObject
dict | _taskList = {}

## Detailed Description

    Finite State Machine class.

    This module and class exist only for backward compatibility with
    existing code.  New code should use the FSM class instead.

## Constructor & Destructor Documentation

## ◆ __init__()

__init__ | ( |  | self,
|  |  | name,
|  |  | states = [],
|  |  | initialStateName = None,
|  |  | finalStateName = None,
|  |  | onUndefTransition = DISALLOW_VERBOSE )

    __init__(self, string, State[], string, string, int)

    ClassicFSM constructor: takes name, list of states, initial state and
    final state as::

        fsm = ClassicFSM.ClassicFSM('stopLight',
          [State.State('red', enterRed, exitRed, ['green']),
            State.State('yellow', enterYellow, exitYellow, ['red']),
            State.State('green', enterGreen, exitGreen, ['yellow'])],
          'red',
          'red')

    each state's last argument, a list of allowed state transitions,
    is optional; if left out (or explicitly specified to be
    State.State.Any) then any transition from the state is 'defined'
    and allowed

    'onUndefTransition' flag determines behavior when undefined
    transition is requested; see flag definitions above

## Member Function Documentation

## ◆ __repr__()

__repr__ | ( |  | self | ) |

## ◆ __str__()

__str__ | ( |  | self | ) |

    Print out something useful about the fsm

## ◆ addState()

addState | ( |  | self,
|  |  | state )

## ◆ conditional_request()

conditional_request | ( |  | self,
|  |  | aStateName,
|  |  | enterArgList = [],
|  |  | exitArgList = [] )

    'if this transition is defined, do it'
    Attempt transition from currentState to given one, if it exists.
    Return true if transition exists to given state, false otherwise.
    It is NOT an error/warning to attempt a cond_request if the
    transition doesn't exist.  This lets people be sloppy about
    ClassicFSM transitions, letting the same fn be used for different
    states that may not have the same out transitions.

## ◆ enterInitialState()

enterInitialState | ( |  | self,
|  |  | argList = [] )

## ◆ forceTransition()

forceTransition | ( |  | self,
|  |  | aStateName,
|  |  | enterArgList = [],
|  |  | exitArgList = [] )

    force a transition -- for debugging ONLY

## ◆ getCurrentState()

getCurrentState | ( |  | self | ) |

## ◆ getFinalState()

getFinalState | ( |  | self | ) |

## ◆ getInitialState()

getInitialState | ( |  | self | ) |

## ◆ getName()

getName | ( |  | self | ) |

## ◆ getStateNamed()

getStateNamed | ( |  | self,
|  |  | stateName )

    Return the state with given name if found, issue warning otherwise

## ◆ getStates()

getStates | ( |  | self | ) |

## ◆ hasStateNamed()

hasStateNamed | ( |  | self,
|  |  | stateName )

    Return True if stateName is a valid state, False otherwise.

## ◆ isInternalStateInFlux()

isInternalStateInFlux | ( |  | self | ) |

## ◆ request()

request | ( |  | self,
|  |  | aStateName,
|  |  | enterArgList = [],
|  |  | exitArgList = [],
|  |  | force = 0 )

    Attempt transition from currentState to given one.
    Return true is transition exists to given state,
    false otherwise.

## ◆ requestFinalState()

requestFinalState | ( |  | self | ) |

## ◆ setFinalState()

setFinalState | ( |  | self,
|  |  | finalStateName )

## ◆ setInitialState()

setInitialState | ( |  | self,
|  |  | initialStateName )

## ◆ setName()

setName | ( |  | self,
|  |  | name )

## ◆ setStates()

setStates | ( |  | self,
|  |  | states )

    setStates(self, State[])

## ◆ view()

view | ( |  | self | ) |

## Member Data Documentation

## ◆ ALLOW

int ALLOW = 0
| static

## ◆ DISALLOW

int DISALLOW = 1
| static

## ◆ DISALLOW_VERBOSE

int DISALLOW_VERBOSE = 2
| static

## ◆ ERROR

int ERROR = 3
| static

## ◆ inspecting

int inspecting = 0

## ◆ notify

notify = directNotify.newCategory("ClassicFSM")
| static

## ◆ onUndefTransition

int onUndefTransition = onUndefTransition