-- Example of an intermediate level abstraction for
-- accumulating Report data in a useful form
--
with Time_Utilities;
package Report_Data is

    type Information is private;

    procedure Initialize (Info : in out Information);

    -- Gathers information from all available accounting files
    --

    type User_Iterator is limited private;

    subtype User_Name is String;

    System : constant User_Name := "*SYSTEM";

    -- user name for all system entries in the accounting logs
    --

    procedure Init (Info : Information; Iter : out User_Iterator);

    -- returns an iterator with all users found in the accounting logs
    --

    function Done (Iter : User_Iterator) return Boolean;
    function Value (Iter : User_Iterator) return User_Name;
    procedure Next (Iter : in out User_Iterator);

    type Session_Iterator is limited private;

    subtype Session_Name is String;

    procedure Init (Info : Information;
                    For_User : User_Name;
                    Iter : out Session_Iterator);

    -- returns an iterator with all session found for a particular user
    --

    function Done (Iter : Session_Iterator) return Boolean;
    function Value (Iter : Session_Iterator) return Session_Name;
    procedure Next (Iter : in out Session_Iterator);

    function Total_Connect_Time (For_User : User_Name;
                                 For_Session : Session_Name;
                                 In_Month : Time_Utilities.Months;
                                 In_Year : Time_Utilities.Years;
                                 Info : Information) return Duration;

    -- returns the total connect time for a user in a particular
    -- month and year.  The user_name can either be gotten from
    -- the user_iterator or input directly.  User names must match
    -- the login name.

    function Total_Cpu_Time (For_User : User_Name;
                             For_Session : Session_Name;
                             In_Month : Time_Utilities.Months;
                             In_Year : Time_Utilities.Years;
                             Info : Information) return Duration;


    -- returns the total CPU time for a user in a particular
    -- month and year.  The user_name can either be gotten from
    -- the user_iterator or input directly.  User names must match
    -- the login name.

    function Total_Jobs_Spawned (For_User : User_Name;
                                 For_Session : Session_Name;
                                 In_Month : Time_Utilities.Months;
                                 In_Year : Time_Utilities.Years;
                                 Info : Information) return Duration;


    -- returns the total number of jobs spawned for a user in a particular
    -- month and year.  The user_name can either be gotten from
    -- the user_iterator or input directly.  User names must match
    -- the login name.


private
    type Information is new Boolean;

    type User_Iterator is new Boolean;

    type Session_Iterator is new Boolean;

end Report_Data;