-- $Date: 2004/03/08 11:05:10 $
-- $Revision: 1.11 $
-- $Author: jcrocholl $
-- $Hash: 366858281d93fb627d1a31721275ef1f $

-- This file was automatically created with ado.php.
-- Manual changes will be lost when it is updated.

package body Measures is

   -- Constructor for instances.
   function Create
     (Number : in Natural := 0) -- The initial number.
     return Measure_Access      -- The newly created measure.
   is
      Result : Measure_Access := new Measure;
   begin
      Result.Number := Number;
      Result.Clefs := Clef_Lists.Create;
      Result.Times := Time_Lists.Create;
      Result.Musics := Music_Lists.Create;
      return Result;
   end Create;

   -- Accessor to read the number of a measure.
   function Get_Number
     (This : access Measure-- The measure to read from.
     return Natural is       -- The number of that measure.
   begin
      return This.Number;
   end Get_Number;

   -- Mutator to update the divisions of a measure.
   procedure Set_Divisions
     (This      : access Measure;      -- The measure to be updated.
      Divisions : in Positive := 1) is -- The new divisions of that measure.
   begin
      This.Divisions := Divisions;
   end Set_Divisions;

   -- Accessor to read the divisions of a measure.
   function Get_Divisions
     (This : access Measure-- The measure to read from.
     return Positive is      -- The divisions of that measure.
   begin
      return This.Divisions;
   end Get_Divisions;

   -- Mutator to update the key of a measure.
   procedure Set_Key
     (This : access Measure;   -- The measure to be updated.
      Key  : in Key_Access) is -- The new key of that measure.
   begin
      This.Key := Key;
   end Set_Key;

   -- Accessor to read the key of a measure.
   function Get_Key
     (This : access Measure-- The measure to read from.
     return Key_Access is    -- The key of that measure.
   begin
      return This.Key;
   end Get_Key;

   -- Mutator to update the staves of a measure.
   procedure Set_Staves
     (This   : access Measure;     -- The measure to be updated.
      Staves : in Natural := 0) is -- The new staves of that measure.
   begin
      This.Staves := Staves;
   end Set_Staves;

   -- Accessor to read the staves of a measure.
   function Get_Staves
     (This : access Measure-- The measure to read from.
     return Natural is       -- The staves of that measure.
   begin
      return This.Staves;
   end Get_Staves;

   -- Accessor to read the clefs of a measure.
   function Get_Clefs
     (This : access Measure)    -- The measure to read from.
     return Clef_List_Access is -- The clefs of that measure.
   begin
      return This.Clefs;
   end Get_Clefs;

   -- Accessor to read the times of a measure.
   function Get_Times
     (This : access Measure)    -- The measure to read from.
     return Time_List_Access is -- The times of that measure.
   begin
      return This.Times;
   end Get_Times;

   -- Accessor to read the musics of a measure.
   function Get_Musics
     (This : access Measure)     -- The measure to read from.
     return Music_List_Access is -- The musics of that measure.
   begin
      return This.Musics;
   end Get_Musics;

   -- Add a clef to the measure.
   procedure Add_Clef
     (This : access Measure-- The measure object instance.
      Add  : access Clef) is -- Add this clef.
   begin
      Clef_Lists.Push(This.Clefs, Clef_Access(Add));
   end Add_Clef;

   -- Add a time to the measure.
   procedure Add_Time
     (This : access Measure-- The measure object instance.
      Add  : access Time) is -- Add this time.
   begin
      Time_Lists.Push(This.Times, Time_Access(Add));
   end Add_Time;

   -- Add some music to the end of the measure.
   procedure Add_Music
     (This : access Measure;                  -- The measure object instance.
      Add  : access Music_Data'Class) is -- Add this music.
   begin
      Music_Lists.Push(This.Musics, Music_Data_Access(Add));
   end Add_Music;

end Measures;