Package multi :: Class Application_callback
[hide private]
[frames] | no frames]

Class Application_callback

source code


Call backs provided to the host application by the multi processor framework.

This class allows for independence from the host class/application.


Note: The logic behind the design the callbacks are defined as two attributes self.init_master and self.handle_exception as handle_exception can be null (which is used to request the use of the processors default error handling code). Note, however, that a class with the equivalent methods would also works as python effectively handles methods as attributes of a class. The signatures for the callback methods are documented by the default methods default_init_master & default_handle_exception.

Instance Methods [hide private]
 
__init__(self, master)
Initialise the callback interface.
source code
 
default_handle_exception(self, processor, exception)
Handle an exception raised in the processor framework.
source code
 
default_init_master(self, processor)
Start the main loop of the host application.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  master
The host application.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, master)
(Constructor)

source code 

Initialise the callback interface.

Parameters:
  • master (object) - The data for the host application. In the default implementation this is an object we call methods on but it could be anything...
Overrides: object.__init__

default_handle_exception(self, processor, exception)

source code 

Handle an exception raised in the processor framework.

The function is responsible for aborting the processor by calling processor.abort() as its final act.

Parameters:
  • processor (multi.processor.Processor instance) - The processor instance.
  • exception (Exception instance) - The exception raised by the processor or slave processor. In the case of a slave processor exception this may well be a wrapped exception of type multi.processor.Capturing_exception which was raised at the point the exception was received on the master processor but contains an enclosed exception from a slave.

default_init_master(self, processor)

source code 

Start the main loop of the host application.

Parameters:
  • processor (multi.processor.Processor instance) - The processor instance.