1. with Events.Corrals;                    use Events.Corrals; 
  2.  
  3. package Events.Manager is 
  4.  
  5.     -- Adds an event to the queue. 
  6.     procedure Queue_Event( evt : in out A_Event ); 
  7.     pragma Precondition( evt /= null ); 
  8.     pragma Postcondition( evt = null ); 
  9.  
  10.     -- Registers a corral as a listener for a specific type of event. Corrals 
  11.     -- only receive events for which they are registered. 
  12.     procedure Register_Listener( corral : not null A_Corral; evtName : String ); 
  13.     pragma Precondition( evtName'Length > 0 ); 
  14.  
  15.     -- Dispatches queued events, waiting for more if the queue is empty. The 
  16.     -- calling thread will not return from this procedure until Stop is invoked. 
  17.     procedure Run; 
  18.  
  19.     -- Shuts down the event manager and causes the thread in Run to return, if 
  20.     -- the event manager is currently running. Any further calls to Queue_Event 
  21.     -- or Trigger event will consume the event objects but do nothing. 
  22.     procedure Stop; 
  23.  
  24.     -- Synchronously dispatches an event to its listeners until one of the 
  25.     -- listeners consumes the event. The listener's response is ignored. 
  26.     procedure Trigger_Event( evt : in out A_Event ); 
  27.     pragma Precondition( evt /= null ); 
  28.     pragma Postcondition( evt = null ); 
  29.  
  30.     -- Synchronously dispatches an event to its listeners until one of the 
  31.     -- listeners consumes the event. 
  32.     procedure Trigger_Event( evt : in out A_Event; response : out Response_Type ); 
  33.     pragma Precondition( evt /= null ); 
  34.     pragma Postcondition( evt = null ); 
  35.  
  36.     -- Unregisters a corral as a listener for a specific type of event. If the 
  37.     -- corral was not previously registered, this has no effect. 
  38.     procedure Unregister_Listener( corral : not null A_Corral; evtName : String ); 
  39.     pragma Precondition( evtName'Length > 0 ); 
  40.  
  41. end Events.Manager;