Panda3D
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ClassicFSM Class Reference
Inheritance diagram for ClassicFSM:
DirectObject

Public Member Functions

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

Public Attributes

 inspecting
 
 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
def accept_once = acceptOnce
 
def add_task = addTask
 
def detect_leaks = detectLeaks
 
def do_method_later = doMethodLater
 
def get_all_accepting = getAllAccepting
 
def ignore_all = ignoreAll
 
def is_accepting = isAccepting
 
def is_ignoring = isIgnoring
 
def remove_all_tasks = removeAllTasks
 
def remove_task = removeTask
 

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__()

def __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__()

def __repr__ (   self)

◆ __str__()

def __str__ (   self)
Print out something useful about the fsm

◆ addState()

def addState (   self,
  state 
)

◆ conditional_request()

def 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()

def enterInitialState (   self,
  argList = [] 
)

◆ forceTransition()

def forceTransition (   self,
  aStateName,
  enterArgList = [],
  exitArgList = [] 
)
force a transition -- for debugging ONLY

◆ getCurrentState()

def getCurrentState (   self)

◆ getFinalState()

def getFinalState (   self)

◆ getInitialState()

def getInitialState (   self)

◆ getName()

def getName (   self)

◆ getStateNamed()

def getStateNamed (   self,
  stateName 
)
Return the state with given name if found, issue warning otherwise

◆ getStates()

def getStates (   self)

◆ hasStateNamed()

def hasStateNamed (   self,
  stateName 
)
Return True if stateName is a valid state, False otherwise.

◆ isInternalStateInFlux()

def isInternalStateInFlux (   self)

◆ request()

def 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()

def requestFinalState (   self)

◆ setFinalState()

def setFinalState (   self,
  finalStateName 
)

◆ setInitialState()

def setInitialState (   self,
  initialStateName 
)

◆ setName()

def setName (   self,
  name 
)

◆ setStates()

def setStates (   self,
  states 
)
setStates(self, State[])

◆ view()

def 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

inspecting

◆ notify

notify = directNotify.newCategory("ClassicFSM")
static

◆ onUndefTransition

onUndefTransition