-- Copyright (C) 1985  by Xerox Corporation. All rights reserved. 
-- ArpaStatsImpl.mesa; last edited by SMA  13-Jul-85 13:10:25

DIRECTORY
  ArpaStats,
  CommHeap USING [zone];
  
ArpaStatsImpl: PROGRAM
  IMPORTS CommHeap
  EXPORTS ArpaStats =
  
  BEGIN
  counters: ArpaStats.Counters;
  
  Bump: PUBLIC PROC[i: ArpaStats.CounterIndex, n: CARDINAL] =
    {counters[i] ← counters[i] + n};
    
  Clear: PUBLIC PROC =
    {FOR i: ArpaStats.CounterIndex IN ArpaStats.CounterIndex DO
      counters[i] ← 0;
      ENDLOOP};

  GetCounter: PUBLIC PROC[i: ArpaStats.CounterIndex] RETURNS [LONG CARDINAL] =
    {RETURN[counters[i]]};
    
  GetCounters: PUBLIC PROC RETURNS [ArpaStats.Counters] =
    {RETURN[counters]};
    
  Incr: PUBLIC PROC [i: ArpaStats.CounterIndex] =
    {counters[i] ← counters[i] + 1};
    
  --mainline code.  
  counters ← CommHeap.zone.NEW[ARRAY ArpaStats.CounterIndex OF LONG CARDINAL];
  Clear[];
  END..
  
LOG

13-Jul-85 12:47:55  SMA  Created file.