with Events.Corrals; use Events.Corrals;
package Events.Manager is
-- Adds an event to the queue.
procedure Queue_Event( evt : in out A_Event );
pragma Precondition( evt /= null );
pragma Postcondition( evt = null );
-- Registers a corral as a listener for a specific type of event. Corrals
-- only receive events for which they are registered.
procedure Register_Listener( corral : not null A_Corral; evtName : String );
pragma Precondition( evtName'Length > 0 );
-- Dispatches queued events, waiting for more if the queue is empty. The
-- calling thread will not return from this procedure until Stop is invoked.
procedure Run;
-- Shuts down the event manager and causes the thread in Run to return, if
-- the event manager is currently running. Any further calls to Queue_Event
-- or Trigger event will consume the event objects but do nothing.
procedure Stop;
-- Synchronously dispatches an event to its listeners until one of the
-- listeners consumes the event. The listener's response is ignored.
procedure Trigger_Event( evt : in out A_Event );
pragma Precondition( evt /= null );
pragma Postcondition( evt = null );
-- Synchronously dispatches an event to its listeners until one of the
-- listeners consumes the event.
procedure Trigger_Event( evt : in out A_Event; response : out Response_Type );
pragma Precondition( evt /= null );
pragma Postcondition( evt = null );
-- Unregisters a corral as a listener for a specific type of event. If the
-- corral was not previously registered, this has no effect.
procedure Unregister_Listener( corral : not null A_Corral; evtName : String );
pragma Precondition( evtName'Length > 0 );
end Events.Manager;