Index

Package: Corrals

Description

package Events.Corrals is

Classes

Corral

type Corral is new Limited_Object and Process with private;

Ancestors:

Primitive operations:

Construct
Delete (overriding Objects.Delete)
Get_Process_Name (overriding Processes.Get_Process_Name)
Objects.Construct (Inherited)
Tick (overriding Processes.Tick)
To_String (overriding Objects.To_String)
An event Corral is an object for Event_Listener objects to register with, to receive events. A Corral in turn registers with the global event manager to receive the events for which it has registered listeners. All listeners attached to a Corral are serviced by the same event dispatching thread. Corrals are necessary to allow events to be dispatched from the global event manager thread and processed in different Process_Manager processes simultaneously. Each Process_Manager (which is backed by a single thread), must have its own event Corral. Note that a Corral implements the Process interface. It is meant to be attached to a Process_Manager and executed incrementally with other Process objects.

Types

A_Corral

type A_Corral is access all Corral'Class;

Subprograms & Entries

Create_Corral

function Create_Corral
( name: String ) return A_Corral;
Creates a new corral to receive events from the global event manager.

Add_Listener

procedure Add_Listener
( this: not null access Corral'Class;
listener: not null A_Event_Listener;
evtName: String );
Registers an object as a listener for a specific type of event. Listeners will receive all events sent to this corral unless the event has been consumed by an earlier registered handler that wants to prevent an event from propagating. Event listeners are notified in the order in which they register with the corral.

Get_Name

function Get_Name
( this: not null access Corral'Class ) return String;
Returns the name of the corral.

Queue_Event

procedure Queue_Event
( this: not null access Corral'Class;
evt: in out A_Event );
Queue an event to be dispatched to all the registered listener objects. The event will be consumed.

Remove_Listener

procedure Remove_Listener
( this: not null access Corral'Class;
listener: not null A_Event_Listener;
evtName: String );
Unregisters an object as a listener for a specific type of event. If the listener was not previously registered, this has no effect.

Trigger_Event

procedure Trigger_Event
( this: not null access Corral'Class;
evt: in out A_Event;
response: out Response_Type );
Dispatches an event immediately and sychronously, separate from the queue. The Event_Listener that handles the event may choose to return a response to the caller via 'response'. The event 'evt' will be consumed.

Delete

procedure Delete
( this: in out A_Corral );
Deletes the Corral.