Belle II Software  release-05-02-19
State Class Reference

Public Member Functions

def __init__ (self, name, enter=None, exit=None)
 
def on_enter (self)
 
def on_enter (self, callbacks)
 
def on_exit (self)
 
def on_exit (self, callbacks)
 
def __str__ (self)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 

Public Attributes

 name
 Name of the State.
 
 on_enter
 Callback list when entering state.
 
 on_exit
 Callback list when exiting state.
 

Private Member Functions

def _add_callbacks (self, callback, attribute)
 
def _ (self, callbacks, attribute)
 

Private Attributes

 _on_enter
 
 _on_exit
 

Detailed Description

Basic State object that can take enter and exit state methods and records
the state of a machine.

You should assign the self.on_enter or self.on_exit attributes to callback functions
or lists of them, if you need them.

Definition at line 36 of file state_machines.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  enter = None,
  exit = None 
)
Basic State object that can take enter and exit state methods and records
the state of a machine.

You should assign the self.on_enter or self.on_exit attributes to callback functions
or lists of them, if you need them.
Initialise State with a name and optional lists of callbacks.

Definition at line 45 of file state_machines.py.

Member Function Documentation

◆ _()

def _ (   self,
  callbacks,
  attribute 
)
private
Alternate method for lists and tuples of function objects.

Definition at line 98 of file state_machines.py.

◆ __eq__()

def __eq__ (   self,
  other 
)
 

Definition at line 119 of file state_machines.py.

◆ __hash__()

def __hash__ (   self)
 

Definition at line 127 of file state_machines.py.

◆ __repr__()

def __repr__ (   self)
 

Definition at line 114 of file state_machines.py.

◆ __str__()

def __str__ (   self)
 

Definition at line 109 of file state_machines.py.

◆ _add_callbacks()

def _add_callbacks (   self,
  callback,
  attribute 
)
private
Adds callback to a property.

Definition at line 87 of file state_machines.py.

◆ on_enter() [1/2]

def on_enter (   self)
Runs callbacks when a state is entered.

Definition at line 57 of file state_machines.py.

◆ on_enter() [2/2]

def on_enter (   self,
  callbacks 
)
 

Definition at line 64 of file state_machines.py.

◆ on_exit() [1/2]

def on_exit (   self)
Runs callbacks when a state is exited.

Definition at line 72 of file state_machines.py.

◆ on_exit() [2/2]

def on_exit (   self,
  callbacks 
)
 

Definition at line 79 of file state_machines.py.


The documentation for this class was generated from the following file: