comp.lang.ada
 help / color / mirror / Atom feed
From: pruiz@SIRIO.DIT.UPM.ES
Subject: (no subject given)
Date: 1996/02/21
Date: 1996-02-21T00:00:00+00:00	[thread overview]
Message-ID: <199602211831.TAA01734@vega.gic.tat.upm.es> (raw)

I would like to know why the gnat sends the  message :
  "type (Unit) must be declared abstract or Set (procedure) overrides"
when I'm compiling the package body "Controller-p.adb";the error is detected
in the specification, i.e., in "Controller-p.ads".

Package Controller is abstract and generic;
Package Controller.P is his child :it isn't Abstract!!! but is generic;
 I supposed when I writted it, that Set overrides, but this is not a problem,
is it ??? This is the usual when we are working with abstract types and subpro-
grams, isn't it???  This is my conclusion reading the last Barnes' book.

Next, I send the packages.

Thank you very much!!!!.

*******************************************************************************

generic    -- package Controller,it is abstract.

  type Controlled_Variable is delta <>;
  type Actuating_Variable  is delta <>;

package Controller is    -- generic

   type Unit is abstract tagged private;
   subtype Class is Unit'Class;


   procedure Set     (Device      : in  out  Unit)  is abstract;



   procedure Control (Device      : in  out  Unit;
                      Reference   : in       Controlled_Variable;
                      Measurement : in       Controlled_Variable;
                      Action      :     out  Actuating_Variable) is abstract;


private
   type Unit is tagged null record;

end Controller;


--  /**************************************************************************


generic  --  package Controller.P

   type Parameter  is delta <>;  --  generic parameter

package Controller.P is    --  generic

   type Proportional_Controller is new Unit with private;

private
   type Proportional_Controller is new Unit with
      record
         Gain : Parameter;
      end record;


   procedure Set      (Device      :   in  out  Proportional_Controller;
                       Gain        :   in       Parameter);

   procedure Control  (Device      :   in  out  Proportional_Controller;
                       Reference   :   in       Controlled_Variable;
                       Measurement :   in       Controlled_Variable;
                       Action      :       out  Actuating_Variable);


end Controller.P;



--  /**********************************************************************
--  / Controller.P
--  /**************************************************************************

package body Controller.P is    --  generic


   procedure Set      (Device      :  in   out Proportional_Controller;
                       Gain        :  in       Parameter)   is
   begin

      Device.Gain := Gain;

   end Set;


   procedure Control     (Device      :  in  out  Proportional_Controller;
                          Reference   :  in       Controlled_Variable;
                          Measurement :  in       Controlled_Variable;
                          Action      :      out  Actuating_Variable)   is
   Error : Controlled_Variable;

   begin

      Error  :=  Reference - Measurement;
      Action :=  Device.Gain * Error;

   end Control;

end Controller.P;


-- ***************************************************************************




             reply	other threads:[~1996-02-21  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-21  0:00 pruiz [this message]
1996-02-22  0:00 ` (no subject given) Pascal OBRY
  -- strict thread matches above, loose matches on Subject: below --
1998-04-19  0:00 Chau
1998-04-19  0:00 ` Matthew Heaney
1998-04-19  0:00   ` Matthew Heaney
1996-09-03  0:00 Chris Sparks
1996-09-04  0:00 ` Jon S Anthony
1996-09-05  0:00   ` Robert Dewar
1996-09-06  0:00 ` Jon S Anthony
1996-07-05  0:00 JOHN LY
1994-12-21 20:07 Eric Baker
1994-11-20 20:12 Terry Mellon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox