-- $Date: 2004/03/08 11:05:10 $
-- $Revision: 1.19 $
-- $Author: jcrocholl $
-- $Hash: 0cc98c5e4dca8ebdd53d58bcc27693ba $

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

package body Parts is

   -- Constructor for instances.
   function Create
     (Id : in String)   -- The initial id.
     return Part_Access -- The newly created part.
   is
      Result : Part_Access := new Part;
   begin
      To_String_Access(Id, Result.Id);
      Result.Measures := Measure_Lists.Create;
      return Result;
   end Create;

   -- Accessor to read the id of a part.
   function Get_Id
     (This : access Part-- The part to read from.
     return String is     -- The id of that part.
   begin
      return To_String(This.Id);
   end Get_Id;

   -- Mutator to update the name of a part.
   procedure Set_Name
     (This : access Part;  -- The part to be updated.
      Name : in String) is -- The new name of that part.
   begin
      To_String_Access(Name, This.Name);
   end Set_Name;

   -- Accessor to read the name of a part.
   function Get_Name
     (This : access Part-- The part to read from.
     return String is     -- The name of that part.
   begin
      return To_String(This.Name);
   end Get_Name;

   -- Mutator to update the score instrument of a part.
   procedure Set_Score_Instrument
     (This             : access Part;                   -- The part to be updated.
      Score_Instrument : in Score_Instrument_Access) is -- The new score instrument of that part.
   begin
      This.Score_Instrument := Score_Instrument;
   end Set_Score_Instrument;

   -- Accessor to read the score instrument of a part.
   function Get_Score_Instrument
     (This : access Part)              -- The part to read from.
     return Score_Instrument_Access is -- The score instrument of that part.
   begin
      return This.Score_Instrument;
   end Get_Score_Instrument;

   -- Mutator to update the midi instrument of a part.
   procedure Set_Midi_Instrument
     (This            : access Part;                  -- The part to be updated.
      Midi_Instrument : in Midi_Instrument_Access) is -- The new midi instrument of that part.
   begin
      This.Midi_Instrument := Midi_Instrument;
   end Set_Midi_Instrument;

   -- Accessor to read the midi instrument of a part.
   function Get_Midi_Instrument
     (This : access Part)             -- The part to read from.
     return Midi_Instrument_Access is -- The midi instrument of that part.
   begin
      return This.Midi_Instrument;
   end Get_Midi_Instrument;

   -- Accessor to read the measures of a part.
   function Get_Measures
     (This : access Part)          -- The part to read from.
     return Measure_List_Access is -- The measures of that part.
   begin
      return This.Measures;
   end Get_Measures;

   -- Add a measure to the end of the part.
   procedure Add_Measure
     (This : access Part;                -- The part object instance.
      Add  : access Measures.Measure) is -- The measure to be added.
   begin
      Measure_Lists.Push(This.Measures, Measures.Measure_Access(Add));
   end Add_Measure;

end Parts;