next up previous
Next: Receiving events and advancing Up: Entities and Events Previous: Types of entities

Sending events

An entity can send an event to one of its output ports, and it will arrive some time later at all of its destinations. Any object derived from the Event class can be sent. A common type of event is a SpikeEvent, but other event types (e.g. DoubleEvent, MorphologyEvent) can also be derived and sent between entities. The event is constructed with a timestamp at the sending time not the arrival time. This is because the delay may be different for each destination.

  SpikeEvent se = new SpikeEvent( sending_time );
  PortID spikegenID = 1;
  sendEvent( spikegenID, se );

For complex events, the mechanism is the same:

  MorphologyEvent = new MorphologyEvent( t, getMorphology() );
  PortID  morphgenID = 2;
  sendEvent( morphgenID, se )

As well as sending events via an output port to its destination entities, it is also possible to send an event directly to a given input port of an entity using:

  SpikeEvent se = new SpikeEvent( arrival_time );
  EntityID destEnt  = // look up destination entity;
  PortID   destPort = // input port for event to arrive on;
  sendEvent( destEnt, destPort, se )

Fred Howell