Package topo :: Package base :: Module simulation :: Class EventProcessor
[hide private]
[frames] | no frames]

Class EventProcessor

source code

                       object --+    
                                |    
param.parameterized.Parameterized --+
                                    |
                                   EventProcessor
Known Subclasses:

Base class for EventProcessors, i.e. objects that can accept and handle events. This base class handles the basic mechanics of connections and sending events, and stores both incoming and outgoing connections.

The dest_ports attribute specifies which dest_ports are supported by this class; subclasses can augment or change this list if they wish. The special value dest_ports=None means to accept connections to any dest_port, while dest_ports=[None,'Trigger'] means that only connections to port None or port 'Trigger' are accepted.

Similarly, the src_ports attribute specifies which src_ports will be given output by this class.

Nested Classes [hide private]

Inherited from param.parameterized.Parameterized: __metaclass__

Instance Methods [hide private]
 
__init__(self, **params)
Create an EventProcessor.
source code
 
_dest_connect(self, conn)
Add the specified connection to the list of incoming connections.
source code
 
_port_match(self, key, portlist)
Returns True if the given key matches any port on the given list.
source code
 
_src_connect(self, conn)
Add the specified connection to the list of outgoing connections.
source code
 
input_event(self, conn, data)
Called by the simulation when an EPConnectionEvent is delivered; the EventProcessor should process the data somehow.
source code
 
process_current_time(self)
Called by the simulation before advancing the simulation time.
source code
 
script_repr(self, imports=[], prefix=' ')
Generate a runnable command for creating this EventProcessor.
source code
 
send_output(self, src_port=None, data=None)
Send some data out to all connections on the given src_port.
source code
 
start(self)
Called by the simulation when the EventProcessor is added to the simulation.
source code

Inherited from param.parameterized.Parameterized: __getstate__, __repr__, __setstate__, __str__, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, set_dynamic_time_fn, state_pop, state_push, verbose, warning

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Methods [hide private]

Inherited from param.parameterized.Parameterized: params, print_param_defaults

Class Variables [hide private]
  __abstract = True
bool(x) -> bool
  dest_ports = [None]
list() -> new list list(sequence) -> new list initialized from sequence's items
  src_ports = [None]
list() -> new list list(sequence) -> new list initialized from sequence's items

Inherited from param.parameterized.Parameterized: name, print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **params)
(Constructor)

source code 

Create an EventProcessor.

Note that just creating an EventProcessor does not mean it is part of the simulation (i.e. it is not in the simulation's list of EventProcessors, and it will not have its start() method called). To add an EventProcessor e to a simulation s, simply do s['name_of_e']=e. At this point, e's 'name' attribute will be set to 'name_of_e'.

Overrides: object.__init__

_dest_connect(self, conn)

source code 
Add the specified connection to the list of incoming connections. Should only be called from Simulation.connect().

_port_match(self, key, portlist)

source code 

Returns True if the given key matches any port on the given list.

In the default implementation, a port is considered a match if the port is == to the key, but subclasses of EventProcessor can override this to provide weaker forms of matching.

_src_connect(self, conn)

source code 
Add the specified connection to the list of outgoing connections. Should only be called from Simulation.connect().

process_current_time(self)

source code 
Called by the simulation before advancing the simulation time. Allows the event processor to do any computation that requires that all events for this time have been delivered. Computations performed in this method should not generate any events with a zero time delay, or else causality could be violated. (By default, does nothing.)

script_repr(self, imports=[], prefix=' ')

source code 
Generate a runnable command for creating this EventProcessor.
Overrides: param.parameterized.Parameterized.script_repr

start(self)

source code 

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.


Class Variable Details [hide private]

__abstract

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

Value:
True