1. -- 
  2. -- Jan & Uwe R. Zimmer, Australia, July 2011 
  3. -- 
  4.  
  5. with Float_Type; use Float_Type; 
  6.  
  7. generic 
  8.  
  9.    type Element is private; 
  10.    Buffer_Size  : Positive; 
  11.  
  12. package Generic_Sliding_Statistics is 
  13.  
  14.    procedure Add_Reading (New_Reading : Element); 
  15.  
  16.    generic 
  17.       with function "+" (Left, Right : Element)        return Element is <>; 
  18.       with function "/" (Left : Element; Right : Real) return Element is <>; 
  19.  
  20.    package Averages is 
  21.       function Average (New_Reading : Element) return Element; 
  22.       function Average                         return Element; 
  23.    end Averages; 
  24.  
  25.    -- 
  26.  
  27.    generic 
  28.       pragma Warnings (Off); -- declaration of "<" hides one in package Standard 
  29.       with function "<" (Left, Right : Element) return Boolean is <>; 
  30.       pragma Warnings (On); 
  31.  
  32.    package MinMax is 
  33.       function Min (New_Reading : Element) return Element; 
  34.       function Max (New_Reading : Element) return Element; 
  35.       function Min                         return Element; 
  36.       function Max                         return Element; 
  37.    end MinMax; 
  38.  
  39.    No_Elements_in_Stats_Buffer : exception; 
  40.  
  41. end Generic_Sliding_Statistics;