1. with Ada.Real_Time;                     use Ada.Real_Time; 
  2.  
  3. package Processes is 
  4.  
  5.     -- 'totalTime' is the amount of time elapsed since the process manager 
  6.     -- began running. 
  7.     -- 'elapsedTime' is the time elapsed since the previous tick or frame of 
  8.     -- execution. 
  9.     type Tick_Time is 
  10.         record 
  11.             total   : Time_Span; 
  12.             elapsed : Time_Span; 
  13.         end record; 
  14.  
  15.     ---------------------------------------------------------------------------- 
  16.  
  17.     -- A Process is attached to a Process_Manager to execute code periodically 
  18.     -- in time slices (also called a frame). Implementing the Process interface 
  19.     -- with any class and attaching an instance of it a process manager allows 
  20.     -- for any object to have its own behavior. 
  21.     type Process is limited interface; 
  22.     type A_Process is access all Process'Class; 
  23.  
  24.     -- Returns a name identifying the process. 
  25.     function Get_Process_Name( this : access Process ) return String is abstract; 
  26.  
  27.     -- Executes one frame (time slice) of the process logic. 'time' contains 
  28.     -- information including how much time has elapsed since the last call to 
  29.     -- Tick and how long the process has been attached to the process manager. 
  30.     -- 
  31.     -- Processes are intended to execute their behavior iteratively; to update 
  32.     -- their state based on the passage of time and perform longer actions in 
  33.     -- small increments. Tick should finish its work and return as quickly as 
  34.     -- possible, to allow all the other processes attached to the manager 
  35.     -- enough time to execute before the next scheduled tick. 
  36.     procedure Tick( this : access Process; time : Tick_Time ) is abstract; 
  37.  
  38. end Processes;