Belle II Software  release-06-00-14
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 41 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 50 of file state_machines.py.

50  def __init__(self, name, enter=None, exit=None):
51  """
52  Initialise State with a name and optional lists of callbacks.
53  """
54 
55  self.name = name
56 
57  self.on_enter = enter
58 
59  self.on_exit = exit
60 

Member Function Documentation

◆ _()

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

Definition at line 103 of file state_machines.py.

◆ __eq__()

def __eq__ (   self,
  other 
)
 

Definition at line 124 of file state_machines.py.

◆ __hash__()

def __hash__ (   self)
 

Definition at line 132 of file state_machines.py.

◆ __repr__()

def __repr__ (   self)
 

Definition at line 119 of file state_machines.py.

◆ __str__()

def __str__ (   self)
 

Definition at line 114 of file state_machines.py.

◆ _add_callbacks()

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

Definition at line 92 of file state_machines.py.

◆ on_enter() [1/2]

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

Definition at line 62 of file state_machines.py.

◆ on_enter() [2/2]

def on_enter (   self,
  callbacks 
)
 

Definition at line 69 of file state_machines.py.

◆ on_exit() [1/2]

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

Definition at line 77 of file state_machines.py.

◆ on_exit() [2/2]

def on_exit (   self,
  callbacks 
)
 

Definition at line 84 of file state_machines.py.


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